ci: add workspace-test and codegen workflows to match fil-forge repos… #65
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: Container | |
| # Build the ingot daemon image and publish it to GHCR on merges to main. | |
| # Mirrors sprue's dev/prod pattern so smelt can pull a consistent | |
| # ghcr.io/fil-forge/ingot:main (prod) and :main-dev (debug + dlv) pair. | |
| # ingot has no releaser, so this is the PR build-check + publish-on-main | |
| # half of sprue's workflow. | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # Cancel in-progress runs on new pushes to the same ref. | |
| concurrency: | |
| group: container-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| # Publish both prod and dev images on push to main. | |
| # prod -> :main, :sha-<short> | |
| # dev -> :main-dev, :sha-<short>-dev | |
| publish-main: | |
| name: Publish ${{ matrix.target }} | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| include: | |
| - target: prod | |
| suffix: "" | |
| - target: dev | |
| suffix: "-dev" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=main${{ matrix.suffix }} | |
| type=sha,suffix=${{ matrix.suffix }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: ${{ matrix.target }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha,scope=${{ matrix.target }} | |
| cache-to: type=gha,scope=${{ matrix.target }},mode=max | |
| # PR build check (no push) - both targets, single platform for speed. | |
| build-check: | |
| name: Build Check (${{ matrix.target }}) | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| target: [dev, prod] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build ${{ matrix.target }} | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: ${{ matrix.target }} | |
| platforms: linux/amd64 | |
| push: false | |
| cache-from: type=gha,scope=${{ matrix.target }} |