Merge pull request #138 from praekeltfoundation/bump_nginx #66
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build-no-wheelhouse: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python_version: ["3.10", "3.9", "3.8", "3.7"] | |
variant: [bullseye] | |
test_project: [django2] | |
env: | |
TAG: py${{ matrix.python_version }}-${{ matrix.variant }} | |
IMAGE: ghcr.io/praekeltfoundation/docker-django-bootstrap-nw:py${{ matrix.python_version }}-${{ matrix.variant }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: run tests | |
run: | | |
docker build -f Dockerfile.no-wheelhouse --pull --cache-from "$IMAGE" --build-arg PYTHON_VERSION="${{matrix.python_version}}-${{matrix.variant}}" --tag "$IMAGE" . | |
docker build -t "mysite:$TAG" --build-arg BASE_IMAGE="$IMAGE" --build-arg PROJECT="${{matrix.test_project}}" tests | |
pip install -r tests/requirements.txt | |
pytest -v tests/test.py --django-bootstrap-image="mysite:$TAG" | |
flake8 gunicorn/config.py | |
cd tests; flake8 | |
- uses: docker/setup-buildx-action@v2 | |
- name: construct image metadata | |
uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: | | |
ghcr.io/praekeltfoundation/docker-django-bootstrap-nw | |
tags: | | |
type=pep440,pattern=py{{major}},value=${{matrix.python_version}} | |
type=raw,value=py${{matrix.python_version}} | |
type=raw,value=${{matrix.variant}} | |
type=pep440,pattern=py{{major}}-${{matrix.variant}},value=${{matrix.python_version}} | |
type=raw,value=py${{matrix.python_version}}-${{matrix.variant}} | |
- name: login to ghcr | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile.no-wheelhouse | |
push: ${{github.event_name != 'pull_request'}} | |
tags: ${{steps.meta.outputs.tags}} | |
build-args: | | |
PYTHON_VERSION=${{matrix.python_version}}-${{matrix.variant}} |