| 1 |
on: |
| 2 |
push: |
| 3 |
schedule: |
| 4 |
- cron: '0 3 * * 6' |
| 5 |
|
| 6 |
jobs: |
| 7 |
check: |
| 8 |
name: "Check" |
| 9 |
runs-on: ubuntu-latest |
| 10 |
steps: |
| 11 |
- uses: actions/checkout@v2 |
| 12 |
- uses: actions/setup-python@v2 |
| 13 |
with: |
| 14 |
python-version: "3.x" |
| 15 |
- name: 'Install Dependencies' |
| 16 |
run: | |
| 17 |
python -m pip install --upgrade pip |
| 18 |
python -m pip install pipenv |
| 19 |
pipenv install --system --dev |
| 20 |
python -m pip install . |
| 21 |
- name: 'Check Formatting (flake8)' |
| 22 |
run: flake8 nsw_fuel nsw_fuel_tests |
| 23 |
- name: 'Check Types' |
| 24 |
run: mypy --strict nsw_fuel |
| 25 |
|
| 26 |
build: |
| 27 |
name: "Build and Test" |
| 28 |
runs-on: ubuntu-latest |
| 29 |
strategy: |
| 30 |
matrix: |
| 31 |
python-version: [3.8, 3.9, 3.x] |
| 32 |
|
| 33 |
steps: |
| 34 |
- uses: actions/checkout@v2 |
| 35 |
- uses: actions/setup-python@v2 |
| 36 |
with: |
| 37 |
python-version: ${{ matrix.python-version }} |
| 38 |
- name: 'Install Dependencies' |
| 39 |
run: | |
| 40 |
python -m pip install --upgrade pip |
| 41 |
python -m pip install pipenv wheel |
| 42 |
pipenv install --system --dev |
| 43 |
python -m pip install . |
| 44 |
- name: 'Run Tests (with coverage)' |
| 45 |
run: | |
| 46 |
coverage run --source=nsw_fuel setup.py test |
| 47 |
- uses: codecov/codecov-action@v2 |
| 48 |
if: ${{ matrix.python-version == '3.x' }} |
| 49 |
- name: "Build" |
| 50 |
run: | |
| 51 |
sed -i "s/0.0.0-dev/$(git describe --tags --exact-match)/" nsw_fuel/__init__.py |
| 52 |
python setup.py sdist bdist_wheel |
| 53 |
- uses: actions/upload-artifact@v2 |
| 54 |
# Only publish artifacts from Python latest build. |
| 55 |
if: ${{ matrix.python-version == '3.x' }} |
| 56 |
with: |
| 57 |
name: dist |
| 58 |
path: dist/ |
| 59 |
if-no-files-found: error |
| 60 |
|
| 61 |
release: |
| 62 |
name: "Release 🚀" |
| 63 |
runs-on: ubuntu-latest |
| 64 |
needs: |
| 65 |
- build |
| 66 |
- check |
| 67 |
if: startsWith(github.ref, 'refs/tags') |
| 68 |
steps: |
| 69 |
- uses: actions/download-artifact@v2 |
| 70 |
with: |
| 71 |
name: dist |
| 72 |
path: dist/ |
| 73 |
- name: Release to PyPi 📦 |
| 74 |
uses: pypa/gh-action-pypi-publish@master |
| 75 |
with: |
| 76 |
password: ${{ secrets.PYPI_API_TOKEN }} |
| 77 |
- name: Create Github Release |
| 78 |
uses: softprops/action-gh-release@v1 |
| 79 |
with: |
| 80 |
generate_release_notes: true |