diff --git a/.github/workflows/channel.yml b/.github/workflows/channel.yml index 0f6b661..594727c 100644 --- a/.github/workflows/channel.yml +++ b/.github/workflows/channel.yml @@ -1,7 +1,8 @@ name: Channel # Moves a channel branch forward and builds a draft from it, nothing is published: -# next: next takes over main (main must have a green ci-ok); draft prerelease vX.Y.Z-rc.N. +# next: next takes over main (main must have a green ci-ok; a CI still running on main is +# waited for); draft prerelease vX.Y.Z-rc.N. # If the version on main is already released, next gets the next patch number in # every version file and [Unreleased] in CHANGELOG.md becomes its section # (.github/release/bump_version.py). main itself catches up after the release @@ -53,14 +54,19 @@ jobs: fetch-depth: 0 - name: Is main green? if: inputs.channel != 'release' + timeout-minutes: 90 run: | + # right after a merge the CI of main is still running: wait for it instead of failing sha=$(git rev-parse origin/main) - ok=$(gh api "repos/$GITHUB_REPOSITORY/commits/$sha/check-runs?check_name=ci-ok" \ - --jq '[.check_runs[] | select(.conclusion == "success")] | length') - if [ "$ok" = 0 ]; then - echo "::error::main ($sha) has no green ci-ok (still running? wait for the CI of the last merge)" - exit 1 - fi + while :; do + runs=$(gh api "repos/$GITHUB_REPOSITORY/commits/$sha/check-runs?check_name=ci-ok" \ + --jq '[.check_runs[] | .conclusion // "running"] | join(" ")') + case " $runs " in + *" success "*) echo "main ($sha): ci-ok is green"; break ;; + *" running "*|" ") echo "main ($sha): waiting for ci-ok (${runs:-not started})"; sleep 30 ;; + *) echo "::error::main ($sha) has no green ci-ok: $runs"; exit 1 ;; + esac + done - name: Put the branch together run: | git config user.name "github-actions[bot]" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a88e9fe..b0a9e2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,10 @@ name: CI # Every pull request needs an entry under [Unreleased] in CHANGELOG.md. -# Pull requests and pushes to main run only what the change needs: Lint always, the tests -# when code changes, the packages when a pull request changes the packaging. +# Pull requests and pushes to main run on Linux only and only what the change needs: Lint +# always, the tests when code changes. The macOS and Windows runners (shared by every repository +# of the account) are kept for releases: packages.yml builds there and runs the tests of those +# systems first. A pull request that changes the packaging can be built by hand (Packages). # `ci-ok` sums up the run; it is the one check main requires. Releases are built by the # channel workflows (main → next, next → release), started by hand. on: @@ -28,7 +30,6 @@ jobs: pull-requests: read outputs: code: ${{ steps.files.outputs.code }} - packaging: ${{ steps.files.outputs.packaging }} steps: - id: files env: @@ -37,7 +38,6 @@ jobs: PR: ${{ github.event.pull_request.number }} BEFORE: ${{ github.event.before }} CODE: '^(src/|src-tauri/|crates/|locales/|scripts/|index\.html$|package(-lock)?\.json$|Cargo\.(toml|lock)$|biome\.json$|tsconfig\.json$|vite\.config\.ts$|rustfmt\.toml$|\.github/workflows/ci\.yml$)' - PACKAGING: '^(src-tauri/tauri\.conf\.json$|src-tauri/icons/|packaging/|\.github/workflows/packages\.yml$)' run: | case "$EVENT" in pull_request) @@ -53,17 +53,11 @@ jobs: esac printf '%s\n' "$files" code=false - packaging=false if [ "$files" = ALL ] || grep -qE "$CODE" <<< "$files"; then code=true fi - # packages only for pull requests: main gets its packages through the channels - if [ "$EVENT" = pull_request ] && grep -qE "$PACKAGING" <<< "$files"; then - packaging=true - fi echo "code=$code" >> "$GITHUB_OUTPUT" - echo "packaging=$packaging" >> "$GITHUB_OUTPUT" - echo "::notice::Tests: $code, packages: $packaging" + echo "::notice::Tests: $code" changelog: name: Changelog entry @@ -115,7 +109,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, windows-latest, macos-15] + # Linux only; the other systems test in packages.yml when a release is built + os: [ubuntu-24.04] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v7 @@ -158,16 +153,9 @@ jobs: shell: bash run: git diff --exit-code -- src/ipc/bindings - packages: - name: Packages - needs: changes - if: needs.changes.outputs.packaging == 'true' - uses: ./.github/workflows/packages.yml - secrets: inherit - ci-ok: name: ci-ok - needs: [changes, changelog, lint, tests, packages] + needs: [changes, changelog, lint, tests] if: always() runs-on: ubuntu-24.04 steps: diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index f84fa7e..f9e2ff4 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -1,7 +1,8 @@ name: Packages -# Builds every package once. Called by the CI when a pull request changes the packaging, by -# the channel workflow for a release candidate or a release, and by hand. Every job uploads its +# Builds every package once. Called by the channel workflow for a release candidate or a +# release, and by hand. Pull requests test on Linux only, so the Windows and macOS jobs run the +# tests of their system before they build. Every job uploads its # files as an artifact whose name starts with "pkg-"; the channel workflow puts all files of # those artifacts into the draft. The file names match .github/release/downloads.md. on: @@ -152,6 +153,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + components: clippy - uses: Swatinem/rust-cache@v2 with: @@ -160,6 +162,16 @@ jobs: - name: Install frontend dependencies run: npm ci + # the CI tests pull requests and main on Linux only; the other systems test here + - name: Tests (${{ runner.os }}) + if: matrix.name != 'linux' + shell: bash + run: | + npm test + npm run build + cargo clippy --workspace --all-targets -- -D warnings + cargo test --workspace + # Developer ID signing and notarization by Tauri itself. Without the secrets (a pull request # from a fork) the disk image is signed ad hoc; a release or release candidate fails instead. - name: Apple signing diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a584e..2180c91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The first release of PsyAudio: a bit-perfect CD ripper, a converter and a batch - Tag processing numbers tracks by itself (per folder, in list order), can take other tags into a value (``, `` …) and offers only combinations that make sense. - Converted files always get an album artist: the artist when the whole album has one, "Various Artists" for a compilation. - "Delete source file" moves the source to the recycle bin. +- Pull requests and main are tested on Linux only; Windows and macOS run their tests when a release is built. A release started right after a merge waits for the CI of main instead of failing. - A release can be built straight from main, without a release candidate: the new “main → release” workflow raises the version the same way and creates the draft. - The README opens with the PsyAudio wordmark, white on GitHub's dark theme and black on the light one. - The README shows what PsyAudio does on Windows, Linux and macOS in one table, lists the downloads, and keeps the developer notes in fold-out sections. diff --git a/README.md b/README.md index a914a91..dd2cb3c 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,7 @@ Core (`crates/core/src/`): - Colours come from the Catppuccin tokens in `src/styles/tokens.css` (Mocha and Latte, accent Mauve); a test checks text contrast. - Every option in a side column gets a one-line hint; units sit inside the value field ("192 kbit/s"). - Every pull request adds an entry under `[Unreleased]` in the [changelog](CHANGELOG.md); the CI checks it. +- The CI runs pull requests and main on Linux only. Windows and macOS run their tests when a release candidate or release is built, before the packages; a pull request that changes the packaging can be built by hand with the Packages workflow.