|
| 1 | +name: Build PDF Runtime |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - 'packages/pdf-runtime/**' |
| 8 | + - '.github/workflows/build-pdf-runtime.yml' |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + - next |
| 13 | + paths: |
| 14 | + - 'packages/pdf-runtime/**' |
| 15 | + - '.github/workflows/build-pdf-runtime.yml' |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + linux: |
| 22 | + name: Linux x64 + musl + WASM |
| 23 | + runs-on: ubuntu-24.04 |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + target: [linux-x64, linuxmusl-x64, wasm32] |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v6 |
| 30 | + - uses: pnpm/action-setup@v4 |
| 31 | + with: |
| 32 | + version: 10.4.0 |
| 33 | + - uses: actions/setup-node@v6 |
| 34 | + with: |
| 35 | + node-version: 22 |
| 36 | + cache: pnpm |
| 37 | + - if: ${{ !contains(matrix.target, 'linuxmusl') }} |
| 38 | + run: pnpm install --frozen-lockfile |
| 39 | + - if: ${{ !contains(matrix.target, 'linuxmusl') }} |
| 40 | + name: Install build tools |
| 41 | + run: sudo apt-get update && sudo apt-get install -y cmake clang |
| 42 | + - if: ${{ !contains(matrix.target, 'linuxmusl') }} |
| 43 | + name: Build target |
| 44 | + run: pnpm --filter @embedpdf/pdf-runtime build:target -- ${{ matrix.target }} |
| 45 | + - if: ${{ contains(matrix.target, 'linuxmusl') }} |
| 46 | + name: Build musl target in Alpine |
| 47 | + run: | |
| 48 | + docker run --rm \ |
| 49 | + -v "$GITHUB_WORKSPACE:/workspace" \ |
| 50 | + -w /workspace \ |
| 51 | + node:22-alpine \ |
| 52 | + sh -lc "apk add --no-cache bash cmake clang g++ make python3 curl tar git && corepack enable && pnpm install --frozen-lockfile && pnpm --filter @embedpdf/pdf-runtime build:target -- ${{ matrix.target }}" |
| 53 | + - uses: actions/upload-artifact@v6 |
| 54 | + with: |
| 55 | + name: pdf-runtime-${{ matrix.target }} |
| 56 | + path: packages/pdf-runtime/npm/${{ matrix.target }}/ |
| 57 | + |
| 58 | + linux-arm: |
| 59 | + name: Linux arm64 + musl |
| 60 | + runs-on: ubuntu-24.04-arm |
| 61 | + strategy: |
| 62 | + fail-fast: false |
| 63 | + matrix: |
| 64 | + target: [linux-arm64, linuxmusl-arm64] |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v6 |
| 67 | + - uses: pnpm/action-setup@v4 |
| 68 | + with: |
| 69 | + version: 10.4.0 |
| 70 | + - uses: actions/setup-node@v6 |
| 71 | + with: |
| 72 | + node-version: 22 |
| 73 | + cache: pnpm |
| 74 | + - if: ${{ !contains(matrix.target, 'linuxmusl') }} |
| 75 | + run: pnpm install --frozen-lockfile |
| 76 | + - if: ${{ !contains(matrix.target, 'linuxmusl') }} |
| 77 | + name: Install build tools |
| 78 | + run: sudo apt-get update && sudo apt-get install -y cmake clang |
| 79 | + - if: ${{ !contains(matrix.target, 'linuxmusl') }} |
| 80 | + name: Build target |
| 81 | + run: pnpm --filter @embedpdf/pdf-runtime build:target -- ${{ matrix.target }} |
| 82 | + - if: ${{ contains(matrix.target, 'linuxmusl') }} |
| 83 | + name: Build musl target in Alpine |
| 84 | + run: | |
| 85 | + docker run --rm \ |
| 86 | + -v "$GITHUB_WORKSPACE:/workspace" \ |
| 87 | + -w /workspace \ |
| 88 | + node:22-alpine \ |
| 89 | + sh -lc "apk add --no-cache bash cmake clang g++ make python3 curl tar git && corepack enable && pnpm install --frozen-lockfile && pnpm --filter @embedpdf/pdf-runtime build:target -- ${{ matrix.target }}" |
| 90 | + - uses: actions/upload-artifact@v6 |
| 91 | + with: |
| 92 | + name: pdf-runtime-${{ matrix.target }} |
| 93 | + path: packages/pdf-runtime/npm/${{ matrix.target }}/ |
| 94 | + |
| 95 | + mac: |
| 96 | + name: macOS |
| 97 | + runs-on: macos-14 |
| 98 | + strategy: |
| 99 | + fail-fast: false |
| 100 | + matrix: |
| 101 | + target: [darwin-arm64, darwin-x64] |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v6 |
| 104 | + - uses: pnpm/action-setup@v4 |
| 105 | + with: |
| 106 | + version: 10.4.0 |
| 107 | + - uses: actions/setup-node@v6 |
| 108 | + with: |
| 109 | + node-version: 22 |
| 110 | + cache: pnpm |
| 111 | + - run: pnpm install --frozen-lockfile |
| 112 | + - name: Build target |
| 113 | + run: pnpm --filter @embedpdf/pdf-runtime build:target -- ${{ matrix.target }} |
| 114 | + - uses: actions/upload-artifact@v6 |
| 115 | + with: |
| 116 | + name: pdf-runtime-${{ matrix.target }} |
| 117 | + path: packages/pdf-runtime/npm/${{ matrix.target }}/ |
| 118 | + |
| 119 | + win: |
| 120 | + name: Windows |
| 121 | + runs-on: windows-2022 |
| 122 | + strategy: |
| 123 | + fail-fast: false |
| 124 | + matrix: |
| 125 | + target: [win32-x64, win32-arm64] |
| 126 | + steps: |
| 127 | + - uses: actions/checkout@v6 |
| 128 | + - uses: pnpm/action-setup@v4 |
| 129 | + with: |
| 130 | + version: 10.4.0 |
| 131 | + - uses: actions/setup-node@v6 |
| 132 | + with: |
| 133 | + node-version: 22 |
| 134 | + cache: pnpm |
| 135 | + - run: pnpm install --frozen-lockfile |
| 136 | + - name: Build target |
| 137 | + shell: bash |
| 138 | + run: pnpm --filter @embedpdf/pdf-runtime build:target -- ${{ matrix.target }} |
| 139 | + - uses: actions/upload-artifact@v6 |
| 140 | + with: |
| 141 | + name: pdf-runtime-${{ matrix.target }} |
| 142 | + path: packages/pdf-runtime/npm/${{ matrix.target }}/ |
0 commit comments