Skip to content

Merge pull request #8 from saltstack/master #14

Merge pull request #8 from saltstack/master

Merge pull request #8 from saltstack/master #14

Workflow file for this run

name: Test
on:
- pull_request
- push
- workflow_call
- workflow_dispatch
jobs:
should-run:
name: Should run
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
should-run: ${{ steps.action.outputs.should-run }}
steps:
- id: action
uses: techneg-it/should-workflow-run@dcbb88600d59ec2842778ef1e2d41f680f876329 # v1.0.0
pre-commit:
name: Run `pre-commit`
needs: should-run
if: fromJSON(needs.should-run.outputs.should-run)
runs-on: ubuntu-latest
env:
# renovate: datasource=github-releases depName=actions/python-versions extractVersion=^(?<version>\S+)-\d+$
PYTHON_VERSION: 3.12.5
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
gsv:
name: Get Salt versions
needs: should-run
if: fromJSON(needs.should-run.outputs.should-run)
runs-on: ubuntu-latest
outputs:
salt-versions-els: ${{ steps.get-salt-versions.outputs.salt-versions-els }}
salt-versions: ${{ steps.get-salt-versions.outputs.salt-versions }}
salt-latest: ${{ steps.get-salt-versions.outputs.salt-latest }}
steps:
- id: get-salt-versions
uses: dafyddj/get-salt-versions@847b788138982a01def107014dd395b46b3ef2c5 # v3.3.1
refresh_db:
name: Test `pkg.refresh_db`
needs: gsv
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
salt-version:
- ${{ fromJSON(needs.gsv.outputs.salt-versions-els) }}
- ${{ fromJSON(needs.gsv.outputs.salt-versions) }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: win/repo-ng
- name: Setup Salt
uses: dafyddj/setup-salt-win@1fe09b1c0cdb721a43f9e5faa9bd079af8701803 # v2.2.0
with:
salt-version: ${{ matrix.salt-version }}
custom-config: |
osenv:
driver: env
file_roots:
base:
- sdb://osenv/GITHUB_WORKSPACE
- name: Run `salt-call pkg.refresh_db`
run: |
$pkgs = (salt-call --out=json pkg.refresh_db | ConvertFrom-Json).local
if ($LASTEXITCODE) {
Write-Host ("::error title=salt-call::salt-call returned exit code: $LASTEXITCODE")
exit 1
}
$pkgs
test:
name: Run URL tests
needs:
- gsv
runs-on: windows-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- id: changed-files
name: Get changed files
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
list-files: json
filters: |
sls:
- added|modified:
- '**/*.sls'
- name: Setup Salt
if: steps.changed-files.outputs.sls == 'true'
uses: dafyddj/setup-salt-win@1fe09b1c0cdb721a43f9e5faa9bd079af8701803 # v2.2.0
with:
salt-version: ${{ needs.gsv.outputs.salt-latest }}
- name: Setup `pip` dependencies
if: steps.changed-files.outputs.sls == 'true'
run: |
salt-pip install -r .cicd/requirements.txt
if ($LASTEXITCODE) {
Write-Host ("::error title=salt-pip::salt-pip returned exit code: $LASTEXITCODE")
exit 1
}
- name: Run URL test
if: steps.changed-files.outputs.sls == 'true'
run: |
& "C:\Program Files\Salt Project\Salt\Scripts\python.exe" .\.cicd\tests.py ${{ join(fromJSON(steps.changed-files.outputs.sls_files), ' ') }}
results:
name: Collect results
needs:
- pre-commit
- refresh_db
- test
runs-on: ubuntu-latest
steps:
- run: echo "Tests succeeded!"