-
-
Notifications
You must be signed in to change notification settings - Fork 107
174 lines (167 loc) · 5.25 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: "gir"
on:
pull_request:
branches:
- "*"
push:
branches:
- "main"
jobs:
hygiene:
name: Hygiene
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain: [stable]
defaults:
run:
shell: bash
steps:
- name: Acquire source code
uses: actions/checkout@v4
- name: Acquire Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
profile: minimal
components: rustfmt, clippy
id: toolchain
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: checks-${{ runner.os }}-cargo-registry-trimmed
- name: Cache cargo git trees
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: checks-${{ runner.os }}-cargo-gits-trimmed
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: checks-${{ runner.os }}-cargo-target-dir-${{ steps.toolchain.outputs.rustc_hash }}
- name: "Run clippy"
uses: actions-rs/cargo@v1
with:
command: clippy
args: --release --tests -- -D warnings
if: matrix.os == 'ubuntu-latest'
- name: "Run formatting check"
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
if: matrix.os == 'ubuntu-latest'
build:
name: "Build/Test"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain: [nightly, stable]
# include:
# - os: windows-latest
# toolchain: stable-i686-pc-windows-gnu
# bits: 32
# arch: i686
# - os: windows-latest
# toolchain: stable-x86_64-pc-windows-gnu
# bits: 64
# arch: x86_64
defaults:
run:
shell: bash
steps:
- name: Acquire source code
uses: actions/checkout@v4
- name: Acquire Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
profile: minimal
id: toolchain
- name: Install MSYS2
uses: numworks/setup-msys2@v1
if: matrix.os == 'windows-latest'
- name: Set up MSYS2 path and other windows env
run: |
echo "::add-path::$RUNNER_TEMP\\msys\\msys64\\usr\\bin"
echo "::add-path::$RUNNER_TEMP\\msys\\msys64\\mingw${{ matrix.bits }}\\bin"
echo "::set-env name=LIBGIT2_SYS_USE_PKG_CONFIG::1"
if: matrix.os == 'windows-latest'
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: build-${{ runner.os }}-cargo-registry-trimmed
- name: Cache cargo git trees
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: build-${{ runner.os }}-cargo-gits-trimmed
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: build-${{ runner.os }}-cargo-target-dir-${{ steps.toolchain.outputs.rustc_hash }}
- name: Install packages from apt
run: |
sudo apt update
sudo apt install libgtk-4-dev libssh2-1-dev libglib2.0-dev libgraphene-1.0-dev libcairo-gobject2 libcairo2-dev
if: matrix.os == 'ubuntu-latest'
- name: Install toolchain packages with pacman
run: pacman --noconfirm -S base-devel mingw-w64-${{ matrix.arch }}-toolchain
if: matrix.os == 'windows-latest'
- name: Install library devel packages with pacman
run: pacman --noconfirm -S mingw-w64-${{ matrix.arch }}-libgit2
if: matrix.os == 'windows-latest'
- name: "Acquire gir-files"
uses: actions/checkout@v4
with:
repository: gtk-rs/gir-files
ref: main
path: tests/gir-files
- name: "Build (release)"
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: "Test (release)"
uses: actions-rs/cargo@v1
with:
command: test
args: --release
- name: "Acquire gtk4-rs"
uses: actions/checkout@v4
with:
repository: gtk-rs/gtk4-rs
ref: main
path: gtk4-rs
if: matrix.os == 'ubuntu-latest'
- name: "Symlink `gir` in gtk4-rs"
run: |
rmdir gtk4-rs/gir
ln -sf .. gtk4-rs/gir
- name: "Attempt to rebuild gtk4-rs gir"
run: cd gtk4-rs && python3 generator.py --no-fmt --gir-path ../target/release/gir --gir-files-directories ../tests/gir-files/ && rm ../Cargo.* && cargo build
if: matrix.os == 'ubuntu-latest'
- name: "Acquire gtk-rs-core"
uses: actions/checkout@v4
with:
repository: gtk-rs/gtk-rs-core
ref: main
path: gtk-rs-core
if: matrix.os == 'ubuntu-latest'
- name: "Symlink `gir` in gtk-rs-core"
run: |
rmdir gtk-rs-core/gir
ln -sf .. gtk-rs-core/gir
- name: "Rebuild gio"
run: cd gtk-rs-core/gio && cargo test
if: matrix.os == 'ubuntu-latest'