Skip to content

Commit c7a6aeb

Browse files
authored
feat(app): removed MongoDB implementation, added report posting in PR, bumped dependencies
* fix(app): Bump dependencies * feat(app): Removed MongoDB implementation * Add report posting to workflow * Fixing action * Fixing action * Fixing action * Fixing action * Fixing action * Fixing action * Fixing action * Fixing action * Fixing action * Fixing action * Fixing action * Fix escaping issued * Fixing action * Fixing action * Fixing action * Fixing action * Fix formatting
1 parent 4068cbf commit c7a6aeb

File tree

16 files changed

+802
-1390
lines changed

16 files changed

+802
-1390
lines changed

.devcontainer/devcontainer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"image": "mcr.microsoft.com/devcontainers/universal:2",
33
"features": {
44
"ghcr.io/devcontainers/features/rust:1": {},
5-
"ghcr.io/devcontainers/features/java:1": {}
5+
"ghcr.io/devcontainers/features/java:1": {
6+
"version": "17",
7+
"installMaven": "true",
8+
"installGradle": "true"
9+
}
610
}
711
}

.github/workflows/test.yml

Lines changed: 121 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,137 @@ on:
88
- alpha
99
- development
1010

11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
1115
jobs:
1216
app-unit-tests:
1317
runs-on: ubuntu-latest
1418

1519
steps:
1620
- name: Checkout code
17-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
1822

19-
- name: Set up Rust
20-
uses: actions-rs/toolchain@v1
21-
with:
22-
toolchain: stable
23+
- name: Run cargo fmt --check
24+
id: fmt
25+
working-directory: ./clearing-house-app
26+
continue-on-error: true
27+
run: |
28+
set +e
2329
24-
- name: Build and Test
30+
cargo fmt --check --message-format human >> cargo_fmt_output.txt
31+
exit_code=$?
32+
33+
echo "code=$exit_code" >> $GITHUB_OUTPUT
34+
echo "text<<EOF" >> $GITHUB_OUTPUT
35+
cat cargo_fmt_output.txt >> $GITHUB_OUTPUT
36+
echo "EOF" >> $GITHUB_OUTPUT
37+
38+
- name: Build
39+
id: build
40+
working-directory: ./clearing-house-app
41+
continue-on-error: false
2542
run: |
26-
cd clearing-house-app
2743
cargo build
28-
cargo test
44+
45+
- name: Test
46+
id: test
47+
working-directory: ./clearing-house-app
48+
continue-on-error: false
49+
env:
50+
NO_COLOR: true
51+
run: |
52+
set +e
53+
54+
cargo test &>> cargo_test_output.txt
55+
exit_code=$?
56+
57+
echo "code=$exit_code" >> $GITHUB_OUTPUT
58+
echo "text<<EOF" >> $GITHUB_OUTPUT
59+
cat cargo_test_output.txt >> $GITHUB_OUTPUT
60+
echo "EOF" >> $GITHUB_OUTPUT
61+
62+
- name: Run cargo clippy
63+
id: clippy
64+
working-directory: ./clearing-house-app
65+
continue-on-error: true
66+
run: |
67+
set +e
68+
69+
cargo clippy >> cargo_clippy_output.txt
70+
exit_code=$?
71+
72+
echo "code=$exit_code" >> $GITHUB_OUTPUT
73+
echo "text<<EOF" >> $GITHUB_OUTPUT
74+
cat cargo_clippy_output.txt >> $GITHUB_OUTPUT
75+
echo "EOF" >> $GITHUB_OUTPUT
76+
77+
- name: Post results to PR
78+
uses: actions/github-script@v7
79+
if: always()
80+
env:
81+
FMT_OUTPUT: ${{ steps.fmt.outputs.text }}
82+
TEST_OUTPUT: ${{ steps.test.outputs.text }}
83+
LINTER_OUTPUT: ${{ steps.linter.outputs.text }}
84+
with:
85+
script: |
86+
const fmtOutput = process.env.FMT_OUTPUT;
87+
let fmtComment = `\`\`\`
88+
${ fmtOutput }
89+
\`\`\``;
90+
91+
if (fmtComment == "```\n\n```") {
92+
fmtComment = "_No formatter warnings_";
93+
}
94+
95+
const clippyOutput = process.env.LINTER_OUTPUT;
96+
let linterComment = `\`\`\`
97+
${ clippyOutput }
98+
\`\`\``;
99+
100+
if (linterComment == "```\n\n```") {
101+
linterComment = "_No linter warnings_";
102+
}
103+
104+
const testOutput = process.env.TEST_OUTPUT;
105+
let testComment = `<details><summary>Test log:</summary>
106+
107+
\`\`\`
108+
${ testOutput }
109+
\`\`\`
110+
111+
</details>`;
112+
113+
if (testComment.length <= 59) {
114+
testComment = "_No test output_";
115+
}
116+
117+
const body = `# Clearinghouse App Build report
118+
## Formatter report ("cargo fmt --check"):
119+
120+
Exit code: ${{ steps.fmt.outputs.code }}
121+
122+
${fmtComment}
123+
124+
## Linter report ("cargo clippy"):
125+
126+
Exit code: ${{ steps.clippy.outputs.code }}
127+
128+
${linterComment}
129+
130+
## Test log
131+
Exit code: ${{ steps.test.outputs.code }}
132+
133+
${testComment}
134+
`;
135+
136+
github.rest.issues.createComment({
137+
issue_number: context.issue.number,
138+
owner: context.repo.owner,
139+
repo: context.repo.repo,
140+
body: body
141+
});
29142
30143
edc-unit-tests:
31144
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)