Skip to content

Commit 9b2d2ff

Browse files
committed
actions: add initial workflows
1 parent fbcea96 commit 9b2d2ff

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

.github/workflows/main.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- '**'
9+
pull_request:
10+
branches:
11+
- '**'
12+
13+
jobs:
14+
flake8:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Setup Python
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: 3.7
21+
architecture: x64
22+
- uses: actions/checkout@master
23+
- name: Install flake8
24+
run: pip install flake8
25+
- name: Run flake8
26+
uses: suo/flake8-github-action@releases/v1
27+
with:
28+
checkName: 'flake8'
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
black:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v1
36+
- name: Run Black
37+
uses: lgeiger/black-action@master
38+
with:
39+
args: --check crashtest/ tests/
40+
41+
tests:
42+
runs-on: ubuntu-latest
43+
strategy:
44+
max-parallel: 4
45+
matrix:
46+
python-version: [3.6, 3.7, 3.8]
47+
steps:
48+
- uses: actions/checkout@v2
49+
50+
- name: Set up Python ${{ matrix.python-version }}
51+
uses: actions/setup-python@v1
52+
with:
53+
python-version: ${{ matrix.python-version }}
54+
55+
- name: Get full Python version
56+
id: full-python-version
57+
shell: bash
58+
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
59+
60+
- name: Install poetry
61+
shell: bash
62+
run: |
63+
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
64+
python get-poetry.py -y
65+
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
66+
67+
- name: Configure poetry
68+
shell: bash
69+
run: poetry config virtualenvs.in-project true
70+
71+
- name: Set up cache
72+
uses: actions/cache@v2
73+
id: cache
74+
with:
75+
path: .venv
76+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
77+
78+
- name: Ensure cache is healthy
79+
if: steps.cache.outputs.cache-hit == 'true'
80+
shell: bash
81+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
82+
83+
- name: Install dependencies
84+
shell: bash
85+
run: poetry install
86+
87+
- name: Run pytest
88+
shell: bash
89+
run: poetry run pytest -v tests

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '**'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Set up Python 3.7
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.7
17+
- name: Install dependencies
18+
run: python -m pip install --upgrade pip poetry
19+
- name: Configure pypi credentials
20+
env:
21+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
22+
run: poetry config http-basic.pypi __token__ "$PYPI_API_TOKEN"
23+
- name: Publish release to pypi
24+
run: poetry publish --build

0 commit comments

Comments
 (0)