Skip to content

Merge pull request #8 from dmurphy18/add_linux_pkg #39

Merge pull request #8 from dmurphy18/add_linux_pkg

Merge pull request #8 from dmurphy18/add_linux_pkg #39

Workflow file for this run

name: CI
on:
- push
- pull_request
concurrency:
# If changes are pushed to a PR, stop all running workflows before starting new ones
group: ${{ github.head_ref || (github.repository == 'saltstack/salt-vmtools' && github.run_id || github.ref_name) }}
cancel-in-progress: true
jobs:
collect-changed-files:
name: Collect changed files
runs-on: ubuntu-latest
outputs:
run-tests: ${{ steps.set-output.outputs.run-tests }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get specific changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
separator: ","
files: |
linux/svtminion.*
windows/svtminion.*
tests/**
.github/workflows/**
files_ignore: |
.github/workflows/release.yml
- name: Set Job Output
id: set-output
run: |
echo "::set-output name=run-tests::${{ steps.changed-files.outputs.any_modified }}"
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v4
with:
name: exitstatus-${{ github.job }}
path: exitstatus/
generate-actions-workflow:
name: Generate The Actions Workflow
runs-on: ubuntu-latest
needs: collect-changed-files
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Pre-Commit
run: |
python3 -m pip install -U pip
python3 -m pip install pre-commit
pre-commit install --install-hooks
- name: Generate Workflow Actions
run: |
pre-commit run -av generate-actions-workflow
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v4
with:
name: exitstatus-${{ github.job }}
path: exitstatus/
lint:
name: Lint
runs-on: ubuntu-latest
needs: collect-changed-files
container: koalaman/shellcheck-alpine:latest
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
steps:
- uses: actions/checkout@v4
- name: ShellCheck
run: |
shellcheck -s bash -f tty linux/svtminion.sh
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v4
with:
name: exitstatus-${{ github.job }}
path: exitstatus/
windows-2022:
name: Windows 2022
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-windows.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: windows-2022
display-name: Windows 2022
container-slug: windows-2022
timeout: 20
runs-on: windows-2022
instances: '["3006", "3006-8", "3007", "3007-1"]'
photon-5:
name: Photon OS 5
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: photon-5
display-name: Photon OS 5
container-slug: systemd-photon-5
timeout: 20
instances: '["3006", "3006-8", "3007", "3007-1"]'
rockylinux-9:
name: Rocky Linux 9
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: rockylinux-9
display-name: Rocky Linux 9
container-slug: systemd-rockylinux-9
timeout: 20
instances: '["3006", "3006-8", "3007", "3007-1"]'
set-pipeline-exit-status:
# This step is just so we can make github require this step, to pass checks
# on a pull request instead of requiring all
name: Set the ${{ github.workflow }} Pipeline Exit Status
runs-on: ubuntu-latest
needs:
- lint
- generate-actions-workflow
- windows-2022
- photon-5
- rockylinux-9
if: always()
steps:
- name: Download Exit Status Files
if: always()
uses: actions/download-artifact@v4
with:
path: exitstatus/
pattern: exitstatus-*
merge-multiple: true
- name: Delete Exit Status Artifacts
if: always()
uses: geekyeggo/delete-artifact@v5
with:
pattern: exitstatus-*
failOnError: false
- name: Set Pipeline Exit Status
run: |
grep -RE 'failure|cancelled' exitstatus/ && exit 1 || exit 0
- name: Done
if: always()
run:
echo "All worflows finished"