Merge pull request #32 from Selok/fix/failed-pipeline #179
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 | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
POETRY_VERSION: 1.8.5 | |
POETRY_PATH: poetry | |
PSR_VERSION: 7.28.1 | |
CACHE_NUMBER: 3 | |
# We cache the lint and security job, as there is no poetry install | |
jobs: | |
form: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Nox and Poetry | |
uses: ./.github/actions/setup_nox | |
with: | |
cache_number: ${{ env.CACHE_NUMBER }} | |
poetry_version: ${{ env.POETRY_VERSION }} | |
- name: Format | |
run: nox -s form | |
- name: Commit blackened files | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "style(*): blacken files" | |
default_author: github_actions | |
lint: | |
runs-on: ubuntu-latest | |
needs: [ form ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Nox and Poetry | |
uses: ./.github/actions/setup_nox | |
with: | |
cache_number: ${{ env.CACHE_NUMBER }} | |
poetry_version: ${{ env.POETRY_VERSION }} | |
- name: Check for Dependency Vulnerabilities | |
run: nox -s lint | |
type: | |
runs-on: ubuntu-latest | |
needs: [ form ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Nox and Poetry | |
uses: ./.github/actions/setup_nox | |
with: | |
cache_number: ${{ env.CACHE_NUMBER }} | |
poetry_version: ${{ env.POETRY_VERSION }} | |
- name: Check for Dependency Vulnerabilities | |
run: nox -s type | |
security: | |
runs-on: ubuntu-latest | |
needs: [ form ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Nox and Poetry | |
uses: ./.github/actions/setup_nox | |
with: | |
cache_number: ${{ env.CACHE_NUMBER }} | |
poetry_version: ${{ env.POETRY_VERSION }} | |
- name: Check for Dependency Vulnerabilities | |
run: nox -s security | |
test: | |
runs-on: ${{ matrix.os }} | |
needs: [ lint, type, security ] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Nox and Poetry | |
uses: ./.github/actions/setup_nox | |
with: | |
cache_number: ${{ env.CACHE_NUMBER }} | |
poetry_version: ${{ env.POETRY_VERSION }} | |
- name: "Add Poetry to PATH for windows" | |
if: matrix.os == 'windows-latest' | |
run: echo "POETRY_PATH=${HOME}/.local/bin/poetry.exe" >> $GITHUB_ENV | |
- name: Test Code and Docs | |
run: nox -s tests | |
- name: Upload to codecov | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
env_vars: ${{ matrix.os }} | |
fail_ci_if_error: true | |
verbose: true | |
release: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/main' }} | |
needs: [lint, test, security] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Upload to PyPI | |
uses: ./.github/actions/setup_psr | |
with: | |
gh_token: ${{ secrets.GITHUB_TOKEN }} | |
pypi_token: ${{ secrets.PYPI_TOKEN }} | |
cache_number: ${{ env.CACHE_NUMBER }} | |
poetry_version: ${{ env.POETRY_VERSION }} | |
psr_version: ${{ env.PSR_VERSION }} |