From 81a7935540f6781096befa4a1c002ba94323fc03 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Thu, 12 Feb 2026 15:42:29 +0200 Subject: [PATCH] ci: add CI and release workflows ci: fix release workflow with absolute paths ci: simplify release workflow ci: fix release workflow with GITHUB_TOKEN --- .github/workflows/ci.yml | 23 ++++++------ .github/workflows/release.yml | 69 +++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03e1b40..e1f9592 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,14 +6,15 @@ on: branches: [main] env: CARGO_TERM_COLOR: always - RUSTFLAGS: -Dwarnings + RUSTFLAGS: --deny warnings + RUSTDOCFLAGS: --deny warnings jobs: fmt: name: Format runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - uses: dtolnay/rust-toolchain@nightly + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@stable with: components: rustfmt - run: cargo fmt --all --check @@ -21,29 +22,27 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable with: components: clippy - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --all-targets --all-features + - run: cargo clippy --locked --workspace --all-targets --all-features -- -D warnings test: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@nextest - - run: cargo nextest run --all-features - - run: cargo test --doc + - run: cargo nextest run --locked --all-features --all-targets + - run: cargo test --locked --workspace --all-features --doc docs: name: Docs runs-on: ubuntu-latest - env: - RUSTDOCFLAGS: -Dwarnings steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - - run: cargo doc --no-deps --all-features + - run: cargo doc --locked --workspace --all-features --document-private-items --no-deps diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b3475b1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" + workflow_dispatch: + inputs: + tag: + description: "Release tag (e.g., v1.0.0)" + required: true + type: string +env: + CARGO_TERM_COLOR: always +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo build --release --locked + - name: Strip server binary + run: strip target/release/server + - name: Strip runner binary + run: strip target/release/runner + - uses: actions/upload-artifact@v6 + with: + name: server + path: target/release/server + - uses: actions/upload-artifact@v6 + with: + name: runner + path: target/release/runner + release: + name: Create Release + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + - uses: actions/download-artifact@v6 + with: + path: artifacts + merge-multiple: true + - name: Debug artifacts + run: | + echo "=== Contents of artifacts/ ===" + ls -la artifacts/ + echo "=== Recursive listing ===" + find artifacts/ -type f + - name: Get version + id: version + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "version=${{ inputs.tag }}" >> $GITHUB_OUTPUT + else + echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + fi + - uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.version.outputs.version }} + name: Release ${{ steps.version.outputs.version }} + files: | + artifacts/* + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}