CI #58
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 | |
on: | |
push: | |
branches: | |
# only on merges to master branch | |
- master | |
# and version branches, which only include minor versions (eg: v3.4) | |
- v[0-9]+.[0-9]+ | |
tags: | |
# also version tags, which include bugfix releases (eg: v3.4.0) | |
- v[0-9]+.[0-9]+.[0-9]+ | |
pull_request: | |
type: [opened, reopened, edited] | |
branches: | |
# Only for PRs targeting those branches | |
- master | |
- v[0-9]+.[0-9]+ | |
schedule: | |
# run every night at midnight | |
- 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-20.04 | |
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 }} | |
lint-tests: | |
needs: pre_job | |
if: "${{ needs.pre_job.outputs.should_skip != 'true' }}" | |
name: 'Lint checks - ${{ matrix.python-version }}' | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- python-version: 2.7 | |
tox-env: lint | |
- python-version: 3.6 | |
tox-env: lint | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox | |
- name: Run tests | |
run: | | |
tox -e ${{ matrix.tox-env }} | |
unit-tests: | |
needs: pre_job | |
if: "${{ needs.pre_job.outputs.should_skip != 'true' }}" | |
name: 'Unit tests - ${{ matrix.python-version }}' | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- python-version: 2.7 | |
tox-env: py27 | |
- python-version: 3.6 | |
tox-env: py36 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox | |
- name: Run tests | |
run: | | |
tox -e ${{ matrix.tox-env }} | |
integration-tests: | |
needs: pre_job | |
if: "${{ needs.pre_job.outputs.should_skip != 'true' }}" | |
name: 'Integration tests - ${{ matrix.python-version }}' | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- python-version: 2.7 | |
- python-version: 3.6 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox | |
- name: Run vagrant | |
run: | | |
sudo wget -nv https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_x86_64.deb | |
sudo dpkg -i vagrant_2.2.7_x86_64.deb | |
sudo rm /opt/vagrant/embedded/bin/ruby | |
sudo ln -s `which ruby` /opt/vagrant/embedded/bin/ruby | |
vagrant up | |
- name: Run tests | |
run: | | |
tox -e integration | |
env: | |
VAULT_TOKEN: st2token | |
VAULT_ADDR: http://127.0.0.1:8200 |