-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
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 | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
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))") | ||
|
||
- 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" | ||
- name: Configure poetry | ||
shell: bash | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Set up cache | ||
uses: actions/cache@v2 | ||
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 | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: poetry install | ||
|
||
- name: Run pytest | ||
shell: bash | ||
run: poetry run pytest -v tests |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Install dependencies | ||
run: python -m pip install --upgrade pip poetry | ||
- name: Configure pypi credentials | ||
env: | ||
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
run: poetry config http-basic.pypi __token__ "$PYPI_API_TOKEN" | ||
- name: Publish release to pypi | ||
run: poetry publish --build |