Skip to content

Merge pull request #2 from heig-tin-info/dependabot/github_actions/do… #34

Merge pull request #2 from heig-tin-info/dependabot/github_actions/do…

Merge pull request #2 from heig-tin-info/dependabot/github_actions/do… #34

Workflow file for this run

name: Build and Deploy
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage pytest pytest-cov flake8 tox tox-gh-actions setuptools setuptools_scm
- name: Lint with flake8
run: flake8 StudentScore --count --show-source --statistics
- name: Test with tox
run: tox
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@master
- run: git fetch --prune --unshallow
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 setuptools setuptools_scm
- name: Create Dist
run: python setup.py sdist
- uses: actions/upload-artifact@v2
with:
name: release
path: dist
if-no-files-found: error
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
deploy:
runs-on: ubuntu-latest
needs: release
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Download artifacts
uses: actions/[email protected]
with:
name: release
path: dist/
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_token }}