Skip to content

Commit 4d5b958

Browse files
committed
test
1 parent 57b2cf5 commit 4d5b958

5 files changed

Lines changed: 377 additions & 160 deletions

File tree

.github/workflows/ci-reusable.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Reusable CI workflow
3+
4+
on:
5+
workflow_call:
6+
7+
jobs:
8+
linux:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 15
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions-rust-lang/setup-rust-toolchain@v1
14+
with:
15+
components: clippy, rustfmt
16+
rustflags: ""
17+
target: x86_64-unknown-linux-gnu
18+
- uses: mamba-org/setup-micromamba@v2
19+
env:
20+
ACTIONS_STEP_DEBUG: true
21+
- run: sudo apt-get update && sudo apt-get install -y fish zsh
22+
- run: cargo test --all-features
23+
if: always()
24+
- run: cargo fmt --check
25+
if: always()
26+
- run: cargo clippy --all-targets
27+
if: always()
28+
- run: cargo build --release --all-features
29+
if: always()
30+
31+
windows:
32+
runs-on: windows-latest
33+
timeout-minutes: 15
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: actions-rust-lang/setup-rust-toolchain@v1
37+
with:
38+
components: clippy, rustfmt
39+
rustflags: ""
40+
target: x86_64-pc-windows-msvc
41+
- uses: mamba-org/setup-micromamba@v2
42+
env:
43+
ACTIONS_STEP_DEBUG: true
44+
- run: cargo test --no-default-features --features=__test_powershell
45+
if: always()
46+
- run: cargo fmt --check
47+
if: always()
48+
- run: cargo clippy --all-targets
49+
if: always()
50+
- run: cargo build --release --features=__test_powershell
51+
if: always()

.github/workflows/ci.yml

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,5 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
linux:
11-
runs-on: ubuntu-latest
12-
timeout-minutes: 15
13-
steps:
14-
- uses: actions/checkout@v4
15-
- uses: actions-rust-lang/setup-rust-toolchain@v1
16-
with:
17-
components: clippy, rustfmt
18-
rustflags: ""
19-
target: x86_64-unknown-linux-gnu
20-
- uses: mamba-org/setup-micromamba@v2
21-
env:
22-
ACTIONS_STEP_DEBUG: true
23-
- run: sudo apt-get update && sudo apt-get install -y fish zsh
24-
- run: cargo test --all-features
25-
if: always()
26-
- run: cargo fmt --check
27-
if: always()
28-
- run: cargo clippy --all-targets
29-
if: always()
30-
- run: cargo build --release --all-features
31-
if: always()
32-
33-
windows:
34-
runs-on: windows-latest
35-
timeout-minutes: 15
36-
steps:
37-
- uses: actions/checkout@v4
38-
- uses: actions-rust-lang/setup-rust-toolchain@v1
39-
with:
40-
components: clippy, rustfmt
41-
rustflags: ""
42-
target: x86_64-pc-windows-msvc
43-
- uses: mamba-org/setup-micromamba@v2
44-
env:
45-
ACTIONS_STEP_DEBUG: true
46-
- run: cargo test --no-default-features --features=__test_powershell
47-
if: always()
48-
- run: cargo fmt --check
49-
if: always()
50-
- run: cargo clippy --all-targets
51-
if: always()
52-
- run: cargo build --release --features=__test_powershell
53-
if: always()
10+
ci:
11+
uses: ./.github/workflows/ci-reusable.yml

.github/workflows/release.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
name: Release
3+
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
preflight:
11+
name: Preflight checks
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Check that tag matches version in Cargo.toml
16+
run: |
17+
version=$(cargo pkgid | cut -d'#' -f2)
18+
if [ "$version" != "${{ github.ref_name }}" ]; then
19+
echo "Tag version does not match Cargo.toml version"
20+
echo "Tag: ${{ github.ref_name }}, Cargo.toml: $version"
21+
exit 1
22+
fi
23+
24+
ci:
25+
name: Run CI
26+
needs: preflight
27+
uses: ./.github/workflows/ci-reusable.yml
28+
29+
release:
30+
needs: ci
31+
runs-on: ${{ matrix.runs-on }}
32+
timeout-minutes: 15
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
- runs-on: windows-latest
38+
target: x86_64-pc-windows-msvc
39+
40+
- runs-on: windows-latest
41+
target: i686-pc-windows-msvc
42+
43+
- runs-on: windows-latest
44+
target: aarch64-pc-windows-msvc
45+
46+
- runs-on: ubuntu-latest
47+
target: x86_64-unknown-linux-musl
48+
49+
- runs-on: ubuntu-latest
50+
target: i686-unknown-linux-musl
51+
52+
- runs-on: ubuntu-latest
53+
target: aarch64-unknown-linux-musl
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- uses: actions-rust-lang/setup-rust-toolchain@v1
59+
with:
60+
components: clippy, rustfmt
61+
rustflags: ""
62+
target: ${{ matrix.target }}
63+
64+
- name: Install cross
65+
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
66+
run: cargo install cross --git https://github.com/cross-rs/cross
67+
68+
# This step seems absolutely necessary for 'cross' to work.
69+
- name: Clean build cache
70+
run: cargo clean
71+
72+
- name: Build (Windows)
73+
if: ${{ matrix.runs-on == 'windows-latest' }}
74+
run: cargo build --release --all-features --target=${{ matrix.target }}
75+
76+
- name: Build (Linux, cross compile)
77+
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
78+
run: cross build --release --all-features --target=${{ matrix.target }}
79+
80+
- name: Create a zip (windows)
81+
id: create-zip
82+
if: ${{ matrix.runs-on == 'windows-latest' }}
83+
run: |
84+
mkdir release
85+
cp LICENSE release/
86+
cp target/${{ matrix.target }}/release/csm.exe release/
87+
Compress-Archive -Path release/ -DestinationPath csm-${{ github.ref_name }}-${{ matrix.target }}.zip
88+
89+
- name: Create a tar.gz (linux)
90+
id: create-tar
91+
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
92+
run: |
93+
mkdir release
94+
cp LICENSE release/
95+
cp target/${{ matrix.target }}/release/csm release/
96+
tar -czvf csm-${{ github.ref_name }}-${{ matrix.target }}.tar.gz release/
97+
98+
- name: Release
99+
uses: softprops/action-gh-release@v2
100+
if: github.ref_type == 'tag'
101+
with:
102+
files: |
103+
csm*.zip
104+
csm*.tar.gz
105+
106+
test-release:
107+
name: Post-release test
108+
needs: release
109+
runs-on: ${{ matrix.runs-on }}
110+
timeout-minutes: 15
111+
strategy:
112+
fail-fast: false
113+
matrix:
114+
include:
115+
- runs-on: windows-latest
116+
- runs-on: ubuntu-latest
117+
steps:
118+
- name: Try latest release (linux)
119+
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
120+
run: |
121+
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/csm-${{ github.ref_name }}-x86_64-unknown-linux-musl.tar.gz
122+
tar -xvf csm-*.tar.gz
123+
./release/csm --version
124+
125+
- name: Try latest release (windows)
126+
if: ${{ matrix.runs-on == 'windows-latest' }}
127+
run: |
128+
Invoke-WebRequest -Uri https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/csm-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip -OutFile csm-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip
129+
Expand-Archive -Path csm-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip -DestinationPath .
130+
.\release\csm.exe --version

0 commit comments

Comments
 (0)