Skip to content

Commit

Permalink
add github action for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lilioid committed Feb 12, 2024
1 parent fd5b746 commit 27fa18c
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: test
on:
push:
branches: [ "*" ]

env:
artifact_name: test_project

jobs:
create-test-project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
sudo apt install cookiecutter pre-commit npm
pip install pipenv
npm install -g pnpm
- name: create project with cookiecutter
run: |
git config --global init.defaultBranch main
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
cookiecutter --no-input --output-dir /tmp ./ project_slug=github_test_project
- id: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: |
/tmp/github_test_project
!/tmp/github_test_project/**/node_modules
retention-days: 1

run-test-project:
runs-on: ubuntu-latest
needs: [ create-test-project ]
steps:
- name: install system dependencies
run: |
sudo apt install npm
pip install pipenv
npm install -g pnpm
- uses: actions/download-artifact@v4
with:
name: ${{ env.artifact_name }}
- run: ls src/
- name: install project dependencies
run: pipenv sync --dev
- name: manage.py --help
run: |
chmod +x ./src/manage.py
pipenv run ./src/manage.py --help
2 changes: 1 addition & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ def git_commit(message: str):
# lock & install dependencies
subprocess.check_call("pipenv lock".split(" "))
subprocess.check_call("pipenv sync".split(" "))
subprocess.check_call("pnpm install".split(" "), cwd="./src/{{ cookiecutter.project_slug }}_gui")
subprocess.check_call("pnpm install --no-frozen-lockfile".split(" "), cwd="./src/{{ cookiecutter.project_slug }}_gui")
git_commit("lock dependencies")
4 changes: 2 additions & 2 deletions {{ cookiecutter.project_slug }}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ repos:
- id: check-added-large-files

- repo: https://github.com/psf/black.git
rev: "23.11.0"
rev: "24.1.1"
hooks:
- id: black

- repo: https://github.com/PyCQA/isort.git
rev: "5.12.0"
rev: "5.13.2"
hooks:
- id: isort

0 comments on commit 27fa18c

Please sign in to comment.