fix(app): Bump dependencies (testcontainers & prepare for Rust Edition 2024, remove MongoDB) #129
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: test | |
on: | |
pull_request: | |
branches: | |
- master | |
- beta | |
- alpha | |
- development | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
app-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run cargo fmt --check | |
id: fmt | |
working-directory: ./clearing-house-app | |
continue-on-error: true | |
run: | | |
cargo fmt --check --message-format human >> cargo_fmt_output.txt || true | |
echo "text<<EOF" >> $GITHUB_OUTPUT | |
cat cargo_fmt_output.txt >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Build | |
id: build | |
working-directory: ./clearing-house-app | |
run: | | |
cargo build | |
- name: Test | |
id: test | |
working-directory: ./clearing-house-app | |
env: | |
NO_COLOR: true | |
run: | | |
cargo test &>> cargo_test_output.txt | |
exit_code=$? | |
echo "text<<EOF" >> $GITHUB_OUTPUT | |
cat cargo_test_output.txt >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
exit $exit_code | |
- name: Run cargo clippy | |
id: clippy | |
working-directory: ./clearing-house-app | |
continue-on-error: true | |
run: | | |
cargo clippy >> cargo_clippy_output.txt || true | |
echo "text<<EOF" >> $GITHUB_OUTPUT | |
cat cargo_clippy_output.txt >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Post results to PR | |
uses: actions/github-script@v7 | |
if: always() | |
env: | |
FMT_OUTPUT: ${{ steps.fmt.outputs.text }} | |
TEST_OUTPUT: ${{ steps.test.outputs.text }} | |
LINTER_OUTPUT: ${{ steps.linter.outputs.text }} | |
with: | |
script: | | |
const fmtOutput = process.env.FMT_OUTPUT; | |
let fmtComment = `\`\`\` | |
${ fmtOutput } | |
\`\`\``; | |
if (fmtComment == "```\n\n```") { | |
fmtComment = "_No formatter warnings_"; | |
} | |
const clippyOutput = process.env.LINTER_OUTPUT; | |
let linterComment = `\`\`\` | |
${ clippyOutput } | |
\`\`\``; | |
if (linterComment == "```\n\n```") { | |
linterComment = "_No linter warnings_"; | |
} | |
const testOutput = process.env.TEST_OUTPUT; | |
let testComment = `<details><summary>Test log:</summary> | |
\`\`\` | |
${ testOutput } | |
\`\`\` | |
</details>`; | |
if (testComment.length <= 57) { | |
testComment = "_No test output_"; | |
} | |
const body = `# Clearinghouse App Build report | |
## Formatter report ("cargo fmt --check"): | |
${fmtComment} | |
## Linter report ("cargo clippy"): | |
${linterComment} | |
## Test log | |
${testComment} | |
`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}); | |
edc-unit-tests: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build Project | |
run: | | |
cd clearing-house-edc | |
./gradlew clean build \ | |
-Dorg.gradle.project.gitHubUserName=${{ github.actor }} \ | |
-Dorg.gradle.project.gitHubUserPassword=${{ secrets.GITHUB_TOKEN }} | |
- name: Run Unit Tests | |
run: | | |
cd clearing-house-edc | |
./gradlew test jacocoTestReport | |
- name: Add Coverage Report | |
id: jacoco | |
uses: madrapps/jacoco-report@v1.6.1 | |
with: | |
paths: | | |
${{ github.workspace }}/clearing-house-edc/core/build/reports/jacoco/test/jacocoTestReport.xml, | |
${{ github.workspace }}clearing-house-edc/extensions/multipart/build/reports/jacoco/test/jacocoTestReport.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
min-coverage-overall: 70 | |
min-coverage-changed-files: 80 |