-
Notifications
You must be signed in to change notification settings - Fork 4
181 lines (149 loc) · 5.03 KB
/
build.yml
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
175
176
177
178
179
180
181
name: Build, test and release crate
on:
pull_request:
push:
branches:
- master
- dev
- next
jobs:
check:
name: Check crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: cocogitto/cocogitto-action@v3.2
with:
check-latest-tag-only: true
git-user: glsl-lang
git-user-email: glsl-lang@vtavernier.github.io
- uses: actions/cache@v2
with:
key: ${{ runner.os }}
path: |
~/.cargo/bin/cargo-readme
- name: Install cargo-readme
run: |
cargo-readme -V || (
cargo install --force cargo-readme && cargo-readme -V
)
- name: Check READMEs
run: ./ci/readme.sh -c
- name: Check formatting
run: cargo fmt -- --check
- name: Check clippy lints
run: cargo clippy -- -D warnings -A clippy::result_large_err
test:
name: Test crate
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-msvc
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
ignore_tests: ""
- target: x86_64-pc-windows-msvc
os: windows-latest
ignore_tests: "include_vert"
runs-on: ${{ matrix.os }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
- name: Force git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2
- name: Remove fuzz target from members on Windows
run: |
if [[ "${{ matrix.target }}" == *-windows-* ]]; then
sed -i '/fuzz/d' Cargo.toml
fi
- name: Run doc tests
run: cargo test --workspace -q --doc
- name: Run lib tests
run: cargo test --workspace -q --lib
- name: Run lib tests with serde
run: cargo test --workspace -q --lib --features serde
- name: Run lib tests with the three lexers
run: |
set -e
cargo test -p glsl-lang -q --lib --features lexer-v1
cargo test -p glsl-lang -q --lib --features lexer-v2-min
cargo test -p glsl-lang -q --lib --features lexer-v2-full
- name: Generate test driver
run: cargo xtask gen-tests
env:
IGNORE_TESTS: ${{ matrix.ignore_tests }}
- name: Run glsl-lang-pp/glslang tests
run: cargo test -p glsl-lang-pp --test glslang --features full
- name: Run glsl-lang/glslang tests
# Since the parser isn't ready yet, and some tests are invalid input anyways
continue-on-error: true
run: |
set +e
cargo test -p glsl-lang -q --test glslang --no-default-features --features lexer-v1
cargo test -p glsl-lang -q --test glslang --no-default-features --features lexer-v2-min
cargo test -p glsl-lang -q --test glslang --no-default-features --features lexer-v2-full
- name: Run glsl-lang-quote tests
run: |
cargo test -p glsl-lang-quote
release:
name: Release crate
needs: [check, test]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- uses: actions/cache@v2
with:
key: ${{ runner.os }}-cargo-release-tools-v1
path: |
~/.cargo/bin/cargo-set-version
~/.cargo/bin/cargo-upgrade
~/.cargo/bin/cargo-workspaces
- name: Install cargo utilities
run: |
# Install cargo-edit
[[ "$(cargo-upgrade -V)" == *0.8.0 && "$(cargo-set-version -V)" == *0.8.0 ]] || (
cargo install cargo-edit --force --version 0.8.0 \
&& cargo-upgrade -V \
&& cargo-set-version -V
)
# Install cargo-workspaces
[[ "$(cargo-workspaces -V)" == *0.2.34 ]] || (
cargo install cargo-workspaces --force --version 0.2.34 \
&& cargo-workspaces -V
)
- uses: cocogitto/cocogitto-action@v3.2
id: release
# Set to true because the action fails if there's nothing to release
continue-on-error: true
# Propagate secrets
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
check: false
release: true
git-user: glsl-lang
git-user-email: glsl-lang@vtavernier.github.io
- run: cog changelog --at ${{ steps.release.outputs.version }} -t full_hash > GITHUB_CHANGELOG.md
if: steps.release.outputs.version != ''
- uses: softprops/action-gh-release@v1
if: steps.release.outputs.version != ''
with:
token: ${{ secrets.GH_PAT }}
body_path: GITHUB_CHANGELOG.md
tag_name: ${{ steps.release.outputs.version }}
# vim: ft=yaml:ts=2:sw=2:et