From 1e0baf9040d044417570da1efd5281b308f818ad Mon Sep 17 00:00:00 2001 From: Art <4998038+Alorel@users.noreply.github.com> Date: Fri, 26 Jul 2024 19:32:32 +0100 Subject: [PATCH] ci: Move releases to dedicated branch --- .github/workflows/_test.yml | 76 ++++++++++++++++++++ .github/workflows/core.yml | 129 ---------------------------------- .github/workflows/release.yml | 68 ++++++++++++++++++ .github/workflows/test.yml | 32 +++++++++ 4 files changed, 176 insertions(+), 129 deletions(-) create mode 100644 .github/workflows/_test.yml delete mode 100644 .github/workflows/core.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml new file mode 100644 index 0000000..6015cba --- /dev/null +++ b/.github/workflows/_test.yml @@ -0,0 +1,76 @@ +name: Test +on: + workflow_call: {} + +permissions: + contents: read + +env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: --deny warnings + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Init toolchain + uses: alorel-actions/cargo/init@v1 + id: toolchain + with: + components: rustfmt,clippy + cache-prefix: lint + local: true + + - name: Fmt + run: cargo fmt --check + + - name: Clippy + run: cargo clippy --workspace --tests + + - name: Doc + run: cargo doc --workspace --no-deps + + - name: cargo-rdme + uses: alorel-actions/cargo/rdme@v1 + with: + no-fail-on-warnings: true + + test: + name: Test on ${{matrix.toolchain}} + runs-on: ubuntu-latest + strategy: + matrix: + toolchain: + - nightly-2024-07-25 + - stable + - 1.70.0 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Init toolchain + uses: alorel-actions/cargo/init@v1 + with: + toolchain: ${{matrix.toolchain}} + cache-prefix: test + local: true + + - name: Install wasm-pack + uses: alorel-actions/cargo-global-dep@v1 + with: + name: wasm-pack + version: 0.12.1 + + - name: Test (no features) + run: wasm-pack test --headless --firefox --chrome --locked --no-default-features + + - name: Test (default features) + run: wasm-pack test --headless --firefox --chrome --locked + + - name: Test (nightly) + run: wasm-pack test --headless --firefox --chrome --locked --all-features + if: ${{startsWith(matrix.toolchain, 'nightly')}} diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml deleted file mode 100644 index 5d954d0..0000000 --- a/.github/workflows/core.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: Core -on: - push: - branches: [master] - pull_request: {} - -permissions: - contents: read - -env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: --deny warnings - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Init toolchain - uses: alorel-actions/cargo/init@v1 - with: - components: rustfmt,clippy - cache-prefix: lint - local: true - - - name: Fmt - run: cargo fmt --check - - - name: Clippy - run: cargo clippy --locked --tests - - - name: Doc - run: cargo doc --locked --no-deps && rm -rf target/doc - - - name: cargo-rdme - uses: alorel-actions/cargo/rdme@v1 - with: - intralinks-strip-links: true - - test: - name: Test on ${{matrix.toolchain}} - runs-on: ubuntu-latest - strategy: - matrix: - toolchain: - - nightly-2023-10-28 - - stable - - 1.70.0 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Init toolchain - uses: alorel-actions/cargo/init@v1 - with: - toolchain: ${{matrix.toolchain}} - cache-prefix: test - local: true - - - name: Install wasm-pack - uses: alorel-actions/cargo-global-dep@v1 - with: - name: wasm-pack - version: 0.12.1 - - - name: Test (no features) - run: wasm-pack test --headless --firefox --chrome --locked --no-default-features - - - name: Test (default features) - run: wasm-pack test --headless --firefox --chrome --locked - - - name: Test (nightly) - run: wasm-pack test --headless --firefox --chrome --locked --all-features - if: ${{startsWith(matrix.toolchain, 'nightly')}} - - release: - name: Release - runs-on: ubuntu-latest - if: ${{ github.ref == 'refs/heads/master' }} - needs: - - lint - - test - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - name: Checkout - with: - fetch-depth: 0 - fetch-tags: true - token: ${{ secrets.GH_TOKEN }} - - - name: Parse - id: parse - uses: alorel-actions/semantic-release-lite@v0 - with: - stay-at-zero: true - minor-types: | - feat: Features - patch-types: | - fix: Bug Fixes - trivial-types: | - chore: Maintenance - deps: Dependency updates - ci: CI & Build - build: CI & Build - refactor: Refactors - docs: Documentation - perf: Performance - - - name: Prep release - if: ${{ steps.parse.outputs.should-release }} - id: prep - uses: ./.github/actions/prep-release - with: - release-type: ${{ steps.parse.outputs.release-type }} - version: ${{ steps.parse.outputs.next-version }} - - - name: Release - if: ${{ steps.prep.outputs.in-sync }} - uses: ./.github/actions/release - with: - version: ${{ steps.parse.outputs.next-version }} - changelog: ${{ steps.parse.outputs.changelog }} - issues-closed: ${{ steps.parse.outputs.issues-closed }} - crates-io-token: ${{ secrets.CRATES_IO_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1ffd166 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: Release +on: + push: + branches: + - release + +permissions: + contents: read + +env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: --deny warnings + +jobs: + test: + name: Test + uses: .github/workflows/_test.yml + + release: + name: Release + needs: + - test + runs-on: ubuntu-latest + environment: crates-io + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + name: Checkout + with: + fetch-depth: 0 + fetch-tags: true + token: ${{ secrets.GH_TOKEN }} + + - name: Parse + id: parse + uses: alorel-actions/semantic-release-lite@v0 + with: + stay-at-zero: true + minor-types: | + feat: Features + patch-types: | + fix: Bug Fixes + trivial-types: | + chore: Maintenance + deps: Dependency updates + ci: CI & Build + build: CI & Build + refactor: Refactors + docs: Documentation + perf: Performance + + - name: Prep release + if: ${{ steps.parse.outputs.should-release }} + id: prep + uses: ./.github/actions/prep-release + with: + release-type: ${{ steps.parse.outputs.release-type }} + version: ${{ steps.parse.outputs.next-version }} + + - name: Release + if: ${{ steps.prep.outputs.in-sync }} + uses: ./.github/actions/release + with: + version: ${{ steps.parse.outputs.next-version }} + changelog: ${{ steps.parse.outputs.changelog }} + issues-closed: ${{ steps.parse.outputs.issues-closed }} + crates-io-token: ${{ secrets.CRATES_IO_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0a8cc58 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Test +on: + push: + branches: + - master + paths-ignore: + - .github/CODE_OF_CONDUCT.md + - .github/CODEOWNERS + - .github/dependabot.yml + - .github/FUNDING.yml + - LICENSE + - .gitignore + pull_request: + paths-ignore: + - .github/CODE_OF_CONDUCT.md + - .github/CODEOWNERS + - .github/dependabot.yml + - .github/FUNDING.yml + - LICENSE + - .gitignore + +permissions: + contents: read + +env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: --deny warnings + +jobs: + test: + name: Test + uses: .github/workflows/_test.yml