Skip to content

build: update dependencies #225

build: update dependencies

build: update dependencies #225

Workflow file for this run

name: rust-ci
on:
push:
paths:
- '.github/workflows/rust-ci.yml'
- '.sqlx/**'
- 'Cargo.lock'
- 'Cargo.toml'
- 'Makefile.toml'
- 'crates/**'
- 'migrations/**'
- 'rust-toolchain.toml'
- 'rustfmt.toml'
pull_request:
workflow_dispatch:
env:
CARGO_MAKE_RUN_CODECOV: true
CARGO_TERM_COLOR: always
IMAGE_NAME_CLI: carlomicieli/trenako-cli
IMAGE_NAME_MIGRATIONS: carlomicieli/trenako-migrations
IMAGE_NAME_SERVER: carlomicieli/trenako-server
LOCAL_REGISTRY: localhost:5000
LOGGING__FORMAT: compact
LOGGING__LEVEL: info
REGISTRY: ghcr.io
SQLX_OFFLINE: true
jobs:
checks:
runs-on: ubuntu-22.04
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup the rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo make
run: cargo install [email protected]
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
continue-on-error: false
- name: Toolchain info
run: |
rustc --version
cargo --version --verbose
cargo make --version
- name: Run cargo check
run: cargo make check
- name: Check formatting with rustfmt
run: cargo make fmt-check
- name: Linting with Clippy
run: cargo make clippy
- name: Run the unit tests
run: cargo make unit-test
- name: Run the integration tests
run: cargo make integration-test
docker:
runs-on: ubuntu-22.04
needs: checks
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
permissions:
contents: read
packages: write
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for the server Docker image
id: meta-server
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_SERVER }}
${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME_SERVER }}
tags: |
# set latest tag for default branch
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=latest
type=raw,value={{date 'YYYYMMDDHHmm'}}-{{sha}}
- name: Extract metadata (tags, labels) for the migrations Docker image
id: meta-migrations
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_MIGRATIONS }}
${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME_MIGRATIONS }}
tags: |
# set latest tag for default branch
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=latest
type=raw,value={{date 'YYYYMMDDHHmm'}}-{{sha}}
- name: Extract metadata (tags, labels) for the cli Docker image
id: meta-cli
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_CLI }}
${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME_CLI }}
tags: |
# set latest tag for default branch
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=latest
type=raw,value={{date 'YYYYMMDDHHmm'}}-{{sha}}
- name: Build and export to Docker (server)
uses: docker/build-push-action@v5
with:
context: .
file: docker/server.dockerfile
load: true
tags: ${{ steps.meta-server.outputs.tags }}
labels: ${{ steps.meta-server.outputs.labels }}
- name: Build and export to Docker (migrations)
uses: docker/build-push-action@v5
with:
context: .
file: docker/migrations.dockerfile
load: true
tags: ${{ steps.meta-migrations.outputs.tags }}
labels: ${{ steps.meta-migrations.outputs.labels }}
- name: Build and export to Docker (cli)
uses: docker/build-push-action@v5
with:
context: .
file: docker/cli.dockerfile
load: true
tags: ${{ steps.meta-cli.outputs.tags }}
labels: ${{ steps.meta-cli.outputs.labels }}
- name: List docker images
run: docker image ls