Merge pull request #41 from hokus15/dependabot/github_actions/python-… #20
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
name: Test & Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
name: Python ${{ matrix.python-version }} tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
pip install -r requirements.txt | |
- name: Lint with flake8 | |
run: | | |
flake8 . | |
- name: Test with unittest | |
run: | | |
python -m unittest discover -s test -p "test_*.py" | |
release: | |
name: Semantic Release | |
runs-on: ubuntu-latest | |
concurrency: push | |
needs: test | |
permissions: | |
contents: write | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing in PyPi | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Python Semantic Release | |
id: release | |
uses: python-semantic-release/python-semantic-release@v9.8.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package distributions to GitHub Releases | |
id: github-release | |
uses: python-semantic-release/upload-to-gh-release@main | |
if: steps.release.outputs.released == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |