-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update submodules * add new words * add python test action * incase django is not used * fix syntax * use single quote * git and python actions * Install Graphviz * reorder steps * use sudo * refactor add-commit-push * use expression * go back * add condition * use @main * feedback
- Loading branch information
Showing
9 changed files
with
149 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: "Code for Life - Git - Add, Commit and Push" | ||
description: "Git add and, if there are differences, commit and push." | ||
inputs: | ||
add: | ||
description: "The changes to add." | ||
required: true | ||
commit-message: | ||
description: "The commit message. Prepended with 'chore: ' and post-pended with ' [skip ci]'." | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: ➕ Git Add | ||
shell: bash | ||
run: git add ${{ inputs.add }} | ||
|
||
- name: 🔄 Git Commit and Push | ||
shell: bash | ||
run: | | ||
# Only commit and push if there are differences. | ||
if ! git diff --staged --quiet; then | ||
git commit -m "chore: ${{ inputs.commit-message }} [skip ci]" | ||
git push | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: "Code for Life - Git - Setup Bot" | ||
description: "Sets up CFL's bot as the Git user." | ||
runs: | ||
using: composite | ||
steps: | ||
- name: ⚙️ Set up cfl-bot as Git user | ||
shell: bash | ||
run: | | ||
git config --local user.name cfl-bot | ||
git config --local user.email [email protected] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: "Code for Life - Python - Docs" | ||
description: "Documents python code written in the CFL workspace." | ||
inputs: | ||
python-version: | ||
description: "The python version to set up." | ||
required: true | ||
default: "3.8" | ||
working-directory: | ||
description: "The current working directory." | ||
required: true | ||
default: "." | ||
graph-django-models: | ||
description: "If there are Django models to graph." | ||
required: true | ||
default: "true" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: 🛫 Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: 🐍 Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: 🛠 Install Graphviz | ||
if: inputs.graph-django-models == 'true' | ||
shell: bash | ||
run: sudo apt-get install python3-dev graphviz libgraphviz-dev pkg-config | ||
|
||
- name: 🛠 Install Dependencies | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pipenv | ||
pipenv install --dev | ||
- name: 📈 Graph Django Models | ||
if: inputs.graph-django-models == 'true' | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} | ||
run: pipenv run python manage.py graph_models | ||
|
||
- uses: ocadotechnology/codeforlife-workspace/.github/actions/git/setup-bot@main | ||
if: inputs.graph-django-models == 'true' | ||
|
||
- uses: ocadotechnology/codeforlife-workspace/.github/actions/git/add-commit-push@main | ||
if: inputs.graph-django-models == 'true' | ||
with: | ||
add: docs/entity_relationship_diagram.png | ||
commit-message: "entity relationship diagram" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: "Code for Life - Python - Test" | ||
description: "Tests python code written in the CFL workspace." | ||
inputs: | ||
python-version: | ||
description: "The python version to set up." | ||
required: true | ||
default: "3.8" | ||
working-directory: | ||
description: "The current working directory." | ||
required: true | ||
default: "." | ||
check-django-migrations: | ||
description: "Check if there are pending Django migrations." | ||
required: true | ||
default: "true" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: 🛫 Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: 🐍 Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: 🛠 Install Dependencies | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pipenv | ||
pipenv install --dev | ||
- name: 🔎 Check Code Format | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} | ||
run: if ! pipenv run black --check .; then exit 1; fi | ||
|
||
# TODO: check static type hints with mypy | ||
|
||
# TODO: check linter error with pylint | ||
|
||
- name: 🔎 Check Django Migrations | ||
if: inputs.check-django-migrations == 'true' | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} | ||
run: pipenv run python manage.py makemigrations --check --dry-run | ||
|
||
- name: 🧪 Test Code Units | ||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} | ||
run: pipenv run pytest -n auto | ||
|
||
# TODO: assert code coverage target. |
Submodule codeforlife-package-python
updated
70 files
Submodule codeforlife-portal
updated
70 files
Submodule codeforlife-portal-react
updated
from 0e442c to e2f0de
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,7 +75,9 @@ | |
"cSpell.words": [ | ||
"codeforlife", | ||
"klass", | ||
"ocado" | ||
"ocado", | ||
"kurono", | ||
"pipenv" | ||
], | ||
}, | ||
"extensions": { | ||
|