-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
李佳
committed
Aug 3, 2023
1 parent
4fc18c2
commit 262efb3
Showing
3 changed files
with
61 additions
and
1 deletion.
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,60 @@ | ||
--- | ||
name: CI | ||
|
||
env: | ||
SOPS_VERSION: 3.7.3 | ||
VALS_VERSION: 0.25.0 | ||
YQ_VERSION: 4.34.2 | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: run shellcheck | ||
uses: reviewdog/action-shellcheck@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
reporter: github-pr-review | ||
path: "." | ||
pattern: | | ||
*.sh | ||
*.bats | ||
exclude: "./.git/*" # Optional. | ||
check_all_files_with_shebangs: "false" # Optional. | ||
|
||
unit-tests: | ||
runs-on: ubuntu-latest | ||
env: | ||
BATSLIB_TEMP_PRESERVE: "0" | ||
BATSLIB_TEMP_PRESERVE_ON_FAILURE: "0" | ||
steps: | ||
- name: Install dependencies | ||
run: | | ||
npm install bats bats-support bats-assert | ||
gem install bashcov:'< 2' simplecov-cobertura:'< 2' | ||
curl -fsSL https://github.com/mozilla/sops/releases/download/v${{ env.SOPS_VERSION }}/sops-v${SOPS_VERSION}.linux -o /usr/local/bin/sops | ||
chmod +x /usr/local/bin/sops | ||
curl -fsSL https://github.com/helmfile/vals/releases/download/v${{ env.VALS_VERSION }}/vals_${VALS_VERSION}_linux_amd64.tar.gz | tar xzf - -C /usr/local/bin/ vals | ||
chmod +x /usr/local/bin/vals | ||
curl -fsSL https://github.com/mikefarah/yq/releases/download/v${{ env.YQ_VERSION }}/yq_linux_amd64 -o /usr/local/bin/yq | ||
chmod +x /usr/local/bin/yq | ||
- uses: actions/checkout@v3 | ||
|
||
- name: run test | ||
run: | | ||
export BATS_LIB_PATH=$PWD/node_modules | ||
export PATH=$PWD/node_modules/bats/bin:$PATH | ||
export SOPS_AGE_KEY_FILE=$PWD/tests/age/key.txt | ||
bashcov -- bats -r --timing --tap --report-formatter junit tests | ||
- uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage/coverage.xml | ||
fail_ci_if_error: true |
File renamed without changes.
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