-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (90 loc) · 2.4 KB
/
cicd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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