chore(ci): Adding release step and semantic versioning #49
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: files | |
env: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
on: | |
push: | |
paths: | |
- "**" | |
- ".github/workflows/files.yml" | |
defaults: | |
run: | |
working-directory: ./ | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
lint: | |
name: Lint | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- run: pip install -e .[dev] | |
- run: python -m ruff . | |
- run: python -m mypy --strict . | |
test: | |
name: Unit tests | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: arn:aws:iam::654654529166:role/numerous-files-test | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: eu-north-1 | |
- name: Debug Session Info | |
run: aws sts get-caller-identity | |
- name: run tests | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- run: pip install -e .[dev] | |
- run: coverage run -m pytest -vv tests/ | |
env: | |
NUMEROUS_FILES_AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
NUMEROUS_FILES_AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- run: coverage report | grep 'TOTAL' | awk '{print "COVERAGE_PCT=" $4}' >> $GITHUB_ENV | |
# TODO: publish coverage report | |
build: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
name: Build package | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- uses: actions/setup-go@v5 | |
with: | |
cache: false | |
- run: python3 -m pip install python-semantic-release==9.6.0 build>=1.2.1 | |
- run: semantic-release version --no-commit --no-tag --no-push --no-changelog # update version locally to build new version | |
- run: make package | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: package | |
path: ./dist/* | |
release: | |
if: github.ref == 'refs/heads/main' | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
name: Release | |
needs: | |
- lint | |
- test | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- uses: actions/download-artifact@v4 | |
id: download | |
with: | |
name: package | |
path: ./dist | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache: false | |
- run: pip install python-semantic-release==9.6.0 twine==5.0.0 | |
- run: semantic-release version --commit --tag --push | |
- run: semantic-release publish | |
- run: twine upload --skip-existing --non-interactive dist/* |