From bceeaeb76bd19e953403b23693e9f0fbfa04144f Mon Sep 17 00:00:00 2001 From: Erik Kristensen Date: Wed, 31 Mar 2021 11:20:41 -0600 Subject: [PATCH] Adding Tests for States Test Changes States on PR. Test Changes on Merge to Master. Setup Recurring for States known to break frequently. --- .github/workflows/tests.yml | 44 ++++++++++++++++++++++++++++++ .github/workflows/weekly-tests.yml | 26 ++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 .github/workflows/weekly-tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..34c11a0 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,44 @@ +name: tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + changed_states: + runs-on: ubuntu-latest + steps: + - id: files + uses: jitterbit/get-changed-files@v1 + with: + format: "json" + - id: filter + run: | + echo ::set-output name=filtered_files::"$(jq -rMc '[.[] | select(. | contains(".sls")) | sub("/"; "."; "g") | sub(".sls"; ""; "g")]' <<< '${{ steps.files.outputs.added_modified }}')" + outputs: + matrix: ${{ steps.filter.outputs.filtered_files }} + + test_states: + needs: changed_states + + runs-on: ubuntu-latest + + if: ${{ needs.changed_states.outputs.matrix != '[]' }} + + strategy: + matrix: + os: [focal] + state: ${{ fromJson(needs.changed_states.outputs.matrix) }} + + container: + image: docker://teamdfir/sift-saltstack-tester:${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - name: test-state + run: | + salt-call -l info --file-root . --local --retcode-passthrough --state-output=mixed state.sls ${{ matrix.state }} pillar="{sift_user: root}" diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml new file mode 100644 index 0000000..3fefbb3 --- /dev/null +++ b/.github/workflows/weekly-tests.yml @@ -0,0 +1,26 @@ +name: weekly-tests + +on: + schedule: + - cron: 0 13 * * 1 + +jobs: + test_states: + runs-on: ubuntu-latest + + strategy: + matrix: + os: [focal] + state: + - sift.packages.python2 + - sift.packages.python3 + - sift.packages.python3-plaso + + container: + image: docker://teamdfir/sift-saltstack-tester:${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + - name: test-state + run: | + salt-call -l info --file-root . --local --retcode-passthrough --state-output=mixed state.sls ${{ matrix.state }} pillar="{sift_user: root}"