Skip to content

Merge pull request #2232 from saltstack/renovate/github-actions-minor… #687

Merge pull request #2232 from saltstack/renovate/github-actions-minor…

Merge pull request #2232 from saltstack/renovate/github-actions-minor… #687

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=custom.python-versions depName=actions/python-versions versioning=pep440
PYTHON_VERSION: 3.13.0
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: win/repo-ng
- name: Setup Salt
uses: dafyddj/setup-salt-win@a81ff6460b4847498f56176fce5b5f76c5fc5de0 # v3.1.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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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@a81ff6460b4847498f56176fce5b5f76c5fc5de0 # v3.1.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
permissions:
contents: write
issues: write
pull-requests: write
checks: read
runs-on: ubuntu-latest
steps:
- uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0
with:
ignore: Collect results
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: codfish/semantic-release-action@9a999e0cdb207de2c9d9d4276860435727818989 # v3.4.1
with:
additional-packages: [email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}