From 082f592c07238fa9a8a73acc670c6c6afe96c77e Mon Sep 17 00:00:00 2001 From: fjebaker Date: Sun, 29 Sep 2024 21:24:23 +0100 Subject: [PATCH] ci: added test and release ci --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 26 +++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ad138d7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release +on: + push: + tags: + - '**' + workflow_dispatch: + +jobs: + bundle: + strategy: + matrix: + target: [x86_64-linux-musl, aarch64-linux-musl, x86_64-macos-none, aarch64-macos-none] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup zig + uses: mlugg/setup-zig@v1 + with: + version: master + - name: Hail mary + run: zig build test + - name: Build + run: | + zig build --release=safe -Dtarget=${{matrix.target}} + mv zig-out/bin/nkt ./ + tar -czf nkt-${{matrix.target}}.tar.gz nkt + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: nkt-${{matrix.target}} + path: nkt-${{matrix.target}}.tar.gz + if-no-files-found: error + release: + needs: bundle + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + - name: Unpack and locate + run: | + find . -name "*.tar.gz" -type f -exec mv {} ./ \; + ls -la * + - name: Name release + id: name + run: echo "name=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + - name: Upload release + uses: softprops/action-gh-release@v2 + with: + files: ./nkt-*.tar.gz + name: ${{ steps.name.outputs.name }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..732eeb3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: Test + +on: + pull_request: + branches: + - main + push: + branches: + - main + - ci + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup zig + uses: mlugg/setup-zig@v1 + with: + version: master + + - name: Build and test + run: zig build test +