Skip to content

Commit

Permalink
DEVOPS: Add python setup commands (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-morandi-zupit authored May 8, 2023
1 parent 3aaa539 commit c048316
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/django-step-lint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
required: false
type: string
default: ""
SETUP_COMMANDS:
required: false
type: string
default: ""

env: "${{secrets}}"

Expand All @@ -46,6 +50,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup
run: ${{ inputs.SETUP_COMMANDS }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Copy env file
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/django-step-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ on:
required: false
type: boolean
default: true
SETUP_COMMANDS:
required: false
type: string
default: ""

env: "${{secrets}}"

Expand All @@ -44,6 +48,8 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Setup
run: ${{ inputs.SETUP_COMMANDS }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Copy env file
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/django-workflow-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
required: false
type: string
default: "coverage-django.xml"
SETUP_COMMANDS:
required: false
type: string
default: ""
# Workflow inputs
NATIVE_CI_LABELS:
required: true
Expand All @@ -40,6 +44,7 @@ jobs:
PYTHON_IMAGE: ${{inputs.PYTHON_IMAGE}}
RUN: ${{inputs.RUN}}
DJANGO_MIGRATIONS_CHECK_APPS: ${{inputs.DJANGO_MIGRATIONS_CHECK_APPS}}
SETUP_COMMANDS: ${{inputs.SETUP_COMMANDS}}
secrets: inherit

django-tests:
Expand All @@ -51,4 +56,5 @@ jobs:
PYTHON_IMAGE: ${{ inputs.PYTHON_IMAGE }}
COVERAGE_ARTIFACT_NAME: ${{ inputs.COVERAGE_ARTIFACT_NAME }}
RUN: ${{inputs.RUN}}
SETUP_COMMANDS: ${{ inputs.SETUP_COMMANDS }}
secrets: inherit
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ In addition, it is possible to specify this optional input:
- **COVERAGE_ARTIFACT_NAME**: The artifact's name for the _coverage-django.xml_ file. By default, it is **coverage-django.xml**.
- **RUN**: Whether to run all the inside workflows or not. This is useful when you want to skip checks since the code didn't change. By default, it is **true**.
- **DJANGO_MIGRATIONS_CHECK_APPS**: The Django apps on which to run migration checks.
- **SETUP_COMMANDS**: Allow to execute commands before the download of the dependencies. Useful to install packages required for Python dependencies.

This is an example to show how data should be formatted.

Expand All @@ -881,6 +882,7 @@ jobs:
NATIVE_CI_LABELS: "['pinga', 'pipeline', 'native']"
CONTAINER_CI_LABELS: "['pinga', 'pipeline', 'container']"
COVERAGE_ARTIFACT_NAME: coverage-django.xml
SETUP_COMMANDS: "apt update && apt install -y gcc"
secrets: inherit
```

Expand Down
12 changes: 12 additions & 0 deletions docs/GROUPED_STEP_WORKFLOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ It requires these inputs:
- **WORKING_DIRECTORY**: The directory where the runner can execute all the commands. This is basically the directory which contains the Django application.
- **PYTHON_IMAGE**: The Python Docker image where the runner execute all the commands

In addition, it is possible to specify this optional input:

- **SETUP_COMMANDS**: Allow to execute commands before the download of the dependencies. Useful to install packages required for Python dependencies.


In addition, it is possible to specify this optional input:
- RUN: Whether to run all the workflow or not. This is useful when you want to skip the workflow since the code didn't change. By default, it is **true**.

Expand All @@ -131,6 +136,7 @@ jobs:
LABELS: "['pinga', 'pipeline', 'container']"
WORKING_DIRECTORY: backend
PYTHON_IMAGE: python:3.8.2-slim-buster
SETUP_COMMANDS: "apt update && apt install -y gcc"
secrets: inherit
```

Expand All @@ -156,6 +162,11 @@ It requires these inputs:
- **PYTHON_IMAGE**: The Python Docker image where the runner execute all the commands
- **COVERAGE_ARTIFACT_NAME**: The artifact's name for the *coverage-django.xml* file.

In addition, it is possible to specify this optional input:

- **SETUP_COMMANDS**: Allow to execute commands before the download of the dependencies. Useful to install packages required for Python dependencies.


In addition, it is possible to specify this optional input:
- RUN: Whether to run all the workflow or not. This is useful when you want to skip the workflow since the code didn't change. By default, it is **true**.

Expand All @@ -170,6 +181,7 @@ jobs:
WORKING_DIRECTORY: backend
PYTHON_IMAGE: python:3.8.2-slim-buster
COVERAGE_ARTIFACT_NAME: coverage-django.xml
SETUP_COMMANDS: "apt update && apt install -y gcc"
secrets: inherit
```

Expand Down

0 comments on commit c048316

Please sign in to comment.