-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
147 additions
and
19 deletions.
There are no files selected for viewing
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
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,30 @@ | ||
name: Setup Python Dependencies | ||
description: Loads python dependencies for a CI/CD job, install them if not cached | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: ASDF Tools Install | ||
uses: ./.github/actions/tools | ||
|
||
- name: Python Deps Cache | ||
uses: actions/cache@v3 | ||
id: python-cache | ||
with: | ||
path: ./.venv | ||
key: ${{ runner.os }}-python-deps-${{ hashFiles('**/requirements*.txt') }} | ||
|
||
- run: python3 -m venv .venv | ||
if: "!steps.python-cache.outputs.cache-hit" | ||
shell: bash | ||
|
||
- run: | | ||
source .venv/bin/activate | ||
echo "VIRTUAL_ENV=${VIRTUAL_ENV}" >> $GITHUB_ENV | ||
echo "${VIRTUAL_ENV}/bin" >> $GITHUB_PATH | ||
shell: bash | ||
- run: pip install -r requirements.txt -r requirements-dev.txt | ||
if: "!steps.python-cache.outputs.cache-hit" | ||
shell: bash | ||
|
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,24 @@ | ||
name: Setup ASDF Tools | ||
description: Loads ASDF tools for for a CI/CD job, installing them if not cached | ||
outputs: | ||
cache-hit: | ||
description: "Whether the ASDF cache was hit" | ||
value: ${{ steps.asdf-cache.outputs-cache-hit }} | ||
runs: | ||
using: composite | ||
steps: | ||
# cache the ASDF directory, using values from .tool-versions | ||
- name: ASDF Tools Cache | ||
uses: actions/cache@v3 | ||
id: asdf-cache | ||
with: | ||
path: ~/.asdf | ||
# runner.os vs CACHE_UUID secret | ||
key: ${{ runner.os}}-asdf-${{ hashFiles('**/.tool-versions') }} | ||
|
||
- name: Install ASDF Tools | ||
uses: asdf-vm/actions/install@v2 | ||
if: steps.asdf-cache.outputs.cache-hit != 'true' | ||
|
||
- name: Re-shim ASDF Install | ||
uses: mbta/actions/reshim-asdf@v1 |
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,67 @@ | ||
name: Continuous Integration (Python) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/**' | ||
- 'pyproject.toml' | ||
- 'requirements-dev.txt' | ||
- '.github/workflows/ci_python.yaml' | ||
- '.github/python_deps/action.yaml' | ||
pull_request: | ||
paths: | ||
- 'src/**' | ||
- 'pyproject.toml' | ||
- 'requirements-dev.txt' | ||
- '.github/workflows/ci_python.yaml' | ||
- '.github/python_deps/action.yaml' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: . | ||
|
||
concurrency: | ||
group: python-ci-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
setup: | ||
name: Python Setup | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/python_deps | ||
|
||
format: | ||
name: Format | ||
runs-on: ubuntu-22.04 | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/python_deps | ||
|
||
- run: ruff format --diff . | ||
|
||
typing: | ||
name: Type Check | ||
runs-on: ubuntu-22.04 | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/python_deps | ||
|
||
- run: mypy . | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-22.04 | ||
needs: setup | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/python_deps | ||
|
||
- run: ruff check --diff . | ||
|
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
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
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