Add Makefile and README info for non-docker devs #40
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: Main | |
on: | |
[push, pull_request] | |
env: | |
DJANGO_SETTINGS_MODULE: hsf.test_settings | |
COMPOSE_INTERACTIVE_NO_CLI: 1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build dev containers | |
run: | | |
docker buildx create --use --driver=docker-container | |
docker buildx bake -f ./docker-compose.yml --set *.cache-to="type=gha,mode=max" --set *.cache-from="type=gha" --load | |
- name: Start containers | |
run: docker compose up -d | |
- name: Run tests | |
run: | | |
docker compose exec -T web poetry run flake8 ./main | |
docker compose exec -T web poetry run ./manage.py test | |
- name: Stop containers | |
if: always() | |
run: docker compose down | |
- name: Login to container registry | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push production container | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./docker/Dockerfile.prod | |
push: true | |
tags: ghcr.io/ukhackspacefoundation/website:latest | |
cache-to: type=gha,mode=max | |
cache-from: type=gha |