Run tests & publish image to Dockerhub #552
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: Run tests & publish image to Dockerhub | |
on: | |
release: | |
types: [published] | |
branches: | |
- master | |
tags: | |
- "v*" | |
push: | |
branches: | |
- master | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- master | |
schedule: | |
# Every day at 12:32 UTC. | |
- cron: "32 12 * * *" | |
# If you trigger a new workflow while the previous one is running, | |
# this will cancel the previous one. | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
run-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Use matrix strategy to run the tests on multiple Py versions on multiple OSs. | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ["3.9", "3.10", "3.11"] | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/pip | |
- os: macos-latest | |
path: ~/Library/Caches/pip | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install the Dependencies | |
run: | | |
echo "Installing the dependencies..." | |
python -m pip install -r requirements.txt | |
python -m pip install -r requirements-dev.txt | |
- name: Check Linter | |
run: | | |
echo "Checking linter formatting..." | |
make lint-check | |
- name: Run Tests | |
run: | | |
echo "Running the tests..." | |
cd app && python -m pytest -v -s |