Merge pull request #90 from AstraBert/feat/improve-image-conversion #19
Workflow file for this run
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: CI - Rust | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "core@**" | |
| paths: | |
| - "crates/**" | |
| - ".github/workflows/ci.yml" | |
| pull_request: | |
| paths: | |
| - "crates/**" | |
| - ".github/workflows/ci.yml" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Jake (also sets up Rust) | |
| uses: AstraBert/setup-jake@v0.1.0 | |
| - name: Install Clippy | |
| run: rustup component add clippy | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run clippy | |
| run: jake clippy | |
| format: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Jake (also sets up Rust) | |
| uses: AstraBert/setup-jake@v0.1.0 | |
| - name: Install Clippy | |
| run: rustup component add rustfmt | |
| - name: Check formatting | |
| run: jake format | |
| test: | |
| name: Test on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Jake (also sets up Rust) | |
| uses: AstraBert/setup-jake@v0.1.0 | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Run tests (no rayon) | |
| run: jake test | |
| - name: Run tests (with rayon) | |
| run: jake test-rayon | |
| - name: Run tests (markup only) | |
| run: jake test-markup | |
| - name: Run tests (image only) | |
| run: jake test-image | |
| - name: Run tests (office only) | |
| run: jake test-office | |
| test-windows: | |
| name: Test on windows-latest | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ runner.os == 'Windows' && '~\\.cargo\\registry' || '~/.cargo/registry' }} | |
| ${{ runner.os == 'Windows' && '~\\.cargo\\git' || '~/.cargo/git' }} | |
| target | |
| key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Run tests (no rayon) | |
| run: cargo test --release -p 'pdfitdown' | |
| - name: Run tests (with rayon) | |
| run: cargo test --release --features rayon -p 'pdfitdown' | |
| - name: Run tests (markup only) | |
| run: cargo test --no-default-features --features markup --release -p 'pdfitdown' | |
| - name: Run tests (image only) | |
| run: cargo test --no-default-features --features image --release -p 'pdfitdown' | |
| - name: Run tests (office only) | |
| run: cargo test --no-default-features --features office --release -p 'pdfitdown' | |
| publish: | |
| name: Publish - Rust Core | |
| runs-on: ubuntu-latest | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| needs: | |
| - clippy | |
| - format | |
| - test | |
| - test-windows | |
| permissions: | |
| contents: write # to be able to publish a GitHub release | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Login to cargo | |
| run: cargo login <<< $CARGO_API_TOKEN | |
| env: | |
| CARGO_API_TOKEN: ${{ secrets.CARGO_API_TOKEN }} | |
| - name: Publish to crates | |
| run: cargo publish -p "pdfitdown" | |
| env: | |
| CARGO_API_TOKEN: ${{ secrets.CARGO_API_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| generateReleaseNotes: true |