update COMMIT_HASH #89
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 and Delivery | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test_app: | |
name: Testing the app | |
runs-on: ubuntu-latest | |
env: | |
SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
ALLOWED_HOSTS: ${{ secrets.ALLOWED_HOSTS }} | |
DEBUG: ${{ secrets.DEBUG }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Lint with flake8 | |
run: flake8 | |
- name: Run app tests | |
run: | | |
coverage run --source='.' --omit='oc_lettings_site/settings*','*/migrations/*' manage.py test --settings oc_lettings_site.settings-ci | |
coverage report --fail-under=80 | |
# create a job for updating the documentation | |
docker: | |
name: Docker | |
runs-on: ubuntu-latest | |
env: | |
SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
ALLOWED_HOSTS: ${{ secrets.ALLOWED_HOSTS }} | |
DEBUG: ${{ secrets.DEBUG }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
COMMIT_HASH: ${{ github.sha }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Build the Docker image | |
run: | | |
docker build -t oc_lettings . | |
docker images | |
- name: Tag the Docker image | |
run: docker tag oc_lettings:latest doridoro/oc_lettings_site:${COMMIT_HASH::7} | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push Docker image to Docker Hub | |
run: docker push doridoro/oc_lettings_site:${COMMIT_HASH::7} | |
# docker_actions: | |
# name: Docker | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
# | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
# | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# | |
# - name: Build and push | |
# uses: docker/build-push-action@v5 | |
# with: | |
# push: true | |
# tags: doridoro/oc_lettings_site:latest |