Skip to content

Commit

Permalink
add action
Browse files Browse the repository at this point in the history
  • Loading branch information
李佳 committed Aug 3, 2023
1 parent 4fc18c2 commit 262efb3
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yaml
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.
2 changes: 1 addition & 1 deletion tests/skustomize.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bats_require_minimum_version 1.5.0
setup_file() {
GIT_ROOT=$(git rev-parse --show-toplevel)
export TEST_DIR="$GIT_ROOT/tests"
export SKUST_BIN="$GIT_ROOT/skustomize.sh"
export SKUST_BIN="$GIT_ROOT/skustomize"
export SOPS_AGE_KEY_FILE="$TEST_DIR/age/key.txt"
TEMPDIR=$(mktemp -d)
export TEMPDIR
Expand Down

0 comments on commit 262efb3

Please sign in to comment.