Resolve testing not running with the correct python version

This commit is contained in:
Trenton H 2023-01-06 08:00:09 -08:00
parent a0eecb83cf
commit 33e597f5bb

View File

@ -13,6 +13,10 @@ on:
branches-ignore: branches-ignore:
- 'translations**' - 'translations**'
env:
DEFAULT_PIP_ENV_VERSION: "2022.11.30"
DEFAULT_PYTHON_VERSION: "3.9"
jobs: jobs:
pre-commit: pre-commit:
name: Linting Checks name: Linting Checks
@ -21,13 +25,11 @@ jobs:
- -
name: Checkout repository name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- -
name: Install tools name: Install python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.9" python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
- -
name: Check files name: Check files
uses: pre-commit/action@v3.0.0 uses: pre-commit/action@v3.0.0
@ -41,29 +43,30 @@ jobs:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
-
name: Install pipenv
run: |
pipx install pipenv==2022.11.30
- -
name: Set up Python name: Set up Python
id: setup-python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: 3.8 python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
cache: "pipenv" cache: "pipenv"
cache-dependency-path: 'Pipfile.lock' cache-dependency-path: 'Pipfile.lock'
-
name: Install pipenv
run: |
pip install --user pipenv==${DEFAULT_PIP_ENV_VERSION}
- -
name: Install dependencies name: Install dependencies
run: | run: |
pipenv sync --dev pipenv --python ${{ steps.setup-python.outputs.python-version }} sync --dev
- -
name: List installed Python dependencies name: List installed Python dependencies
run: | run: |
pipenv run pip list pipenv --python ${{ steps.setup-python.outputs.python-version }} run pip list
- -
name: Make documentation name: Make documentation
run: | run: |
pipenv run mkdocs build --config-file ./mkdocs.yml pipenv --python ${{ steps.setup-python.outputs.python-version }} run mkdocs build --config-file ./mkdocs.yml
- -
name: Upload artifact name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@ -121,17 +124,18 @@ jobs:
run: | run: |
docker compose --file ${GITHUB_WORKSPACE}/docker/compose/docker-compose.ci-test.yml pull --quiet docker compose --file ${GITHUB_WORKSPACE}/docker/compose/docker-compose.ci-test.yml pull --quiet
docker compose --file ${GITHUB_WORKSPACE}/docker/compose/docker-compose.ci-test.yml up --detach docker compose --file ${GITHUB_WORKSPACE}/docker/compose/docker-compose.ci-test.yml up --detach
-
name: Install pipenv
run: |
pipx install pipenv==2022.11.30
- -
name: Set up Python name: Set up Python
id: setup-python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "${{ matrix.python-version }}" python-version: "${{ matrix.python-version }}"
cache: "pipenv" cache: "pipenv"
cache-dependency-path: 'Pipfile.lock' cache-dependency-path: 'Pipfile.lock'
-
name: Install pipenv
run: |
pip install --user pipenv==${DEFAULT_PIP_ENV_VERSION}
- -
name: Install system dependencies name: Install system dependencies
run: | run: |
@ -140,16 +144,17 @@ jobs:
- -
name: Install Python dependencies name: Install Python dependencies
run: | run: |
pipenv sync --dev pipenv --python ${{ steps.setup-python.outputs.python-version }} run python --version
pipenv --python ${{ steps.setup-python.outputs.python-version }} sync --dev
- -
name: List installed Python dependencies name: List installed Python dependencies
run: | run: |
pipenv run pip list pipenv --python ${{ steps.setup-python.outputs.python-version }} run pip list
- -
name: Tests name: Tests
run: | run: |
cd src/ cd src/
pipenv run pytest -ra pipenv --python ${{ steps.setup-python.outputs.python-version }} run pytest -ra
- -
name: Get changed files name: Get changed files
id: changed-files-specific id: changed-files-specific
@ -165,13 +170,13 @@ jobs:
done done
- -
name: Publish coverage results name: Publish coverage results
if: matrix.python-version == '3.9' && steps.changed-files-specific.outputs.any_changed == 'true' if: matrix.python-version == ${{ env.DEFAULT_PYTHON_VERSION }} && steps.changed-files-specific.outputs.any_changed == 'true'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/coveralls-clients/coveralls-python/issues/251 # https://github.com/coveralls-clients/coveralls-python/issues/251
run: | run: |
cd src/ cd src/
pipenv run coveralls --service=github pipenv --python ${{ steps.setup-python.outputs.python-version }} run coveralls --service=github
- -
name: Stop containers name: Stop containers
if: always() if: always()
@ -227,7 +232,7 @@ jobs:
name: Set up Python name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.9" python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
- -
name: Setup qpdf image name: Setup qpdf image
id: qpdf-setup id: qpdf-setup
@ -389,22 +394,22 @@ jobs:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
-
name: Install pipenv
run: |
pip3 install --upgrade pip setuptools wheel pipx
pipx install pipenv
- -
name: Set up Python name: Set up Python
id: setup-python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: 3.9 python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
cache: "pipenv" cache: "pipenv"
cache-dependency-path: 'Pipfile.lock' cache-dependency-path: 'Pipfile.lock'
-
name: Install pipenv + tools
run: |
pip install --upgrade --user pipenv==${DEFAULT_PIP_ENV_VERSION} setuptools wheel
- -
name: Install Python dependencies name: Install Python dependencies
run: | run: |
pipenv sync --dev pipenv --python ${{ steps.setup-python.outputs.python-version }} sync --dev
- -
name: Install system dependencies name: Install system dependencies
run: | run: |
@ -425,17 +430,17 @@ jobs:
- -
name: Generate requirements file name: Generate requirements file
run: | run: |
pipenv requirements > requirements.txt pipenv --python ${{ steps.setup-python.outputs.python-version }} requirements > requirements.txt
- -
name: Compile messages name: Compile messages
run: | run: |
cd src/ cd src/
pipenv run python3 manage.py compilemessages pipenv --python ${{ steps.setup-python.outputs.python-version }} run python3 manage.py compilemessages
- -
name: Collect static files name: Collect static files
run: | run: |
cd src/ cd src/
pipenv run python3 manage.py collectstatic --no-input pipenv --python ${{ steps.setup-python.outputs.python-version }} run python3 manage.py collectstatic --no-input
- -
name: Move files name: Move files
run: | run: |
@ -522,18 +527,17 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ref: main ref: main
-
name: Install pipenv
run: |
pip3 install --upgrade pip setuptools wheel pipx
pipx install pipenv
- -
name: Set up Python name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: 3.9 python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
cache: "pipenv" cache: "pipenv"
cache-dependency-path: 'Pipfile.lock' cache-dependency-path: 'Pipfile.lock'
-
name: Install pipenv + tools
run: |
pip install --upgrade --user pipenv==${DEFAULT_PIP_ENV_VERSION} setuptools wheel
- -
name: Append Changelog to docs name: Append Changelog to docs
id: append-Changelog id: append-Changelog