-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add code ci Signed-off-by: James Petersen <[email protected]> * chore: fix cargo test Signed-off-by: James Petersen <[email protected]> * chore: fix test and check for existence of certs Signed-off-by: James Petersen <[email protected]> --------- Signed-off-by: James Petersen <[email protected]>
- Loading branch information
Showing
8 changed files
with
265 additions
and
21 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
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,165 @@ | ||
name: Lint and Test Code | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- src/** | ||
- .github/workflows/ci-code.yaml | ||
|
||
jobs: | ||
rustfmt: | ||
name: rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: harden runner | ||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: checkout repository | ||
uses: actions/checkout@6b42224f41ee5dfe5395e27c8b2746f1f9955030 # v4.2.0 | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
|
||
- name: 'Install stable rust toolchain with rustfmt' | ||
run: | | ||
rustup update --no-self-update stable | ||
rustup default stable | ||
rustup component add rustfmt | ||
- name: 'cargo fmt' | ||
run: cargo fmt --all -- --check | ||
|
||
shfmt: | ||
name: shfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: harden runner | ||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: checkout repository | ||
uses: actions/checkout@6b42224f41ee5dfe5395e27c8b2746f1f9955030 # v4.2.0 | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
|
||
- name: shfmt | ||
run: | | ||
GOBIN=/usr/local/bin go install mvdan.cc/sh/v3/cmd/shfmt@latest | ||
if ! ./hack/code/shfmt.sh; then | ||
echo "" | ||
echo "Please run \`PROTECT_SHFMT_WRITE=true ./hack/code/shfmt.sh\`" | ||
fi | ||
shellcheck: | ||
name: shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: harden runner | ||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: checkout repository | ||
uses: actions/checkout@6b42224f41ee5dfe5395e27c8b2746f1f9955030 # v4.2.0 | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
|
||
- name: shellcheck | ||
run: ./hack/code/shellcheck.sh | ||
|
||
full-build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: | ||
- x86_64 | ||
env: | ||
TARGET_ARCH: "${{ matrix.arch }}" | ||
name: 'Full build linux-${{ matrix.arch }}' | ||
steps: | ||
- name: harden runner | ||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: checkout repository | ||
uses: actions/checkout@6b42224f41ee5dfe5395e27c8b2746f1f9955030 # v4.2.0 | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
|
||
- name: 'Install stable rust toolchain' | ||
run: | | ||
rustup update --no-self-update stable | ||
rustup default stable | ||
- name: cargo build | ||
run: cargo build | ||
|
||
full-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: | ||
- x86_64 | ||
env: | ||
TARGET_ARCH: "${{ matrix.arch }}" | ||
name: 'Full test linux-${{ matrix.arch }}' | ||
steps: | ||
- name: harden runner | ||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: checkout repository | ||
uses: actions/checkout@6b42224f41ee5dfe5395e27c8b2746f1f9955030 # v4.2.0 | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
|
||
- name: 'Install stable rust toolchain' | ||
run: | | ||
rustup update --no-self-update stable | ||
rustup default stable | ||
- name: 'cargo test' | ||
run: cargo test | ||
|
||
full-clippy: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
arch: | ||
- x86_64 | ||
env: | ||
TARGET_ARCH: "${{ matrix.arch }}" | ||
name: 'Full clippy linux-${{ matrix.arch }}' | ||
steps: | ||
- name: harden runner | ||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: checkout repository | ||
uses: actions/checkout@6b42224f41ee5dfe5395e27c8b2746f1f9955030 # v4.2.0 | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
|
||
- name: 'Install stable rust toolchain with clippy' | ||
run: | | ||
rustup update --no-self-update stable | ||
rustup default stable | ||
rustup component add clippy | ||
- name: 'cargo clippy' | ||
run: cargo clippy |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
REAL_SCRIPT="$(realpath "${0}")" | ||
cd "$(dirname "${REAL_SCRIPT}")/../.." | ||
|
||
find hack -type f -name '*.sh' -print0 | xargs -0 shellcheck -x |
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,22 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
REAL_SCRIPT="$(realpath "${0}")" | ||
cd "$(dirname "${REAL_SCRIPT}")/../.." | ||
|
||
# Pulled from the flags resembling the google style guide here | ||
# https://github.com/mvdan/sh/blob/master/cmd/shfmt/shfmt.1.scd#examples | ||
FLAGS="--indent 2 --case-indent --binary-next-line --list" | ||
|
||
if [ -z "${PROTECT_SHFMT_WRITE}" ]; then | ||
echo "Running shfmt in diff mode..." | ||
FLAGS="${FLAGS} --diff" | ||
else | ||
echo "Running shfmt in write mode..." | ||
FLAGS="${FLAGS} --write" | ||
fi | ||
|
||
echo "shfmt $FLAGS" | ||
|
||
# shellcheck disable=SC2086 | ||
find . -not -path '*/.*' -type f -name '*.sh' -print0 | xargs -0 shfmt $FLAGS |
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