update CICD workflow after testing it on production #34
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: "Test: Create New Django Project" | |
on: | |
push: | |
branches: | |
- main | |
env: | |
PROJECT_NAME: init_test_github | |
PROJECT_IMAGE_NAME: "ghcr.io/asim3/${{ github.event.repository.name }}" | |
jobs: | |
docker_test: | |
runs-on: ubuntu-latest | |
name: Test on Docker | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create New Django Project | |
run: if [ -x ./setup/set-new-django-project.bash ]; then echo ${PROJECT_NAME} | make init; fi; | |
- name: Copy Env File | |
run: cp ${PROJECT_NAME}/.env.sample ${PROJECT_NAME}/.env | |
- name: Build Docker | |
run: > | |
GIT_REF=$(git rev-parse --verify HEAD); | |
docker image build --no-cache | |
-t ${PROJECT_IMAGE_NAME}:${GIT_REF} | |
. | |
- name: Run All Django Tests | |
run: > | |
GIT_REF=$(git rev-parse --verify HEAD); | |
docker container run --rm | |
-e DJANGO_SETTINGS_MODULE=${PROJECT_NAME}.settings.docker_dev | |
${PROJECT_IMAGE_NAME}:${GIT_REF} 'python3 manage.py test' | |
- name: Debug | |
run: > | |
ls -al ./; | |
ls -al ./init_test_github; | |
ls -al ./deploy; | |
ls -al ./.github/workflows; |