Skip to content

Commit d0353eb

Browse files
committed
chore: setup CI
1 parent 7d589ad commit d0353eb

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Continuous Integration (CI)
2+
on: [push]
3+
4+
concurrency:
5+
group: "ci-${{ github.ref_name }}"
6+
cancel-in-progress: true
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: Swatinem/rust-cache@v2
15+
- name: cargo test
16+
run: |
17+
cargo fmt --check
18+
cargo test
19+
release:
20+
needs: [test]
21+
if: startsWith(github.ref, 'refs/tags/')
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
arch:
27+
- target: x86_64-unknown-linux-gnu
28+
name: amd64
29+
- target: aarch64-unknown-linux-gnu
30+
name: aarch64
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Install Rust with Cross
35+
shell: bash
36+
run: |
37+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
38+
rustup toolchain install stable --profile minimal
39+
rustup target add ${{ matrix.arch.target }}
40+
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
41+
cargo binstall --no-confirm cross
42+
- uses: Swatinem/rust-cache@v2
43+
with:
44+
key: ${{ matrix.arch.target }}
45+
cache-on-failure: true
46+
- name: Build Binary
47+
run: |
48+
cross build --verbose --locked --release --target ${{ matrix.arch.target }}
49+
mv target/${{ matrix.arch.target }}/release/wg-multizone target/${{ matrix.arch.target }}/release/wg-multizone-${{ matrix.arch.name }}
50+
- name: publish artifacts
51+
if: startsWith(github.ref, 'refs/tags/')
52+
uses: softprops/action-gh-release@v2
53+
with:
54+
files: |
55+
target/${{ matrix.arch.target }}/release/wg-multizone-${{ matrix.arch.name }}

0 commit comments

Comments
 (0)