Fix Github test action #53
Workflow file for this run
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
on: | |
push: | |
branches: [main, actions] | |
pull_request: | |
branches: [main, actions] | |
name: Test | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: 3.8 | |
- name: python --version | |
run: | | |
python --version | |
python3 --version | |
- name: Setup protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: "3.17.3" | |
- name: protoc --version | |
run: protoc --version | |
# Perma-cache Poetry since we only need it for checking pyproject version | |
- name: Cache Poetry | |
id: cache-poetry | |
uses: actions/[email protected] | |
with: | |
path: ~/.poetry | |
key: poetry | |
# Only runs when key from caching step changes | |
- name: Install latest version of Poetry | |
if: steps.cache-poetry.outputs.cache-hit != 'true' | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
# Poetry still needs to be re-prepended to the PATH on each run, since | |
# PATH does not persist between runs. | |
- name: Add Poetry to $PATH | |
run: | | |
echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
- name: Get Poetry version | |
run: poetry --version | |
- name: Check pyproject.toml validity | |
run: poetry check --no-interaction | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/[email protected] | |
with: | |
path: ${{github.workspace}}/.venv | |
key: deps-${{ hashFiles('**/poetry.lock') }} | |
- name: Install deps | |
if: steps.cache-deps.cache-hit != 'true' | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry install --no-interaction | |
- name: Run tests | |
run: poetry run pytest --ignore=samples/ -v | |
- name: Build artifacts | |
run: poetry build |