Skip to content

Commit 8bdd56d

Browse files
authored
PI-264 Add Github Action to test Django scaffold on PRs (#802)
* 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
1 parent b9607d9 commit 8bdd56d

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: test-scaffold-updates
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out the code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.9'
20+
21+
- name: Install Cookiecutter
22+
run: pip install cookiecutter
23+
24+
- name: Install Pipenv
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pipenv
28+
29+
- name: Scaffold a new project with Cookiecutter
30+
run: |
31+
pipenv run cookiecutter https://github.com/crowdbotics/django-scaffold \
32+
--checkout ${{ github.head_ref }} \
33+
--no-input --output-dir tmp_cookiecutter_output \
34+
project_name="Test project" \
35+
project_generated_name="test-project" \
36+
37+
- name: Install Scaffold dependencies
38+
working-directory: tmp_cookiecutter_output/testproject
39+
run: |
40+
pipenv install
41+
42+
- name: Run Scaffold tests
43+
working-directory: tmp_cookiecutter_output/testproject
44+
env:
45+
SECRET_KEY: "thisisasimplekey"
46+
run: |
47+
pipenv run python manage.py migrate
48+
pipenv run python manage.py test

0 commit comments

Comments
 (0)