Upgrade Django to 4.2.5 and postgres:16 #74
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
name: CI | |
on: | |
push: | |
branches: [ master ] | |
tags: [ '**' ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
env: | |
COMPOSE_FILE: docker-compose_dev.yml | |
steps: | |
- uses: actions/checkout@v2 | |
- run: docker-compose up -d | |
- name: Wait for PostgreSQL | |
run: | | |
set +e | |
for i in {0..60}; do | |
docker-compose exec -T chris_store_dev_db psql -U chris -d chris_store_dev -c "select 1" 2> /dev/null | |
if [ "$?" = "0" ]; then | |
dbup=y | |
break | |
fi | |
sleep 2 | |
echo . | |
done | |
if [ "$dbup" != "y" ]; then | |
echo "::error ::Timed out waiting for PostgreSQL database." | |
exit 1 | |
fi | |
- name: Run all tests | |
run: docker-compose exec -T chris_store_dev python manage.py test | |
- run: docker-compose down -v | |
build: | |
needs: [ test ] | |
if: github.event_name == 'push' || github.event_name == 'release' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Get git tag | |
id: git_info | |
if: startsWith(github.ref, 'refs/tags/') | |
run: echo "::set-output name=tag::${GITHUB_REF##*/}" | |
- name: Determine image tags | |
id: determine | |
env: | |
git_tag: ${{ steps.git_info.outputs.tag }} | |
run: | | |
repo="${GITHUB_REPOSITORY,,}" # to lower case | |
tag="${git_tag:-latest}" # if build triggered by tag, use tag name | |
echo "::set-output name=repo::$repo" | |
echo "::set-output name=tag::$tag" | |
echo "::set-output name=dock_image::$repo:$tag" | |
- uses: actions/checkout@v2 | |
- uses: docker/setup-qemu-action@v1 | |
- uses: docker/setup-buildx-action@v1 | |
id: buildx | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: . | |
file: ./Dockerfile | |
tags: | | |
${{ steps.determine.outputs.dock_image }} | |
ghcr.io/${{ steps.determine.outputs.dock_image }} | |
platforms: linux/amd64,linux/ppc64le,linux/arm64 | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |