Merge branch 'main' into wfs #92
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: CI | |
| on: | |
| push: | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| frontend-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - run: nix develop --command bash -c 'cd frontend && npm ci && npm run gen && npm run lint' | |
| go-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Gen | |
| run: nix develop --command make gen | |
| - name: Lint | |
| run: nix develop --command make lint | |
| go-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Gen | |
| run: nix develop --command make gen | |
| - name: Test | |
| run: nix develop --command make test | |
| nix-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build x86_64 binary | |
| run: nix build .#packages.x86_64-linux.cartomancer | |
| - name: Build aarch64 binary (cross) | |
| run: nix build .#packages.aarch64-linux.cartomancer | |
| - name: Build x86_64 Docker image | |
| run: nix build .#packages.x86_64-linux.dockerImage -o image-x86_64.tar.gz | |
| - name: Build aarch64 Docker image (cross) | |
| run: nix build .#packages.aarch64-linux.dockerImage -o image-aarch64.tar.gz | |
| - name: Upload Docker images | |
| if: github.event_name == 'push' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-images | |
| path: | | |
| image-x86_64.tar.gz | |
| image-aarch64.tar.gz | |
| retention-days: 1 | |
| docker-push: | |
| if: github.event_name == 'push' | |
| needs: nix-build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-images | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Compute image tag | |
| id: tag | |
| run: echo "value=$(echo '${{ github.ref_name }}' | tr '/' '_')" >> "$GITHUB_OUTPUT" | |
| - name: Push per-arch images and multi-arch manifest | |
| env: | |
| TAG: ${{ steps.tag.outputs.value }} | |
| run: | | |
| set -euo pipefail | |
| repo="ghcr.io/jo-m/cartomancer" | |
| x86_64_src=$(docker load < image-x86_64.tar.gz | sed -n 's/^Loaded image: //p') | |
| docker tag "$x86_64_src" "$repo:${TAG}-x86_64" | |
| docker push "$repo:${TAG}-x86_64" | |
| aarch64_src=$(docker load < image-aarch64.tar.gz | sed -n 's/^Loaded image: //p') | |
| docker tag "$aarch64_src" "$repo:${TAG}-aarch64" | |
| docker push "$repo:${TAG}-aarch64" | |
| docker buildx imagetools create -t "$repo:$TAG" \ | |
| "$repo:${TAG}-x86_64" \ | |
| "$repo:${TAG}-aarch64" |