feat: Add Linux runners for all supported architectures #55
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: Build and Test | |
| on: push | |
| permissions: read-all | |
| # update in build.yml and codeql.yml at same time | |
| env: | |
| PROTOC_VERSION: "32.0" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| PROTOC: protoc-release/bin/protoc | |
| PROTOC_INC: protoc-release/include | |
| PROTOC_PLATFORM: linux-x86_64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| node-version: 20 | |
| cache: ${{ !env.ACT && 'npm' || '' }} # cache API not available in ACT | |
| - name: Install Protoc | |
| run: | | |
| echo "Fetching protoc" | |
| curl --header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
| -L https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${PROTOC_PLATFORM}.zip \ | |
| --output protoc-release.zip | |
| unzip protoc-release.zip -d protoc-release | |
| rm protoc-release.zip | |
| - run: npm ci | |
| - run: npm test | |
| - run: npm run build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: js | |
| path: | | |
| google-protobuf.js | |
| package: | |
| needs: build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # to ensure backwards compatibility as long as possible, use earliest versions of OSs available on Github Actions | |
| - os: ubuntu-22.04 | |
| cpu: x86_64 | |
| bazel_target: dist_zip | |
| - os: ubuntu-22.04 | |
| cpu: aarch64 | |
| bazel_target: dist_zip | |
| arch: aarch64 | |
| - os: ubuntu-22.04 | |
| cpu: ppc64le | |
| bazel_target: dist_zip | |
| arch: ppc64le | |
| - os: ubuntu-22.04 | |
| cpu: s390x | |
| bazel_target: dist_zip | |
| arch: s390x | |
| - os: windows-2022 | |
| cpu: x64_windows | |
| bazel_target: dist_zip | |
| - os: windows-2022 | |
| cpu: x64_x86_windows | |
| bazel_target: dist_zip | |
| - os: macos-14 | |
| cpu: darwin_arm64 | |
| bazel_target: dist_zip | |
| - os: macos-13 | |
| cpu: darwin_x86_64 | |
| bazel_target: dist_zip | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| if: ${{ !env.ACT }} | |
| with: | |
| name: js | |
| - uses: bazel-contrib/setup-bazel@0.15.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - run: mkdir out | |
| - name: Build on emulated arch | |
| uses: uraimo/run-on-arch-action@v3 | |
| if: matrix.arch | |
| with: | |
| arch: ${{ matrix.arch }} | |
| distro: ubuntu22.04 | |
| githubToken: ${{ secrets.GITHUB_TOKEN }} | |
| install: | | |
| apt-get update -y | |
| apt-get install -y bazel | |
| run: | | |
| bazel build --cpu=${{ matrix.cpu }} ${{ matrix.bazel_target || 'dist_all' }} | |
| # need to copy to output directory as `bazel-bin` is a symlink and cannot be read by the actions/upload-artifact action | |
| cp bazel-bin/protobuf-javascript-* out/ | |
| - name: Build on native arch | |
| if: ${{ !matrix.arch }} | |
| run: | | |
| # setup-bazelisk fails when running in ACT because the cache is not available so we need to ignore to let the bazel step run | |
| bazel build --cpu=${{ matrix.cpu }} ${{ matrix.bazel_target || 'dist_all' }} | |
| # need to copy to output directory as `bazel-bin` is a symlink and cannot be read by the actions/upload-artifact action | |
| cp bazel-bin/protobuf-javascript-* out/ | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-${{ matrix.os }}-${{ matrix.cpu }} | |
| path: out |