-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add workflows for plain python
- Loading branch information
1 parent
b4ee5f0
commit 6028b24
Showing
2 changed files
with
129 additions
and
0 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,76 @@ | ||
name: Lint and check a Django app | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
RUN_ON: | ||
required: false | ||
type: string | ||
default: 'zupit-agents' | ||
RUNNERS_CONTAINER_GROUP: | ||
required: false | ||
type: string | ||
default: 'Container' | ||
WORKING_DIRECTORY: | ||
required: true | ||
type: string | ||
PYTHON_IMAGE: | ||
required: true | ||
type: string | ||
RUN: | ||
required: false | ||
type: boolean | ||
default: true | ||
SETUP_COMMANDS: | ||
required: false | ||
type: string | ||
default: "" | ||
ENABLE_LFS: | ||
required: false | ||
type: boolean | ||
default: false | ||
# Workaround for https://github.com/actions/checkout/issues/1169 | ||
LFS_REPO_PATH: | ||
required: false | ||
type: string | ||
default: "" | ||
|
||
env: "${{secrets}}" | ||
|
||
jobs: | ||
python-linter: | ||
if: ${{ inputs.RUN }} | ||
runs-on: | ||
labels: ${{ inputs.RUN_ON }} | ||
group: ${{ inputs.RUNNERS_CONTAINER_GROUP }} | ||
container: ${{ inputs.PYTHON_IMAGE }} | ||
|
||
defaults: | ||
run: | ||
working-directory: ${{ inputs.WORKING_DIRECTORY }} | ||
|
||
steps: | ||
- name: Install prerequisites | ||
if: ${{ inputs.ENABLE_LFS == true }} | ||
run: apt-get update && apt-get install -y git-lfs | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
if: ${{ inputs.ENABLE_LFS == true }} | ||
with: | ||
lfs: 'true' | ||
- uses: actions/checkout@v4 | ||
if: ${{ inputs.ENABLE_LFS == false }} | ||
- name: Checkout LFS objects | ||
if: ${{ inputs.ENABLE_LFS == true }} | ||
run: git lfs pull | ||
- name: Setup | ||
run: ${{ inputs.SETUP_COMMANDS }} | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
- name: Copy env file | ||
run: cp .env.github .env | ||
- name: Lint with flake8 | ||
run: python -m flake8 . | ||
- name: Lint with black | ||
run: python -m black --check . | ||
|
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: Django common | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
# Projects inputs | ||
WORKING_DIRECTORY: | ||
required: true | ||
type: string | ||
PYTHON_IMAGE: | ||
required: true | ||
type: string | ||
SETUP_COMMANDS: | ||
required: false | ||
type: string | ||
default: "" | ||
# Workflow inputs | ||
RUN_ON: | ||
required: false | ||
type: string | ||
default: 'zupit-agents' | ||
RUNNERS_CONTAINER_GROUP: | ||
required: false | ||
type: string | ||
default: 'Container' | ||
RUN: | ||
required: false | ||
type: boolean | ||
default: true | ||
ENABLE_LFS: | ||
required: false | ||
type: boolean | ||
default: false | ||
# Workaround for https://github.com/actions/checkout/issues/1169 | ||
LFS_REPO_PATH: | ||
required: false | ||
type: string | ||
default: "" | ||
|
||
jobs: | ||
django-lint-check: | ||
uses: | ||
./.github/workflows/python-step-lint-check.yml | ||
with: | ||
RUN_ON: ${{inputs.RUN_ON}} | ||
RUNNERS_CONTAINER_GROUP: ${{inputs.RUNNERS_CONTAINER_GROUP}} | ||
WORKING_DIRECTORY: ${{inputs.WORKING_DIRECTORY}} | ||
PYTHON_IMAGE: ${{inputs.PYTHON_IMAGE}} | ||
RUN: ${{inputs.RUN}} | ||
SETUP_COMMANDS: ${{inputs.SETUP_COMMANDS}} | ||
ENABLE_LFS: ${{inputs.ENABLE_LFS}} | ||
LFS_REPO_PATH: ${{inputs.LFS_REPO_PATH}} | ||
secrets: inherit |