Skip to content

Commit

Permalink
Update CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Jul 26, 2022
1 parent dbc3555 commit 10e2740
Showing 1 changed file with 26 additions and 42 deletions.
68 changes: 26 additions & 42 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,74 +11,58 @@ on:
- '**'

jobs:
flake8:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.7
architecture: x64
- uses: actions/checkout@master
- name: Install flake8
run: pip install flake8
- name: Run flake8
uses: suo/flake8-github-action@releases/v1
with:
checkName: 'flake8'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run Black
uses: lgeiger/black-action@master
with:
args: --check crashtest/ tests/

tests:
runs-on: ubuntu-latest
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8]
os: [Ubuntu, MacOS, Windows]
python-version: [3.7, 3.8, 3.9, "3.10"]

defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
shell: bash
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
run: |
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Install poetry
shell: bash
run: |
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
python get-poetry.py -y
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
curl -sL https://install.python-poetry.org | python - -y
- name: Update PATH
if: ${{ matrix.os != 'Windows' }}
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Update PATH for Windows
if: ${{ matrix.os == 'Windows' }}
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH

- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true
run: |
poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
shell: bash
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
run: imeout 10s poetry run pip --version || rm -rf .venv

- name: Install dependencies
shell: bash
Expand Down

0 comments on commit 10e2740

Please sign in to comment.