From 2758fdf7e84cbf11cb19365296c90ee594cb66ca Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Thu, 21 Nov 2024 17:11:18 -0500 Subject: [PATCH] All release workflow. --- .github/workflows/release.yml | 62 +++++++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 7 ++-- rust-toolchain.toml | 4 +++ 3 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..58f4cad --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Release +on: + push: + branches: [ "release-test" ] + tags: [ '[0-9]+.[0-9]+*' ] + +jobs: + build: + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + - macos-latest + include: + - os: windows-latest + extension: .exe + runs-on: ${{ matrix.os }} + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Build release binary + run: cargo build --release --locked + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }} + path: target/release/pbls${{ matrix.extension }} + if-no-files-found: error + + publish: + needs: [build] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Create Release + env: + GH_TOKEN: ${{ github.token }} + run: | + mkdir artifacts/archives + + cd artifacts/ubuntu-latest + tar cJvf "../archives/pbls-$GITHUB_REF_NAME-linux.tar.xz" pbls + + cd ../macos-latest + tar cJvf "../archives/pbls-$GITHUB_REF_NAME-macos.tar.xz" pbls + + cd ../windows-latest + zip "../archives/pbls-$GITHUB_REF_NAME-windows.zip" pbls.exe + + gh release create "$GITHUB_REF_NAME" --notes-from-tag ../archives/* diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d94b948..f74fd19 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,14 +11,15 @@ env: jobs: build: - runs-on: ubuntu-latest env: RUST_LOG: pbls=trace + RUST_BACKTRACE: 1 steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - name: Build run: cargo build --verbose - name: Install protoc @@ -26,5 +27,5 @@ jobs: curl https://github.com/protocolbuffers/protobuf/releases/download/v28.2/protoc-28.2-linux-x86_64.zip -Lo /tmp/protoc.zip unzip /tmp/protoc.zip bin/protoc --version - - name: Run tests + - name: Test run: PATH="$PATH:bin/" cargo test --verbose diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..65db3e3 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = ["rustfmt", "rust-src", "clippy"] +