|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main] |
| 5 | + pull_request: |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +permissions: |
| 12 | + actions: write |
| 13 | + contents: read |
| 14 | + |
| 15 | +# Reference quarto-cli version to test against. |
| 16 | +# Full commit hash for reproducibility; comment documents the human-readable version. |
| 17 | +env: |
| 18 | + QUARTO_CLI_REPO: quarto-dev/quarto-cli |
| 19 | + QUARTO_CLI_REV: 97e7649bf14607cf39cda13f013185a4146e047b # v1.9.35 |
| 20 | + |
| 21 | +jobs: |
| 22 | + test: |
| 23 | + name: Julia engine tests (${{ matrix.os }}) |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 32 | + |
| 33 | + - name: Checkout quarto-cli |
| 34 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 35 | + with: |
| 36 | + repository: ${{ env.QUARTO_CLI_REPO }} |
| 37 | + ref: ${{ env.QUARTO_CLI_REV }} |
| 38 | + path: _quarto-cli |
| 39 | + |
| 40 | + - name: Cache typst-gather build |
| 41 | + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 |
| 42 | + with: |
| 43 | + path: _quarto-cli/package/typst-gather/target |
| 44 | + key: ${{ runner.os }}-typst-gather-${{ env.QUARTO_CLI_REV }} |
| 45 | + |
| 46 | + - name: Configure Quarto (Unix) |
| 47 | + if: runner.os != 'Windows' |
| 48 | + working-directory: _quarto-cli |
| 49 | + run: ./configure.sh |
| 50 | + |
| 51 | + - name: Configure Quarto (Windows) |
| 52 | + if: runner.os == 'Windows' |
| 53 | + working-directory: _quarto-cli |
| 54 | + shell: cmd |
| 55 | + run: ./configure.cmd |
| 56 | + |
| 57 | + - name: Add quarto to PATH (Windows) |
| 58 | + if: runner.os == 'Windows' |
| 59 | + shell: pwsh |
| 60 | + run: | |
| 61 | + "$(Get-ChildItem -Path _quarto-cli/package/dist/bin/quarto.cmd | ForEach-Object { $_.FullName } | Split-Path)" >> $env:GITHUB_PATH |
| 62 | +
|
| 63 | + # Rebuild the bundled JS from our TS source using the configured quarto, |
| 64 | + # then verify it matches what's checked in. This catches forgotten rebuilds. |
| 65 | + - name: Verify bundled JS is up to date (Unix) |
| 66 | + if: runner.os != 'Windows' |
| 67 | + run: | |
| 68 | + quarto call build-ts-extension src/julia-engine.ts |
| 69 | + if ! git diff --exit-code _extensions/julia-engine/julia-engine.js; then |
| 70 | + echo "::error::Bundled JS is out of date. Run 'quarto call build-ts-extension src/julia-engine.ts' and commit the result." |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | +
|
| 74 | + - name: Verify bundled JS is up to date (Windows) |
| 75 | + if: runner.os == 'Windows' |
| 76 | + shell: pwsh |
| 77 | + run: | |
| 78 | + quarto call build-ts-extension src/julia-engine.ts |
| 79 | + git diff --exit-code _extensions/julia-engine/julia-engine.js |
| 80 | + if ($LASTEXITCODE -ne 0) { |
| 81 | + Write-Error "Bundled JS is out of date. Run 'quarto call build-ts-extension src/julia-engine.ts' and commit the result." |
| 82 | + exit 1 |
| 83 | + } |
| 84 | +
|
| 85 | + - name: Setup Julia |
| 86 | + uses: julia-actions/setup-julia@5c9647d97b78a5debe5164e9eec09d653d29bd71 # v2.6.1 |
| 87 | + with: |
| 88 | + version: "1.11" |
| 89 | + |
| 90 | + - name: Cache Julia packages |
| 91 | + uses: julia-actions/cache@b6a98a496542b2eeda9b4402ce8f79f8fd753d5e # v3.0.0 |
| 92 | + |
| 93 | + - name: Run tests (Unix) |
| 94 | + if: runner.os != 'Windows' |
| 95 | + run: tests/run-tests.sh |
| 96 | + |
| 97 | + - name: Run tests (Windows) |
| 98 | + if: runner.os == 'Windows' |
| 99 | + shell: pwsh |
| 100 | + run: tests/run-tests.ps1 |
0 commit comments