Ruby: Cleanup build #509
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| release: | |
| types: [published] | |
| permissions: | |
| actions: read | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| components: clippy | |
| - name: Set up Rust Nightly (for rustfmt) | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| components: rustfmt | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: rust | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Setup | |
| run: make setup | |
| working-directory: rust | |
| - name: Build Rust | |
| run: make build | |
| working-directory: rust | |
| - name: Check Rust formatting | |
| run: make format-check | |
| working-directory: rust | |
| - name: Clippy | |
| run: make lint | |
| working-directory: rust | |
| - name: Run Rust tests | |
| run: make test | |
| working-directory: rust | |
| - name: Vendor C sources for packaging | |
| run: make vendor | |
| working-directory: rust | |
| - name: Test cargo package | |
| run: cargo package --allow-dirty | |
| working-directory: rust | |
| - name: Upload Rust artifacts | |
| if: github.event_name == 'release' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: rust-package | |
| path: rust/ | |
| if-no-files-found: error | |
| retention-days: 1 | |
| publish: | |
| name: Publish to crates.io | |
| if: github.event_name == 'release' && github.repository_owner == 'marcoroth' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Download Rust artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: rust-package | |
| path: rust/ | |
| - name: Set up Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| - name: Authenticate with crates.io | |
| uses: rust-lang/crates-io-auth-action@v1 | |
| id: auth | |
| - name: Publish to crates.io | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} | |
| run: cargo publish --allow-dirty | |
| working-directory: rust |