change password api update #75
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: Tests | |
env: | |
COVERAGE_THRESHOLD: 95 | |
DOCKER_IMAGE_REPO: bandirom/django-template | |
on: | |
workflow_call: | |
push: | |
branches-ignore: | |
- master | |
tags-ignore: | |
- v* | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: "Build dev image" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Set environment docker tag | |
run: echo "DOCKER_TAG=${GITHUB_SHA::6}" >> $GITHUB_ENV | |
- name: Set environment docker image | |
run: echo "DOCKER_IMAGE=${{ env.DOCKER_IMAGE_REPO }}:${{ env.DOCKER_TAG }}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build dev version and export for testing | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: ${{ env.DOCKER_IMAGE }} | |
file: docker/dev/web/Dockerfile | |
outputs: type=docker,dest=/tmp/template.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: template-${{ env.DOCKER_TAG }} | |
path: /tmp/template.tar | |
test: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
env: | |
SECRET_KEY: dummy | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
POSTGRES_HOST: postgres | |
POSTGRES_PORT: 5432 | |
steps: | |
- name: Set environment docker tag | |
run: echo "DOCKER_TAG=${GITHUB_SHA::6}" >> $GITHUB_ENV | |
- name: Set environment docker image | |
run: echo "DOCKER_IMAGE=${{ env.DOCKER_IMAGE_REPO }}:${{ env.DOCKER_TAG }}" >> $GITHUB_ENV | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: template-${{ env.DOCKER_TAG }} | |
path: /tmp | |
- name: Load image | |
run: | | |
docker load --input /tmp/template.tar | |
- name: Migration check | |
run: docker run --entrypoint="" ${{ env.DOCKER_IMAGE }} python manage.py makemigrations --check | |
- name: Tests | |
run: docker run --entrypoint="" ${{ env.DOCKER_IMAGE }} pytest | |
services: | |
postgres: | |
image: postgres:15.1-alpine | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
POSTGRES_PASSWORD: postgres | |
test_isort: | |
runs-on: ubuntu-latest | |
steps: | |
- name: CheckOut Repo | |
uses: actions/checkout@v4 | |
- name: Run isort | |
run: | | |
pip install isort | |
cd web | |
isort . --check | |
test_black: | |
runs-on: ubuntu-latest | |
steps: | |
- name: CheckOut Repo | |
uses: actions/checkout@v4 | |
- name: Run black | |
id: tests | |
run: | | |
pip install black | |
cd web | |
black . --check | |
test_flake8: | |
runs-on: ubuntu-latest | |
steps: | |
- name: CheckOut Repo | |
uses: actions/checkout@v4 | |
- name: Run Flake8 | |
run: | | |
pip install flake8 | |
cd web | |
flake8 . |