Merge branch 'doc' #71
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: [ "*" ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build_app: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements-dev.txt | |
- name: Check PEP8 | |
run: | | |
python -m flake8 | |
- name: Run tests | |
env: | |
OC_LETTING_SK: ${{ secrets.OC_LETTING_SK }} | |
DJANGO_DEBUG: 1 | |
run: pytest --cov-config=setup.cfg --cov=. --cov-fail-under=80 | |
build_docker: | |
needs: build_app | |
runs-on: ubuntu-latest | |
if: github.event.ref == 'refs/heads/master' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log into Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
run: | | |
# build and push the image tagged with commit hash | |
docker build \ | |
--push \ | |
--tag tmenanteau/oc_lettings:${{ github.sha }} \ | |
--build-arg OC_LETTING_SENTRY_KEY="${{ secrets.OC_LETTING_SENTRY_KEY }}" \ | |
--build-arg OC_LETTING_SK="${{ secrets.OC_LETTING_SK }}" \ | |
. | |
# tag the image as the latest version | |
docker tag tmenanteau/oc_lettings:${{ github.sha }} tmenanteau/oc_lettings:latest | |
docker push tmenanteau/oc_lettings:latest | |
deploy: | |
needs: build_docker | |
runs-on: ubuntu-latest | |
if: github.event.ref == 'refs/heads/master' | |
steps: | |
- name: deploy | |
run: | | |
curl "${{ secrets.RENDER_DEPLOY_HOOK_URL }}" |