Repository navigation
145 lines (128 loc) · 4.76 KB
/
Copy pathci.yaml
File metadata and controls
145 lines (128 loc) · 4.76 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: CI
on:
push:
branches:
- master
pull_request:
type: [opened, reopened, edited]
branches:
- master
schedule:
- cron: '0 0 * * *'
jobs:
# Special job which automatically cancels old runs for the same branch, prevents runs for the
# same file set which has already passed, etc.
pre_job:
name: Skip Duplicate Jobs Pre Job
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@4c656bbdb6906310fa6213604828008bc28fe55d # v3.3.0
with:
cancel_others: 'true'
github_token: ${{ github.token }}
ansible-lint:
needs: pre_job
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: 'Python 3.6'
python_version: "3.6"
steps:
- uses: actions/checkout@v2
- name: 'Set up Python (${{ matrix.python-version }})'
uses: actions/setup-python@v2
with:
python-version: '${{ matrix.python-version }}'
- name: Cache Python Dependencies
uses: actions/cache@v2
with:
path: |
~/.cache/pip
key: ${{ runner.os }}-v2-python-${{ matrix.python-version }}-${{ hashFiles('lint-requirements.txt') }}
restore-keys: |
${{ runner.os }}-v2-python-${{ matrix.python }}-
- name: Install Python Dependencies
run: |
pip install -r lint-requirements.txt
- name: Run Ansible Lint
run: |
ansible-lint -p ansible/
vagrant-up:
needs: pre_job
# Need to run it on OSX since nested virtualization is not supported on Linux runners
runs-on: macos-10.15
strategy:
fail-fast: false
matrix:
include:
- name: 'Ubuntu 18.04 + Python 3.6 + MongoDB 4.0'
vm_image: "ubuntu/bionic64"
python_version: "3.6"
mongodb_version: "4.0"
- name: 'Ubuntu 18.04 + Python 3.8 + MongoDB 4.4'
vm_image: "ubuntu/bionic64"
python_version: "3.8"
mongodb_version: "4.4"
- name: 'Ubuntu 20.04 + Python 3.8 + MongoDB 4.4'
vm_image: "ubuntu/focal64"
python_version: "3.8"
mongodb_version: "4.4"
steps:
- uses: actions/checkout@v2
- name: Cache Vagrant boxes
uses: actions/cache@v2
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-ubuntu-${{ matrix.vm_image }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Clone StackStorm/st2 repo
run: |
git clone https://github.com/StackStorm/st2.git /tmp/st2
- name: Run vagrant up
# env:
# ANSIBLE_DEBUG: "true"
run: |
sed -i".bak" -E -e "s#ubuntu/bionic64#${{ matrix.vm_image }}#g" Vagrantfile
sed -i".bak" -E -e "s#PYTHON_VERSION = \"3.6\"#PYTHON_VERSION = \"${{ matrix.python_version }}\"#g" Vagrantfile
sed -i".bak" -E -e "s#MONGODB_VERSION = \"4.0\"#MONGODB_VERSION = \"${{ matrix.mongodb_version }}\"#g" Vagrantfile
sed -i".bak" -E -e "s#\.\./st2#/tmp/st2#g" Vagrantfile
cat Vagrantfile
vagrant up
# NOTE: vagrant ssh -c exists with the same exit code as command which is ran in the VM
- name: Verify Software Versions And Running Processes
run: |
vagrant ssh -c "/vagrant/scripts/ci/verify-provision.sh ${{ matrix.python_version }} ${{ matrix.mongodb_version }}"
- name: Verify Create Virtualenv and Run Tests
run: |
# NOTE: To speed this step in theory we could use shared folder on host and cache
# ~/.cache/pip on guest
# Verify we can create virtualenv
vagrant ssh -c "cd ~/st2 ; make requirements"
# Verify we can run tests - NOTE: This will fail for 3.8 until StackStorm/st2 PR is merged
vagrant ssh -c "cd ~/st2 ; nosetests -s -v st2api/tests/unit/controllers/v1/test_actions.py"
slack-notification:
name: Slack notification for failed master builds
if: always()
needs:
- ansible-lint
- vagrant-up
runs-on: ubuntu-latest
steps:
- name: Workflow conclusion
# this step creates an environment variable WORKFLOW_CONCLUSION and is the most reliable way to check the status of previous jobs
uses: technote-space/workflow-conclusion-action@v2
- name: CI Run Failure Slack Notification
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' && github.ref == 'refs/heads/master' }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: development
status: FAILED
color: danger