Skip to content

Commit

Permalink
PI-264 Add Github Action to test Django scaffold on PRs (#802)
Browse files Browse the repository at this point in the history
* PI-264

* Test: run cookiecutter in gh action

* missing |

* create temp folder for cookiecutter

* remove pre-creation

* fix: wrong indent

* remove existing dir

* list

* Use current branch as input

* missing params

* wrong format

* wrong path to run tests

* wrong path

* setup python version

* install  req.txt

* tst"

* use pipenv

* set workingdir

* install dependecncies

* add secret key value for testing

* fix indent

* use envvar for SECRET_KEY

* add: dynamic branch for cookiecutter

* use head_ref

* verify head ref

* verify head ref

* remove: head ref echo

* refactor: test key value & remove owner_email
  • Loading branch information
cruz636 authored Aug 29, 2024
1 parent b9607d9 commit 8bdd56d
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: test-scaffold-updates

on:
pull_request:
branches:
- develop

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Cookiecutter
run: pip install cookiecutter

- name: Install Pipenv
run: |
python -m pip install --upgrade pip
pip install pipenv
- name: Scaffold a new project with Cookiecutter
run: |
pipenv run cookiecutter https://github.com/crowdbotics/django-scaffold \
--checkout ${{ github.head_ref }} \
--no-input --output-dir tmp_cookiecutter_output \
project_name="Test project" \
project_generated_name="test-project" \
- name: Install Scaffold dependencies
working-directory: tmp_cookiecutter_output/testproject
run: |
pipenv install
- name: Run Scaffold tests
working-directory: tmp_cookiecutter_output/testproject
env:
SECRET_KEY: "thisisasimplekey"
run: |
pipenv run python manage.py migrate
pipenv run python manage.py test

0 comments on commit 8bdd56d

Please sign in to comment.