Skip to content

Commit

Permalink
feat: create python-app.yaml
Browse files Browse the repository at this point in the history
- Also add testing dependencies in poetry.
  • Loading branch information
dupuy committed Mar 4, 2024
1 parent 11e6ab1 commit 2d67f4e
Show file tree
Hide file tree
Showing 3 changed files with 273 additions and 2 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/python-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# This workflow will install Python dependencies and upload build artifacts to GitHub.
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: 'Build and upload Python app'

on:
push:
branches: ['main']
pull_request:
branches: ['main']

# Declare default permissions as read only.
permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 'Checkout repository'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
fetch-tags: true

- name: 'Get tag-based commit name'
run: 'TAG=$(git describe --tags) && echo "commitTag=$TAG" >> $GITHUB_ENV'

- name: 'Install Poetry'
run: 'pipx install poetry'

- name: 'Set up Python'
id: setup-python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: '>=3.9 <3.13'
cache: 'poetry'

- name: 'Build distribution packages'
run: 'poetry build'

- name: 'Upload distribution packages'
id: upload-artifact
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: 'dist-reliabot-${{ env.commitTag }}-${{ steps.setup-python.outputs.python-version }}'
path: 'dist/'
if-no-files-found: error
overwrite: true

test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'

steps:
- name: 'Checkout repository'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 1
fetch-tags: false

- name: 'Install Poetry'
run: 'pipx install poetry'

- name: 'Set up Python'
id: setup-python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: '${{ matrix.python-version }}'
cache: 'poetry'

- name: 'Install dependencies'
run: 'poetry install --extras re2-wheels --with testing'

- name: 'Run tests with coverage'
run: 'tox -e py'

# https://github.com/softprops/action-gh-release
182 changes: 180 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ python = "^3.8" # 3.8 end-of-life 2024-10
pyre2 = { version = "^0.3.6", optional = true }
pyre2-updated = { version = "^0.3.8", optional = true }

[tool.poetry.group.testing]
optional = true

[tool.poetry.group.testing.dependencies]
tox = "^4.13.0"

[tool.poetry.extras]
re2 = ["pyre2"]
re2-wheels = ["pyre2-updated"]
Expand Down

0 comments on commit 2d67f4e

Please sign in to comment.