-
Notifications
You must be signed in to change notification settings - Fork 64
172 lines (155 loc) · 5.89 KB
/
build-test-all.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
name: Build & test all configs
on: [push, pull_request]
jobs:
release-notice:
name: This is a release build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Show version
run: echo "This is a release build for v${GITHUB_REF/refs\/tags\/v/}"
build:
strategy:
matrix:
crate:
- vhdl_lang
- vhdl_ls
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-pc-windows-msvc
rust:
- stable
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
ext: ""
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
ext: ""
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
target: x86_64-unknown-linux-musl
components: rustfmt, clippy
- uses: awalsh128/cache-apt-pkgs-action@v1
if: matrix.os == 'ubuntu-latest'
with:
packages: musl-tools # provides musl-gcc
version: 1.0
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ${{ matrix.crate }}/Cargo.toml --release --target ${{ matrix.target }}
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ${{ matrix.crate }}/Cargo.toml --release --target ${{ matrix.target }}
- name: rustfmt
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'stable'
uses: actions-rs/cargo@v1
with:
command: fmt
args: --package ${{ matrix.crate }} -- --check
- name: clippy
if: matrix.os == 'ubuntu-latest'
uses: actions-rs/cargo@v1
with:
command: clippy
args: --package ${{ matrix.crate }} --all-targets --all-features -- -D warnings
- name: Assemble
if: matrix.rust == 'stable'
run: |
mkdir ${{ matrix.crate }}-${{ matrix.target }}
mkdir ${{ matrix.crate }}-${{ matrix.target }}/bin
cp -R vhdl_libraries ${{ matrix.crate }}-${{ matrix.target }}
cp target/${{ matrix.target }}/release/${{ matrix.crate }}${{ matrix.ext }} ${{ matrix.crate }}-${{ matrix.target }}/bin
- name: Upload
if: matrix.rust == 'stable'
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.crate }}-${{ matrix.target }}
path: ${{ matrix.crate }}-${{ matrix.target }}
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: Get version
id: v
run: |
echo ::set-output name=v::${GITHUB_REF/refs\/tags\/v/}
echo "Version is v${GITHUB_REF/refs\/tags\/v/}"
- uses: actions/checkout@v1
- name: Get vhdl_lang linux-musl
uses: actions/download-artifact@v1
with:
name: vhdl_lang-x86_64-unknown-linux-musl
- name: Check vhdl_lang version
run: |
chmod u+x vhdl_lang-x86_64-unknown-linux-musl/bin/vhdl_lang
version_string=$(vhdl_lang-x86_64-unknown-linux-musl/bin/vhdl_lang --version)
if [ "$version_string" != "vhdl_lang ${{ steps.v.outputs.v }}" ]
then
echo "Version string mismatch (\"$version_string\" != \"vhdl_lang ${{ steps.v.outputs.v }}\""
exit 1
else
echo "Version string matched"
fi
- name: Get vhdl_ls linux-musl
uses: actions/download-artifact@v1
with:
name: vhdl_ls-x86_64-unknown-linux-musl
- name: Check vhdl_ls version
run: |
chmod u+x vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls
version_string=$(vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --version)
if [ "$version_string" != "vhdl_ls ${{ steps.v.outputs.v }}" ]
then
echo "Version string mismatch (\"$version_string\" != \"vhdl_lang ${{ steps.v.outputs.v }}\""
exit 1
else
echo "Version string matched"
fi
- name: Get vhdl_lang linux-gnu
uses: actions/download-artifact@v1
with:
name: vhdl_lang-x86_64-unknown-linux-gnu
- name: Get vhdl_ls linux-gnu
uses: actions/download-artifact@v1
with:
name: vhdl_ls-x86_64-unknown-linux-gnu
- name: Get vhdl_lang windows
uses: actions/download-artifact@v1
with:
name: vhdl_lang-x86_64-pc-windows-msvc
- name: Get vhdl_ls windows
uses: actions/download-artifact@v1
with:
name: vhdl_ls-x86_64-pc-windows-msvc
- name: Zip artifacts
run: |
zip -r vhdl_lang-x86_64-unknown-linux-gnu.zip vhdl_lang-x86_64-unknown-linux-gnu
zip -r vhdl_ls-x86_64-unknown-linux-gnu.zip vhdl_ls-x86_64-unknown-linux-gnu
zip -r vhdl_lang-x86_64-unknown-linux-musl.zip vhdl_lang-x86_64-unknown-linux-musl
zip -r vhdl_ls-x86_64-unknown-linux-musl.zip vhdl_ls-x86_64-unknown-linux-musl
zip -r vhdl_lang-x86_64-pc-windows-msvc.zip vhdl_lang-x86_64-pc-windows-msvc
zip -r vhdl_ls-x86_64-pc-windows-msvc.zip vhdl_ls-x86_64-pc-windows-msvc
- name: Do release
uses: ncipollo/release-action@v1
with:
draft: false
artifacts: "vhdl_lang-x86_64-unknown-linux-gnu.zip,vhdl_ls-x86_64-unknown-linux-gnu.zip,vhdl_lang-x86_64-unknown-linux-musl.zip,vhdl_ls-x86_64-unknown-linux-musl.zip,vhdl_lang-x86_64-pc-windows-msvc.zip,vhdl_ls-x86_64-pc-windows-msvc.zip"
token: ${{ secrets.GITHUB_TOKEN }}