add Graphix cloudbuild workflow (#99) #148
This file contains 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 pipeline | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: full | |
REGISTRY: ghcr.io | |
jobs: | |
lint: | |
name: Lint and test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo check --all-targets --all-features | |
- run: cargo test --verbose -- --nocapture | |
docker-build-and-push: | |
name: Docker build | |
runs-on: ubuntu-latest | |
needs: lint | |
permissions: | |
contents: read | |
packages: write | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Graphix backend Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ghcr.io/${{ github.repository_owner }}/graphix:latest |