Repository navigation
ci: adopt example-plugin workflow standard (ARM64 + Windows testing/releases) #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||||||
| name: CI | ||||||||||
|
|
||||||||||
| on: | ||||||||||
| pull_request: | ||||||||||
| push: | ||||||||||
| branches: | ||||||||||
| - main | ||||||||||
|
|
||||||||||
| concurrency: | ||||||||||
| group: ci-${{ github.workflow }}-${{ github.ref }} | ||||||||||
| cancel-in-progress: true | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| rust: | ||||||||||
| name: Rust (${{ matrix.os }}) | ||||||||||
| runs-on: ${{ matrix.os }} | ||||||||||
| strategy: | ||||||||||
| fail-fast: false | ||||||||||
| matrix: | ||||||||||
| os: | ||||||||||
| - ubuntu-latest | ||||||||||
| - ubuntu-24.04-arm | ||||||||||
| - macos-15 | ||||||||||
| - windows-latest | ||||||||||
| - windows-11-arm | ||||||||||
| steps: | ||||||||||
| - name: Checkout | ||||||||||
| uses: actions/checkout@v4 | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disable checkout credential persistence.
Proposed change
Based on learnings, jobs that execute third-party build steps without needing repository writes should disable checkout credential persistence. Committable suggestion
|
||||||||||
|
|
||||||||||
| - name: Install Rust | ||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||
| with: | ||||||||||
| components: clippy, rustfmt | ||||||||||
|
|
||||||||||
| - name: Cache Rust | ||||||||||
| uses: Swatinem/rust-cache@v2 | ||||||||||
|
|
||||||||||
| - name: Check formatting | ||||||||||
| run: cargo fmt --all -- --check | ||||||||||
|
|
||||||||||
| - name: Clippy | ||||||||||
| run: cargo clippy --all-targets --locked -- -D warnings | ||||||||||
|
|
||||||||||
| - name: Test | ||||||||||
| run: cargo test --locked | ||||||||||
|
|
||||||||||
| - name: Build | ||||||||||
| run: cargo build --locked | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Existing release tag, for example v0.1.0" | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restrict repository write permission to Workflow-level Based on learnings: CI/CD jobs must use the minimum required token scopes.
|
||
|
|
||
| jobs: | ||
| build: | ||
| name: Build ${{ matrix.name }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - name: linux-x86_64 | ||
| os: ubuntu-latest | ||
| binary: mesh-pdf-plugin | ||
| target: x86_64-unknown-linux-gnu | ||
| archive_ext: tar.gz | ||
| package: tar | ||
| - name: linux-aarch64 | ||
| os: ubuntu-24.04-arm | ||
| binary: mesh-pdf-plugin | ||
| target: aarch64-unknown-linux-gnu | ||
| archive_ext: tar.gz | ||
| package: tar | ||
| - name: macos-aarch64 | ||
| os: macos-15 | ||
| binary: mesh-pdf-plugin | ||
| target: aarch64-apple-darwin | ||
| archive_ext: tar.gz | ||
| package: tar | ||
| - name: windows-x86_64 | ||
| os: windows-latest | ||
| binary: mesh-pdf-plugin.exe | ||
| target: x86_64-pc-windows-msvc | ||
| archive_ext: zip | ||
| package: zip | ||
| - name: windows-aarch64 | ||
| os: windows-11-arm | ||
| binary: mesh-pdf-plugin.exe | ||
| target: aarch64-pc-windows-msvc | ||
| archive_ext: zip | ||
| package: zip | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.version) || github.ref }} | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Cache Rust | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Build release binary | ||
| run: cargo build --release --locked | ||
|
|
||
| - name: Test release binary | ||
| run: cargo test --release --locked | ||
|
|
||
| - name: Package Unix archive | ||
| if: matrix.package == 'tar' | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| version="${{ github.event.inputs.version || github.ref_name }}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pass the selected version through an environment variable. A valid tag such as Set the selected version through step-level Also applies to: 94-94
|
||
| version="${version#v}" | ||
| stable_archive="pdf-${{ matrix.target }}.${{ matrix.archive_ext }}" | ||
| versioned_archive="pdf-${version}-${{ matrix.target }}.${{ matrix.archive_ext }}" | ||
| mkdir -p dist/pdf | ||
| cp "target/release/${{ matrix.binary }}" dist/pdf/pdf | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Package the native Tika library with each release binary. The Unix packaging step copies only the executable and metadata. The binary loads
|
||
| cp plugin.toml dist/pdf/plugin.toml | ||
| cp README.md dist/pdf/README.md | ||
| tar -czf "$stable_archive" -C dist pdf | ||
| cp "$stable_archive" "$versioned_archive" | ||
|
|
||
| - name: Package Windows archive | ||
| if: matrix.package == 'zip' | ||
| shell: pwsh | ||
| run: | | ||
| $version = "${{ github.event.inputs.version || github.ref_name }}".TrimStart("v") | ||
| $stableArchive = "pdf-${{ matrix.target }}.${{ matrix.archive_ext }}" | ||
| $versionedArchive = "pdf-$version-${{ matrix.target }}.${{ matrix.archive_ext }}" | ||
| New-Item -ItemType Directory -Force -Path dist/pdf | Out-Null | ||
| Copy-Item "target/release/${{ matrix.binary }}" "dist/pdf/pdf.exe" | ||
| Copy-Item plugin.toml "dist/pdf/plugin.toml" | ||
| Copy-Item README.md "dist/pdf/README.md" | ||
| Compress-Archive -Path "dist/pdf" -DestinationPath $stableArchive | ||
| Copy-Item $stableArchive $versionedArchive | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: pdf-${{ matrix.target }} | ||
| path: | | ||
| pdf-*.tar.gz | ||
| pdf-*.zip | ||
| if-no-files-found: error | ||
|
|
||
| publish: | ||
| name: Publish GitHub release | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts | ||
| merge-multiple: true | ||
|
|
||
| - name: Publish release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ github.event.inputs.version || github.ref_name }} | ||
| name: ${{ github.event.inputs.version || github.ref_name }} | ||
| files: artifacts/* | ||
| fail_on_unmatched_files: true | ||
| overwrite_files: true | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
windows-11-armfrom the matrix until the Windows ARM64 native build is supported.extractous 0.3.0builds Tika with GraalVM in its build script. On Windows, its GraalVM installer accepts onlyx86_64and panics for any other architecture (build.rslines 296-302). On a coldwindows-11-armbuild, the script reaches that branch unless the runner image already provides a GraalVM JDK atJAVA_HOME. The workflow sets noGRAALVM_HOMEorJAVA_HOME. Cargo runs this build script duringclippy,test, andbuild, so the job fails before its checks run.Suggested fix
Re-add the entry after the build supports Windows ARM64. That change needs a GraalVM JDK for Windows ARM64, provided through
GRAALVM_HOME, and confirmation that theextractousnative build supports that target.Committable suggestion
zizmor (1.31.1)
[warning] 14-49: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)