Update bootstrap shell CI/CD to utilize containers and clean up #977
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-bootstrap' && 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: | | |
bootstrap-salt.* | |
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 sh -f tty bootstrap-salt.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/ | |
macos-12: | |
name: macOS 12 | |
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' | |
uses: ./.github/workflows/test-macos.yml | |
needs: | |
- lint | |
- generate-actions-workflow | |
with: | |
distro-slug: macos-12 | |
display-name: macOS 12 | |
container-slug: macos-12 | |
timeout: 20 | |
runs-on: macos-12 | |
instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' | |
macos-13: | |
name: macOS 13 | |
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' | |
uses: ./.github/workflows/test-macos.yml | |
needs: | |
- lint | |
- generate-actions-workflow | |
with: | |
distro-slug: macos-13 | |
display-name: macOS 13 | |
container-slug: macos-13 | |
timeout: 20 | |
runs-on: macos-13 | |
instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' | |
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: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' | |
amazonlinux-2: | |
name: Amazon 2 | |
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: amazonlinux-2 | |
display-name: Amazon 2 | |
container-slug: amazonlinux-2 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' | |
amazonlinux-2023: | |
name: Amazon 2023 | |
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: amazonlinux-2023 | |
display-name: Amazon 2023 | |
container-slug: amazonlinux-2023 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' | |
debian-11: | |
name: Debian 11 | |
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: debian-11 | |
display-name: Debian 11 | |
container-slug: debian-11 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' | |
debian-12: | |
name: Debian 12 | |
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: debian-12 | |
display-name: Debian 12 | |
container-slug: debian-12 | |
timeout: 20 | |
instances: '["stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' | |
debian-13: | |
name: Debian 13 | |
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: debian-13 | |
display-name: Debian 13 | |
container-slug: debian-13 | |
timeout: 20 | |
instances: '["stable-3006", "git-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' | |
fedora-40: | |
name: Fedora 40 | |
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: fedora-40 | |
display-name: Fedora 40 | |
container-slug: fedora-40 | |
timeout: 20 | |
instances: '["stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' | |
photon-4: | |
name: Photon OS 4 | |
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-4 | |
display-name: Photon OS 4 | |
container-slug: photon-4 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "latest", "default"]' | |
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: photon-5 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "latest", "default"]' | |
rockylinux-8: | |
name: Rocky Linux 8 | |
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-8 | |
display-name: Rocky Linux 8 | |
container-slug: rockylinux-8 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]' | |
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: rockylinux-9 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' | |
ubuntu-2004: | |
name: Ubuntu 20.04 | |
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: ubuntu-2004 | |
display-name: Ubuntu 20.04 | |
container-slug: ubuntu-20.04 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' | |
ubuntu-2204: | |
name: Ubuntu 22.04 | |
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: ubuntu-2204 | |
display-name: Ubuntu 22.04 | |
container-slug: ubuntu-22.04 | |
timeout: 20 | |
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' | |
ubuntu-2404: | |
name: Ubuntu 24.04 | |
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: ubuntu-2404 | |
display-name: Ubuntu 24.04 | |
container-slug: ubuntu-24.04 | |
timeout: 20 | |
instances: '["stable-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]' | |
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 | |
- macos-12 | |
- macos-13 | |
- windows-2022 | |
- amazonlinux-2 | |
- amazonlinux-2023 | |
- debian-11 | |
- debian-12 | |
- debian-13 | |
- fedora-40 | |
- photon-4 | |
- photon-5 | |
- rockylinux-8 | |
- rockylinux-9 | |
- ubuntu-2004 | |
- ubuntu-2204 | |
- ubuntu-2404 | |
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" |