Use dedicated setup for Github CI with .env.ci #1570
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 | |
on: [push] | |
defaults: | |
run: | |
working-directory: ./ | |
jobs: | |
run_tests: | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: mariadb:10.11 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_ROOT_PASSWORD: just-for-github-actions | |
MYSQL_DATABASE: greencheck | |
# rabbitmq | |
rabbitmq: | |
image: rabbitmq:3.8 | |
env: | |
RABBITMQ_USERNAME: "guest" | |
RABBITMQ_PASSWORD: "guest" | |
ports: | |
- 5672:5672 | |
options: '--hostname "rmq" --health-cmd "rabbitmqctl status" --health-interval 10s --health-timeout 10s --health-retries 3 --health-start-period 60s' | |
strategy: | |
matrix: | |
python-version: [3.11] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tooling for managing dependencies | |
run: | | |
python -m pip install --upgrade uv wheel | |
# - name: Set up a cache-key for installations of dependencies, in .venv | |
# id: cache-venv | |
# uses: actions/cache@v4 | |
# with: | |
# path: ./.venv | |
# key: ${{ runner.os }}-venv-${{ hashFiles('**/Pipfile.lock') }} | |
- name: Install dependencies | |
# skipping this check to see if we have a collision between cache keys | |
# when deploying versus running tests | |
# if: steps.cache-pipenv.outputs.cache-hit != 'true' | |
run: | | |
uv venv | |
uv pip install -r requirements/requirements.linux.generated.txt | |
- name: Run tests, explictly using the python version of dotenv | |
run: | | |
source .venv/bin/activate | |
pytest | |
env: | |
RUNNING_IN_CI: true |