Skip to content

Commit

Permalink
Adding Tests for States
Browse files Browse the repository at this point in the history
Test Changes States on PR. Test Changes on Merge to Master. Setup Recurring for States known to break frequently.
  • Loading branch information
ekristen authored Mar 31, 2021
1 parent ce8bacd commit bceeaeb
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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}"
26 changes: 26 additions & 0 deletions .github/workflows/weekly-tests.yml
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit bceeaeb

Please sign in to comment.