Install g++ in rust-builder so symbolic-demangle links #22
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: | |
| branches: [master] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [master] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: cargo fmt --check | |
| - run: mkdir -p frontend/dist | |
| - run: cargo clippy -- -D warnings | |
| - run: cargo test | |
| frontend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: bun install --frozen-lockfile | |
| - run: bun run build | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: [backend, frontend] | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| cache-from: type=gha,scope=amd64 | |
| cache-to: type=gha,scope=amd64,mode=max | |
| docker-amd64: | |
| runs-on: ubuntu-latest | |
| needs: [backend, frontend] | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| - uses: docker/build-push-action@v6 | |
| id: build | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true | |
| cache-from: type=gha,scope=amd64 | |
| cache-to: type=gha,scope=amd64,mode=max | |
| - run: echo "${{ steps.build.outputs.digest }}" > /tmp/digest-amd64 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: digest-amd64 | |
| path: /tmp/digest-amd64 | |
| docker-arm64: | |
| runs-on: ubuntu-24.04-arm | |
| needs: [backend, frontend] | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| - uses: docker/build-push-action@v6 | |
| id: build | |
| with: | |
| context: . | |
| platforms: linux/arm64 | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true | |
| cache-from: type=gha,scope=arm64 | |
| cache-to: type=gha,scope=arm64,mode=max | |
| - run: echo "${{ steps.build.outputs.digest }}" > /tmp/digest-arm64 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: digest-arm64 | |
| path: /tmp/digest-arm64 | |
| docker-manifest: | |
| runs-on: ubuntu-latest | |
| needs: [docker-amd64, docker-arm64] | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha,prefix=sha-,format=short | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: digest-* | |
| path: /tmp/digests | |
| merge-multiple: true | |
| - run: | | |
| tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< '${{ steps.meta.outputs.json }}') | |
| source_images="" | |
| for f in /tmp/digests/*; do | |
| source_images="$source_images ghcr.io/${{ github.repository }}@$(cat "$f")" | |
| done | |
| docker buildx imagetools create $tags $source_images |