Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): Bump dependencies (testcontainers & prepare for Rust Edition 2024, remove MongoDB) #121

Merged
merged 20 commits into from
Sep 30, 2024
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
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers/features/rust:1": {},
"ghcr.io/devcontainers/features/java:1": {}
"ghcr.io/devcontainers/features/java:1": {
"version": "17",
"installMaven": "true",
"installGradle": "true"
}
}
}
129 changes: 121 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,137 @@ on:
- alpha
- development

permissions:
issues: write
pull-requests: write

jobs:
app-unit-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Run cargo fmt --check
id: fmt
working-directory: ./clearing-house-app
continue-on-error: true
run: |
set +e

- name: Build and Test
cargo fmt --check --message-format human >> cargo_fmt_output.txt
exit_code=$?

echo "code=$exit_code" >> $GITHUB_OUTPUT
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
continue-on-error: false
run: |
cd clearing-house-app
cargo build
cargo test

- name: Test
id: test
working-directory: ./clearing-house-app
continue-on-error: false
env:
NO_COLOR: true
run: |
set +e

cargo test &>> cargo_test_output.txt
exit_code=$?

echo "code=$exit_code" >> $GITHUB_OUTPUT
echo "text<<EOF" >> $GITHUB_OUTPUT
cat cargo_test_output.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Run cargo clippy
id: clippy
working-directory: ./clearing-house-app
continue-on-error: true
run: |
set +e

cargo clippy >> cargo_clippy_output.txt
exit_code=$?

echo "code=$exit_code" >> $GITHUB_OUTPUT
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 <= 59) {
testComment = "_No test output_";
}

const body = `# Clearinghouse App Build report
## Formatter report ("cargo fmt --check"):

Exit code: ${{ steps.fmt.outputs.code }}

${fmtComment}

## Linter report ("cargo clippy"):

Exit code: ${{ steps.clippy.outputs.code }}

${linterComment}

## Test log
Exit code: ${{ steps.test.outputs.code }}

${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
Expand Down
Loading
Loading