Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: PR Pipeline

on:
pull_request:
branches:
- "main"

concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
pr:
name: Run PR-Job
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Extract last commit message
id: last_commit
run: |
last_commit_msg=$(git log -1 --pretty=%s)
echo "lastcommit=$last_commit_msg" >> $GITHUB_ENV

- name: Build
run: cargo build --verbose

- name: Execute tests
run: cargo test
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Cinstrument-coverage'
LLVM_PROFILE_FILE: 'target/coverage/%p-%m.profraw'

- name: Generate coverage report
run: |
rustup component add llvm-tools-preview
cargo install grcov
grcov . \
--binary-path target/debug/ \
-s . \
-t lcov \
--branch \
--ignore-not-existing \
-o target/lcov.info

- name: Check on unwanted file changes
run: |
git status --short
git add -A
git diff --cached --exit-code

- name: Format code
if: >-
${{
!contains(env.lastcommit, '🎨 Formatted code')
}}
run: cargo fmt

- name: Add formatting-commit
if: >-
${{
!contains(env.lastcommit, '🎨 Formatted code')
}}
run: |
git config --global user.name 'OpenFoxes Maintenance Bot'
git config --global user.email 'openfoxes@bono-fox.de'
git checkout ${{ github.event.pull_request.head.ref }}
git add .
git diff-index --quiet ${{ github.event.pull_request.head.ref }} || {
git commit -m "🎨 Formatted code"
git push origin ${{ github.event.pull_request.head.ref }}
}

- name: Codecov
uses: codecov/codecov-action@v5
with:
files: target/lcov.info
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
50 changes: 1 addition & 49 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
name: PR Pipeline
name: Execute tests

on:
pull_request:
branches:
- "main"
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

Expand All @@ -20,19 +13,6 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Extract last commit message
id: last_commit
run: |
last_commit_msg=$(git log -1 --pretty=%s)
echo "lastcommit=$last_commit_msg" >> $GITHUB_ENV

- name: Build
run: cargo build --verbose

- name: Execute tests
run: cargo test
Expand All @@ -53,34 +33,6 @@ jobs:
--ignore-not-existing \
-o target/lcov.info

- name: Check on unwanted file changes
run: |
git status --short
git add -A
git diff --cached --exit-code

- name: Format code
if: >-
${{
!contains(env.lastcommit, '🎨 Formatted code')
}}
run: cargo fmt

- name: Add formatting-commit
if: >-
${{
!contains(env.lastcommit, '🎨 Formatted code')
}}
run: |
git config --global user.name 'OpenFoxes Maintenance Bot'
git config --global user.email 'openfoxes@bono-fox.de'
git checkout ${{ github.event.pull_request.head.ref }}
git add .
git diff-index --quiet ${{ github.event.pull_request.head.ref }} || {
git commit -m "🎨 Formatted code"
git push origin ${{ github.event.pull_request.head.ref }}
}

- name: Codecov
uses: codecov/codecov-action@v5
with:
Expand Down