Skip to content

add auto reloading configs #140

add auto reloading configs

add auto reloading configs #140

Workflow file for this run

name: ci
on:
push:
branches:
- automation/brawl/try/*
- automation/brawl/merge/*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
clippy:
name: Clippy
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
components: clippy
- uses: Swatinem/rust-cache@v2
id: cache-rust
with:
prefix-key: "v0-rust-${{ steps.setup-rust.outputs.cachekey }}"
shared-key: clippy
- name: Make sure code is linted
run: cargo +nightly clippy
fmt:
name: Fmt
runs-on: ubuntu-24.04
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
components: rustfmt
- name: Make sure code is formatted
run: cargo +nightly fmt --check
hakari:
name: Hakari
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
- uses: taiki-e/install-action@v2
with:
tool: cargo-hakari
- name: Make sure Hakari is up-to-date
run: |
set -xeo pipefail
cargo hakari manage-deps --dry-run
cargo hakari generate --diff
cargo hakari verify
schema-check:
name: Schema Check
runs-on: ubuntu-24.04
services:
postgres:
image: postgres
env:
POSTGRES_USER: brawl
POSTGRES_PASSWORD: brawl
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
DATABASE_URL: postgres://brawl:brawl@localhost:5432/brawl
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
- uses: taiki-e/install-action@v2
with:
tool: diesel_cli,just
- name: Generate the schema
run: diesel database setup
- name: Check the schema is up-to-date
run: just diesel-check
test:
name: Test
runs-on: ubuntu-24.04
services:
postgres:
image: postgres
env:
POSTGRES_USER: brawl
POSTGRES_PASSWORD: brawl
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
DATABASE_URL: postgres://brawl:brawl@localhost:5432/brawl
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-${{ steps.setup-rust.outputs.cachekey }}"
shared-key: test
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov,diesel_cli
- name: Setup database
run: diesel database setup
# Note; we don't run the powerset here because it's very slow on CI
# Perhaps we should consider it at some point.
- name: Run tests
run: cargo +nightly llvm-cov nextest --no-fail-fast --all-features --lcov --output-path ./lcov.info --profile ci
- name: Codecov Override
if: ${{ startsWith(github.ref, 'refs/heads/automation/brawl/try/') }}
run: |
PR_NUMBER=$(echo ${{ github.ref }} | sed -n 's/^refs\/heads\/automation\/brawl\/try\/\([0-9]*\)$/\1/p')
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
RUN_COMMIT_SHA=$(git log -1 --pretty=format:%H)
echo "RUN_COMMIT_SHA=$RUN_COMMIT_SHA" >> $GITHUB_ENV
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
files: ./lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
override_pr: ${{ env.PR_NUMBER || github.event.pull_request.number || '' }}
override_commit: ${{ env.RUN_COMMIT_SHA || github.sha }}
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
files: ./target/nextest/ci/junit.xml
override_pr: ${{ env.PR_NUMBER || github.event.pull_request.number || '' }}
override_commit: ${{ env.RUN_COMMIT_SHA || github.sha }}
token: ${{ secrets.CODECOV_TOKEN }}
build:
name: Build
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
if: ${{ !cancelled() && github.event_name == 'push' }}
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
run: |
echo "IMAGE_NAME=${IMAGE_NAME,,}" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: server/Dockerfile
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
push: ${{ startsWith(github.ref, 'refs/heads/automation/brawl/merge/') }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: ${{ startsWith(github.ref, 'refs/heads/automation/brawl/merge/') }}
brawl-done:
runs-on: ubuntu-24.04
needs: [schema-check, hakari, test, clippy, fmt, build]
if: ${{ !cancelled() && github.event_name == 'push' }}
steps:
- name: calculate the correct exit status
run: jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'