-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from schireson/dc/github-actions
- Loading branch information
Showing
6 changed files
with
165 additions
and
213 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: CI | ||
on: pull_request | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test-base: | ||
uses: ./.github/workflows/lint_and_test.yml | ||
with: | ||
install: poetry install | ||
lint: false | ||
run: poetry run make test-base | ||
python-versions: '["3.6"]' | ||
|
||
test: | ||
uses: ./.github/workflows/lint_and_test.yml | ||
with: | ||
install: make install | ||
run: poetry run make test | ||
python-versions: '["3.6", "3.7", "3.8", "3.9", "3.10"]' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Reusable lint and test workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
install: | ||
required: false | ||
type: string | ||
default: make install | ||
description: Command to run | ||
run: | ||
required: false | ||
type: string | ||
default: poetry run make test | ||
description: Command to run | ||
lint: | ||
required: false | ||
type: boolean | ||
default: true | ||
description: Whether to run linters | ||
python-versions: | ||
required: false | ||
type: string | ||
default: >- | ||
["3.9"] | ||
description: The python versions to utilize in workflow. | ||
sqlalchemy-versions: | ||
required: false | ||
type: string | ||
default: >- | ||
["1.3", "1.4"] | ||
description: The sqlalchemy versions to utilize in workflow. | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:9.6.10 | ||
env: | ||
POSTGRES_DB: dev | ||
POSTGRES_USER: user | ||
POSTGRES_PASSWORD: password | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
redis: | ||
image: redis:5.0.7 | ||
ports: | ||
- 6379:6379 | ||
mongo: | ||
image: mongo:3.6.12 | ||
ports: | ||
- 27017:27017 | ||
mysql: | ||
image: mysql:5.6 | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MYSQL_DATABASE: dev | ||
MYSQL_ROOT_PASSWORD: password | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ${{fromJson(inputs.python-versions)}} | ||
sqlalchemy-version: ${{fromJson(inputs.sqlalchemy-versions)}} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Run image | ||
uses: abatilo/actions-poetry@v2.0.0 | ||
with: | ||
poetry-version: 1.1.8 | ||
|
||
- name: Set up cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pypoetry/virtualenvs | ||
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-poetry- | ||
- name: Install dependencies | ||
run: ${{ inputs.install }} | ||
|
||
- name: Install dependencies | ||
run: pip install 'sqlalchemy==${{ matrix.sqlalchemy-version }}' | ||
|
||
- name: Run linters | ||
run: poetry run make lint | ||
|
||
- if: ${{ inputs.lint }} | ||
name: Run tests | ||
run: ${{ inputs.run }} | ||
|
||
- name: Store test result artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: coverage.xml | ||
|
||
- name: Codecov | ||
uses: codecov/codecov-action@v2 |
Oops, something went wrong.