Repository navigation
146 lines (130 loc) · 4.49 KB
/
Copy pathrust.yml
File metadata and controls
146 lines (130 loc) · 4.49 KB
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
name: Rust
on:
push:
branches: [ "master" ]
tags:
- "v*"
pull_request:
branches: [ "master" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Format
run: cargo fmt -- --check
build-targets:
needs:
- check
strategy:
matrix:
crate:
- ginko
- ginko_ls
target:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- aarch64-apple-darwin
rust:
- stable
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
ext: ""
- target: x86_64-pc-windows-gnu
os: windows-latest
ext: .exe
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
- target: aarch64-apple-darwin
os: macos-latest
ext: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup toolchain
if: matrix.os == 'macos-latest'
run: rustup target add aarch64-apple-darwin
- name: Build
run: cargo build --manifest-path ${{ matrix.crate }}/Cargo.toml --release --target ${{ matrix.target }}
- name: Test
if: matrix.os != 'macos-latest' # There are no free runners for Apple Silicon available at the moment
run: cargo test --verbose --manifest-path ${{ matrix.crate }}/Cargo.toml --target ${{ matrix.target }}
- name: Assemble
if: matrix.rust == 'stable'
run: |
mkdir ${{ matrix.crate }}-${{ matrix.target }}
mkdir ${{ matrix.crate }}-${{ matrix.target }}/bin
cp target/${{ matrix.target }}/release/${{ matrix.crate }}${{ matrix.ext }} ${{ matrix.crate }}-${{ matrix.target }}/bin
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.crate }}-${{ matrix.target }}
path: ${{ matrix.crate }}-${{ matrix.target }}
release:
permissions: write-all
name: Release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: build-targets
steps:
- name: Get version
id: v
run: |
echo "v=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
echo "Version is v${GITHUB_REF/refs\/tags\/v/}"
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: ginko*
path: ~/temp
- name: Check ginko version
run: |
chmod u+x ~/temp/ginko-x86_64-unknown-linux-gnu/bin/ginko
version_string=$(~/temp/ginko-x86_64-unknown-linux-gnu/bin/ginko --version)
if [ "$version_string" != "ginko $v" ]
then
echo "Version string mismatch (\"$version_string\" != \"ginko $v\""
exit 1
else
echo "Version string matched"
fi
- name: Check ginko_ls version
run: |
chmod u+x ~/temp/ginko_ls-x86_64-unknown-linux-gnu/bin/ginko_ls
version_string=$(~/temp/ginko_ls-x86_64-unknown-linux-gnu/bin/ginko_ls --version)
if [ "$version_string" != "ginko_ls $v" ]
then
echo "Version string mismatch (\"$version_string\" != \"ginko $v\""
exit 1
else
echo "Version string matched"
fi
- name: Zip artifacts
run: |
cd ~/temp
chmod +x */bin/ginko*
zip -r ginko-x86_64-unknown-linux-gnu.zip ginko-x86_64-unknown-linux-gnu
zip -r ginko_ls-x86_64-unknown-linux-gnu.zip ginko_ls-x86_64-unknown-linux-gnu
zip -r ginko-x86_64-pc-windows-gnu.zip ginko-x86_64-pc-windows-gnu
zip -r ginko_ls-x86_64-pc-windows-gnu.zip ginko_ls-x86_64-pc-windows-gnu
zip -r ginko-x86_64-pc-windows-msvc.zip ginko-x86_64-pc-windows-msvc
zip -r ginko_ls-x86_64-pc-windows-msvc.zip ginko_ls-x86_64-pc-windows-msvc
zip -r ginko-aarch64-apple-darwin.zip ginko-aarch64-apple-darwin
zip -r ginko_ls-aarch64-apple-darwin.zip ginko_ls-aarch64-apple-darwin
- name: Do release
uses: ncipollo/release-action@v1
with:
draft: false
artifacts: "~/temp/*.zip"
token: ${{ secrets.GITHUB_TOKEN }}