-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add checks for build, `cargo fmt`, `cargo check`, and tests. The tests are currently failing (known), but I want to get the GH checks in place anyway.
- Loading branch information
Showing
5 changed files
with
110 additions
and
37 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
json_opts=() | ||
if ! echo "$*" | grep -q -- '--message-format json' ; then | ||
echo "NO: $*" | ||
json_opts=(--message-format json) | ||
fi | ||
|
||
exit_code=0 | ||
while IFS= read -r line; do | ||
echo "$line" | ||
exit_code=1 | ||
done < <( | ||
set -x | ||
cargo "$@" ${json_opts[@]} | | ||
jq -r ' | ||
select(.message.level and (.message.spans | length > 0)) | ||
| {level: (.message.level | sub("note"; "notice")), message: .message.message} as $ctx | ||
| .message.spans[] | ||
| "::\($ctx.level) file=\(.file_name),line=\(.line_start),col=\(.column_start),endLine=\(.line_end),columnEnd=\(.column_end),title=rust check::\($ctx.message)"' | ||
) | ||
|
||
exit "$exit_code" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: rust | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: cargo build | ||
run: .github/workflows/cargo_to_gh rustc --message-format json -- -Awarnings | ||
|
||
check: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: cargo check | ||
run: .github/workflows/cargo_to_gh check | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: cargo test | ||
run: cargo test --verbose | ||
|
||
fmt: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: cargo fmt | ||
run: cargo fmt --check |
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
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
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