From d0353ebe21a14339964f1f1d17fade10dba8b682 Mon Sep 17 00:00:00 2001 From: bestmike007 Date: Fri, 27 Dec 2024 06:36:06 -0500 Subject: [PATCH] chore: setup CI --- .github/workflows/publish.yaml | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..fbd9afe --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,55 @@ +name: Continuous Integration (CI) +on: [push] + +concurrency: + group: "ci-${{ github.ref_name }}" + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - name: cargo test + run: | + cargo fmt --check + cargo test + release: + needs: [test] + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arch: + - target: x86_64-unknown-linux-gnu + name: amd64 + - target: aarch64-unknown-linux-gnu + name: aarch64 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Rust with Cross + shell: bash + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y + rustup toolchain install stable --profile minimal + rustup target add ${{ matrix.arch.target }} + curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash + cargo binstall --no-confirm cross + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.arch.target }} + cache-on-failure: true + - name: Build Binary + run: | + cross build --verbose --locked --release --target ${{ matrix.arch.target }} + mv target/${{ matrix.arch.target }}/release/wg-multizone target/${{ matrix.arch.target }}/release/wg-multizone-${{ matrix.arch.name }} + - name: publish artifacts + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + with: + files: | + target/${{ matrix.arch.target }}/release/wg-multizone-${{ matrix.arch.name }}