Unstable development branch (WIP) #108
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: Run Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
# Run on all pull requests, regardless of target branch | |
env: | |
CARGO_TERM_COLOR: always | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}/pcg-server | |
jobs: | |
check_warnings: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-09-15 | |
- name: Check for warnings | |
env: | |
RUSTFLAGS: "-D warnings" | |
run: cargo check --all-targets --all-features --lib --bins --tests --examples --benches --message-format=json | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-09-15 | |
components: clippy | |
- name: Run Clippy | |
run: cargo clippy -- -D warnings | |
test_files: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-09-15 | |
- name: Run tests on files | |
run: cargo test --test test_files | |
bench_test_files: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-09-15 | |
- name: Install valgrind | |
run: sudo apt-get update && sudo apt-get install -y valgrind | |
- name: Run benchmark tests | |
run: cargo test --test bench_test_files -- --nocapture --show-output | |
test_crates: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-09-15 | |
- name: Run tests on selected crates | |
run: cargo test --test selected_crates | |
unit_tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-09-15 | |
- name: Run unit tests | |
run: cargo test --lib | |
doc_tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-09-15 | |
- name: Run unit tests | |
run: cargo test --doc | |
flowistry_tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout pcs repository | |
uses: actions/checkout@v4 | |
with: | |
path: pcs | |
- name: Checkout flowistry repository | |
uses: actions/checkout@v4 | |
with: | |
repository: zgrannan/flowistry | |
ref: zgrannan/pcg | |
path: flowistry | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2024-09-15 | |
- name: Run flowistry tests | |
working-directory: flowistry/crates/flowistry | |
run: cargo test | |
build-docker-image: | |
runs-on: ubuntu-latest | |
needs: [check_warnings, clippy, test_files, bench_test_files, test_crates, unit_tests, doc_tests, flowistry_tests] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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 Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha,format=long | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.ref == 'refs/heads/main' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |