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 Native test | |
| on: | |
| push: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }} | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-slim | |
| timeout-minutes: 5 | |
| outputs: | |
| package_name: ${{ steps.determine.outputs.name }} | |
| package_dir: ${{ steps.determine.outputs.dir }} | |
| steps: | |
| - name: Determine package | |
| id: determine | |
| run: | | |
| ref="${{ github.ref }}" | |
| echo "name=appmap" >> $GITHUB_OUTPUT | |
| echo "dir=packages/cli" >> $GITHUB_OUTPUT | |
| # --- JOB 1: SYNC THE BUILDER IMAGE --- | |
| sync-builder: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image_tag: ${{ steps.calc_sha.outputs.sha }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Calculate Dockerfile SHA | |
| id: calc_sha | |
| run: echo "sha=$(sha256sum ci/Dockerfile.build | cut -d' ' -f1)" >> $GITHUB_OUTPUT | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check if image exists | |
| id: check | |
| # Returns 0 (success) if found, 1 (fail) if not | |
| continue-on-error: true | |
| run: docker pull ghcr.io/${{ github.repository }}/rhel8-builder:${{ steps.calc_sha.outputs.sha }} | |
| - uses: docker/setup-qemu-action@v3 | |
| if: steps.check.outcome == 'failure' | |
| - uses: docker/setup-buildx-action@v3 | |
| if: steps.check.outcome == 'failure' | |
| - name: Build and Push | |
| if: steps.check.outcome == 'failure' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./ci/Dockerfile.build | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ghcr.io/${{ github.repository }}/rhel8-builder:${{ steps.calc_sha.outputs.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| linux-x64: | |
| needs: [setup, sync-builder] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: read | |
| timeout-minutes: 30 | |
| container: | |
| image: ghcr.io/${{ github.repository }}/rhel8-builder:${{ needs.sync-builder.outputs.image_tag }} | |
| credentials: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| PUPPETEER_SKIP_DOWNLOAD: 1 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Prepare yarn | |
| run: corepack prepare --activate | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: yarn | |
| - name: Build | |
| run: | | |
| yarn install --immutable | |
| yarn build | |
| cd ${{ needs.setup.outputs.package_dir }} | |
| yarn build-native linux x64 | |
| - name: Publish artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ needs.setup.outputs.package_name }}-linux-x64 | |
| path: ${{ needs.setup.outputs.package_dir }}/release/${{ needs.setup.outputs.package_name }}-linux-x64 |