Implement a lightweight (partial) test using podman (and other fixes) #470
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/CD | |
## | |
# This github workflow is used to run tests on all commits to the master branch | |
# to verify all basic processes function correctly. | |
## | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
## | |
# Lint Checkers | |
# 1. Shellcheck | |
# 2. SLS Lint | |
# 3. Python Lint | |
## | |
lint: | |
name: Lint Checkers | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# 1. Shellcheck | |
# Looks for +x files | |
- name: ShellCheck | |
uses: ludeeus/action-shellcheck@master | |
with: | |
ignore_names: '10_linux' | |
env: | |
SHELLCHECK_OPTS: -e SC1091 | |
# 2. SLS Lint | |
- name: SLS Lint | |
uses: roaldnefs/salt-lint-action@master | |
# 3. Python Lint | |
- name: Set Up Python environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Flake8 Lint | |
uses: py-actions/flake8@v2 | |
with: | |
# E501: Ignore long lines for tests | |
ignore: 'E501' | |
## | |
# Test installed OS from built ISO: | |
# 1. Run validation tests inside of container | |
# 2. Ensure make clean produces no errors | |
## | |
container: | |
name: Container Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install make podman | |
# 1. Run validation tests inside of container | |
- name: Run Container Tests | |
id: validation_tests | |
run: make test | |
# 2. Ensure make clean produces no errors | |
- name: Run Cleanup | |
id: cleanup | |
run: make clean | |
## | |
# Merge master into cicd-release after tests pass | |
# NOTE: From this point forward, a force push is non-trivial! | |
## | |
deploy: | |
name: Deploy Changes | |
needs: [lint, container] | |
if: github.ref == 'refs/heads/master' | |
permissions: | |
pull-requests: write | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
ref: cicd-release | |
- name: Merge Changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Github Actions" | |
git merge --no-ff "${{ github.sha }}" -m "[CICD-Pass] Merge ${{ github.sha }} into cicd-release" | |
# CICD: deploy->master | |
- name: Go Live! | |
run: | | |
git push origin cicd-release |