Skip to content

Commit

Permalink
Auto merge of #17 - troy/refactor, r=TroyKomodo
Browse files Browse the repository at this point in the history
better design ready for testing
<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.

Bug fixes and new features should include tests.

Contributors guide: https://github.com/ScuffleTV/.github/blob/main/CONTRIBUTING.md
-->

## Motivation

<!--
Explain the context and why you're making that change. What is the problem
you're trying to solve? If a new feature is being added, describe the intended
use case that feature fulfills.
-->

## Solution

<!--
Summarize the solution and provide any necessary context needed to understand
the code change.
-->

## Tickets

<!--
Link any relevant tickets. Remember to not specify the ticket ids in the commit messages.
-->

Requested-by: TroyKomodo <[email protected]>
  • Loading branch information
scuffle-brawl[bot] authored Dec 23, 2024
2 parents 0f69bc2 + e61887f commit dd3beaa
Show file tree
Hide file tree
Showing 108 changed files with 18,135 additions and 2,634 deletions.
70 changes: 64 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ jobs:
with:
toolchain: nightly

- uses: cargo-bins/cargo-binstall@main

- uses: taiki-e/install-action@v2
with:
tool: cargo-hakari
Expand All @@ -76,9 +74,60 @@ jobs:
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

Expand All @@ -93,34 +142,43 @@ jobs:
prefix-key: "v0-rust-${{ steps.setup-rust.outputs.cachekey }}"
shared-key: test

- uses: cargo-bins/cargo-binstall@main

- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov
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: PR 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
- 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 || '' }}
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 || '' }}
token: ${{ secrets.CODECOV_TOKEN }}

brawl-done:
runs-on: ubuntu-24.04
needs: [hakari, test, clippy, fmt]
needs: [schema-check, hakari, test, clippy, fmt]
if: ${{ !cancelled() && (startsWith(github.ref, 'refs/heads/automation/brawl/merge/') || startsWith(github.ref, 'refs/heads/automation/brawl/try/')) }}
steps:
- name: calculate the correct exit status
Expand Down
Loading

0 comments on commit dd3beaa

Please sign in to comment.