Skip to content

Commit 2f93a1a

Browse files
committed
Update release workflow (#30)
1 parent 5fcf5e2 commit 2f93a1a

13 files changed

Lines changed: 350 additions & 225 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,81 @@
11
name: CI
22

33
on:
4-
push:
5-
branches:
6-
- master
74
pull_request:
5+
branches:
6+
- '*'
7+
push:
88
branches:
99
- master
1010

1111
defaults:
1212
run:
1313
shell: bash
1414

15+
env:
16+
RUSTFLAGS: --deny warnings
17+
1518
jobs:
16-
all:
17-
name: All
19+
lint:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: Swatinem/rust-cache@v2
26+
27+
- name: Clippy
28+
run: cargo clippy --all --all-targets
29+
30+
- name: Format
31+
run: cargo fmt --all -- --check
32+
33+
- name: Install Dependencies
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install ripgrep shellcheck
37+
38+
- name: Check for Forbidden Words
39+
run: ./bin/forbid
1840

41+
- name: Check /bin scripts
42+
run: shellcheck bin/*
43+
44+
msrv:
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- uses: actions-rust-lang/setup-rust-toolchain@v1
51+
52+
- uses: Swatinem/rust-cache@v2
53+
54+
- name: Check
55+
run: cargo check
56+
57+
test:
1958
strategy:
2059
matrix:
2160
os:
2261
- ubuntu-latest
2362
- macos-latest
63+
- windows-latest
2464

2565
runs-on: ${{matrix.os}}
2666

27-
env:
28-
RUSTFLAGS: --deny warnings
29-
3067
steps:
31-
- uses: actions/checkout@v2
68+
- uses: actions/checkout@v4
3269

33-
- name: Install Rust Toolchain Components
34-
uses: actions-rs/toolchain@v1
35-
with:
36-
components: clippy, rustfmt
37-
override: true
38-
toolchain: stable
70+
- name: Remove Broken WSL bash executable
71+
if: ${{ matrix.os == 'windows-latest' }}
72+
shell: cmd
73+
run: |
74+
takeown /F C:\Windows\System32\bash.exe
75+
icacls C:\Windows\System32\bash.exe /grant administrators:F
76+
del C:\Windows\System32\bash.exe
3977
40-
- uses: Swatinem/rust-cache@v1
78+
- uses: Swatinem/rust-cache@v2
4179

42-
- name: Check Lockfile
43-
run: |
44-
cargo update --locked --package present
4580
- name: Test
4681
run: cargo test --all
47-
48-
- name: Clippy
49-
run: cargo clippy --all --all-targets
50-
51-
- name: Format
52-
run: cargo fmt --all -- --check
53-
54-
- name: Check for Forbidden Words
55-
if: ${{ matrix.os == 'ubuntu-latest' }}
56-
run: |
57-
sudo apt-get update
58-
sudo apt-get install ripgrep
59-
./bin/forbid

.github/workflows/release.yaml

Lines changed: 89 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,87 @@ defaults:
99
run:
1010
shell: bash
1111

12+
env:
13+
RUSTFLAGS: --deny warnings
14+
1215
jobs:
13-
all:
14-
name: All
16+
prerelease:
17+
runs-on: ubuntu-latest
18+
19+
outputs:
20+
value: ${{ steps.prerelease.outputs.value }}
21+
22+
steps:
23+
- name: Prerelease Check
24+
id: prerelease
25+
run: |
26+
if [[ ${{ github.ref_name }} =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
27+
echo value=false >> "$GITHUB_OUTPUT"
28+
else
29+
echo value=true >> "$GITHUB_OUTPUT"
30+
fi
1531
32+
package:
1633
strategy:
17-
fail-fast: false
1834
matrix:
1935
target:
36+
- aarch64-apple-darwin
37+
- aarch64-unknown-linux-musl
38+
- arm-unknown-linux-musleabihf
39+
- armv7-unknown-linux-musleabihf
2040
- x86_64-apple-darwin
2141
- x86_64-pc-windows-msvc
22-
- x86_64-unknown-linux-gnu
42+
- aarch64-pc-windows-msvc
43+
- x86_64-unknown-linux-musl
2344
include:
45+
- target: aarch64-apple-darwin
46+
os: macos-latest
47+
target_rustflags: ''
48+
- target: aarch64-unknown-linux-musl
49+
os: ubuntu-latest
50+
target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc'
51+
- target: arm-unknown-linux-musleabihf
52+
os: ubuntu-latest
53+
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc'
54+
- target: armv7-unknown-linux-musleabihf
55+
os: ubuntu-latest
56+
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc'
2457
- target: x86_64-apple-darwin
2558
os: macos-latest
2659
target_rustflags: ''
2760
- target: x86_64-pc-windows-msvc
2861
os: windows-latest
62+
- target: aarch64-pc-windows-msvc
63+
os: windows-latest
2964
target_rustflags: ''
30-
- target: x86_64-unknown-linux-gnu
65+
- target: x86_64-unknown-linux-musl
3166
os: ubuntu-latest
3267
target_rustflags: ''
3368

3469
runs-on: ${{matrix.os}}
3570

71+
needs:
72+
- prerelease
73+
3674
steps:
37-
- uses: actions/checkout@v2
75+
- uses: actions/checkout@v4
3876

39-
- name: Install Rust Toolchain Components
40-
uses: actions-rs/toolchain@v1
41-
with:
42-
override: true
43-
target: ${{ matrix.target }}
44-
toolchain: stable
77+
- name: Install AArch64 Toolchain
78+
if: ${{ matrix.target == 'aarch64-unknown-linux-musl' }}
79+
run: |
80+
sudo apt-get update
81+
sudo apt-get install gcc-aarch64-linux-gnu libc6-dev-i386
4582
46-
- name: Install Linux Dependencies
47-
if: ${{ matrix.os == 'ubuntu-latest' }}
83+
- name: Install ARM Toolchain
84+
if: ${{ matrix.target == 'arm-unknown-linux-musleabihf' || matrix.target == 'armv7-unknown-linux-musleabihf' }}
4885
run: |
4986
sudo apt-get update
50-
sudo apt-get install musl-tools libssl-dev pkg-config
87+
sudo apt-get install gcc-arm-linux-gnueabihf
5188
52-
- name: Release Type
53-
id: release-type
89+
- name: Install AArch64 Toolchain (Windows)
90+
if: ${{ matrix.target == 'aarch64-pc-windows-msvc' }}
5491
run: |
55-
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
56-
echo ::set-output name=value::release
57-
else
58-
echo ::set-output name=value::prerelease
59-
fi
92+
rustup target add aarch64-pc-windows-msvc
6093
6194
- name: Package
6295
id: package
@@ -69,11 +102,43 @@ jobs:
69102
shell: bash
70103

71104
- name: Publish Archive
72-
uses: softprops/action-gh-release@v0.1.5
105+
uses: softprops/action-gh-release@v2.2.1
73106
if: ${{ startsWith(github.ref, 'refs/tags/') }}
74107
with:
75108
draft: false
76109
files: ${{ steps.package.outputs.archive }}
77-
prerelease: ${{ steps.release-type.outputs.value == 'prerelease' }}
110+
prerelease: ${{ needs.prerelease.outputs.value }}
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
114+
checksum:
115+
runs-on: ubuntu-latest
116+
117+
needs:
118+
- package
119+
- prerelease
120+
121+
steps:
122+
- name: Download Release Archives
123+
env:
124+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
run: >-
126+
gh release download
127+
--repo terror/present
128+
--pattern '*'
129+
--dir release
130+
${{ github.ref_name }}
131+
132+
- name: Create Checksums
133+
run: |
134+
cd release
135+
shasum -a 256 ./* > ../SHA256SUMS
136+
137+
- name: Publish Checksums
138+
uses: softprops/action-gh-release@v2.2.1
139+
with:
140+
draft: false
141+
files: SHA256SUMS
142+
prerelease: ${{ needs.prerelease.outputs.value }}
78143
env:
79144
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)