-
Notifications
You must be signed in to change notification settings - Fork 83
94 lines (76 loc) · 2.86 KB
/
ci-tests.yaml
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI Tests
on:
push:
pull_request:
types: [opened, reopened]
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-versions: ['3.6']
steps:
- uses: actions/checkout@v4 # https://github.com/actions/cache/releases
- name: Set up Python ${{ matrix.python-versions }}
uses: actions/setup-python@v5 # https://github.com/actions/setup-python/releases
with:
python-version: ${{ matrix.python-versions }}
- name: Install Pipenv
run: |
python -m pip install --upgrade pip
python -m pip install pipenv
- name: Install Dev Packages
run: |
pipenv install --deploy --dev
- name: Check minimum required Python version
run: |
pipenv vermin -q -t=${{ matrix.python-versions }}- --violations cis_audit.py
- name: Check linting with flake8
run: |
pipenv run flake8 *.py tests/*/*.py
- name: Check formatting with black
run: |
pipenv run black --check cis_audit.py tests/*/*.py
- name: Run unit tests with pytest
run: |
pipenv run pytest tests/unit
pipenv run coverage xml
#- name: Codecov
# uses: codecov/codecov-action@v4 # https://github.com/codecov/codecov-action/releases
#
# with:
# files: coverage.xml
integration-tests:
runs-on: macos-latest
needs: unit-tests
strategy:
fail-fast: false
matrix:
os: ['centos7']
if: ${{ false }} # disable for now
steps:
- uses: actions/checkout@v4 # https://github.com/actions/checkout/releases
- name: Cache Vagrant boxes
uses: actions/cache@v4 # https://github.com/actions/cache/releases
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-boxes-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-boxes-
- name: Cache Vagrant machines
uses: actions/cache@v4 # https://github.com/actions/cache/releases
with:
path: ~/VirtualBox VMs
key: ${{ runner.os }}-vagrant-machines-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-machines-
- name: Show Vagrant version
run: vagrant --version
- name: Run vagrant up
run: vagrant up ${{ matrix.os }}
- name: Run integration tests on ${{ matrix.os }}
run: vagrant ssh ${{ matrix.os }} -c 'cd /vagrant && sudo PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin /root/.local/bin/pytest tests/integration'