Skip to content

Add changes from Erudite (basically rewrite test handling) #349

Add changes from Erudite (basically rewrite test handling)

Add changes from Erudite (basically rewrite test handling) #349

Workflow file for this run

# This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs
# several checks:
# - fmt: checks that the code is formatted according to rustfmt
# - clippy: checks that the code does not contain any clippy warnings
# - doc: checks that the code can be documented without errors
# - hack: check combinations of feature flags
permissions:
contents: read
# This configuration allows maintainers of this repo to create a branch and pull request based on
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
# built once.
on:
push:
branches: [main]
pull_request:
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: check
jobs:
fmt:
runs-on: blacksmith-2vcpu-ubuntu-2404
name: stable / fmt
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --check
clippy:
runs-on: blacksmith-4vcpu-ubuntu-2404
name: ${{ matrix.toolchain }} / clippy
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
# Get early warning of new lints which are regularly introduced in beta channels.
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: install dependencies (ubuntu only)
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: cargo clippy
uses: giraffate/clippy-action@v1
with:
reporter: "github-pr-check"
github_token: ${{ secrets.GITHUB_TOKEN }}
dependencies:
runs-on: blacksmith-2vcpu-ubuntu-2404
name: stable / machete
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: machete
uses: bnjbvr/cargo-machete@main
test:
# runs-on: blacksmith-2vcpu-ubuntu-2404
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: install dependencies (ubuntu only)
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- run: cargo test
name: Run cargo test
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
shell: bash
push-containers:
runs-on: blacksmith-4vcpu-ubuntu-2404
if: github.event_name == 'pull_request'
needs: [test, clippy]
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- dockerfile: Dockerfile
tags:
- ghcr.io/${{ github.repository_owner }}/basalt-server:dev-pr-${{ github.event.pull_request.number }}
- ghcr.io/${{ github.repository_owner }}/basalt-server:dev-pr-${{ github.event.pull_request.number }}-full
- dockerfile: scripting.Dockerfile
tags:
- ghcr.io/${{ github.repository_owner }}/basalt-server:dev-pr-${{ github.event.pull_request.number }}-scripting
- dockerfile: webhooks.Dockerfile
tags:
- ghcr.io/${{ github.repository_owner }}/basalt-server:dev-pr-${{ github.event.pull_request.number }}-webhooks
- dockerfile: minimal.Dockerfile
tags:
- ghcr.io/${{ github.repository_owner }}/basalt-server:dev-pr-${{ github.event.pull_request.number }}-minimal
steps:
- uses: actions/checkout@v4
# - name: Set up QEMU (for ARM builds)
# uses: docker/setup-qemu-action@v3
- name: Setup Docker Builder
uses: useblacksmith/setup-docker-builder@v1
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Use QEMU to build images for both amd64 and arm64
- name: Build and push Docker image
# uses: docker/build-push-action@v6
uses: useblacksmith/build-push-action@v2
with:
context: .
file: ./containers/${{ matrix.dockerfile }}
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: true
# tags: ghcr.io/${{ github.repository_owner }}/basalt-server-${{ matrix.tagSuffix }}:pr-${{ github.event.pull_request.number }}
tags: |
${{ join(matrix.tags, ',') }}