mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-10 06:41:41 +00:00
113 lines
3 KiB
YAML
113 lines
3 KiB
YAML
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/
|