This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
chore(deps): update ci dependencies #348
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
name: Quality checks 👌🧪 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
- develop | |
merge_group: | |
env: | |
DEBUG: True | |
KEY: ${{ secrets.OCIAL_KEY }} | |
DB_NAME: ocialdb | |
DB_USERNAME: ${{ secrets.OCIAL_USER }} | |
DB_PASSWORD: ${{ secrets.OCIAL_PASSWORD }} | |
DB_HOST: 127.0.0.1 | |
DB_PORT: 5432 | |
jobs: | |
dependency-review: | |
name: Vulnerable dependencies 🔎 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/[email protected] | |
with: | |
show-progress: false | |
- name: Scan | |
uses: actions/[email protected] | |
with: | |
## Workaround from https://github.com/actions/dependency-review-action/issues/456 | |
## TODO: Remove when necessary | |
base-ref: ${{ github.event.pull_request.base.sha || 'master' }} | |
head-ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
run: | |
name: Run 🏃♂️ | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: ocialdb | |
POSTGRES_USER: ${{ secrets.OCIAL_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.OCIAL_PASSWORD }} | |
ports: | |
- 5432:5432 | |
# Necesario porque el contenedor no tiene comprobaciones de su salud | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout ⬇️ | |
uses: actions/[email protected] | |
with: | |
show-progress: false | |
- name: Setup Python 🐍 | |
uses: actions/[email protected] | |
with: | |
python-version: '3.x' | |
check-latest: true | |
- name: Install dependencies 📦 | |
run: pip install -r requirements.txt | |
- name: Perform migrations 🗃️ | |
run: python ./manage.py migrate | |
- name: Run Django Server 🏃♂️ | |
run: | | |
python manage.py runserver & | |
sleep 10 # Espera a que el servidor esté listo | |
- name: Check server 🩺 | |
run: | | |
curl -I http://127.0.0.1:8000/ | |
sudo pkill python | |
test: | |
name: Test backend 👨🔬 | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
DEBUG: True | |
POSTGRES_DB: ocialdb | |
POSTGRES_USER: ${{ secrets.OCIAL_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.OCIAL_PASSWORD }} | |
ports: | |
- 5432:5432 | |
# Necesario porque el contenedor no tiene comprobaciones de su salud | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout ⬇️ | |
uses: actions/[email protected] | |
with: | |
show-progress: false | |
- name: Setup Python 🐍 | |
uses: actions/[email protected] | |
with: | |
python-version: '3.x' | |
check-latest: true | |
- name: Install dependencies 📦 | |
run: pip install -r requirements.txt | |
- name: Perform tests ⚒️ | |
run: python ./manage.py test | |
pr_context: | |
name: Save PR context as artifact | |
if: ${{ always() && !cancelled() && github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
## Add needed jobs here | |
needs: | |
- dependency-review | |
- test | |
- run | |
steps: | |
- name: Save PR context | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
PR_SHA: ${{ github.sha }} | |
run: | | |
echo $PR_NUMBER > PR_number | |
echo $PR_SHA > PR_sha | |
- name: Upload PR number as artifact | |
uses: actions/[email protected] | |
with: | |
compression-level: 0 | |
name: PR_context | |
path: | | |
PR_number | |
PR_sha | |
conventional_commits: | |
name: Conventional commits check 💬 | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ⬇️ | |
uses: actions/[email protected] | |
with: | |
show-progress: false | |
fetch-depth: 0 | |
- name: Check if all commits comply with the specification | |
uses: webiny/[email protected] | |
no_merge_commits: | |
name: No merge commits check 🚫 | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ⬇️ | |
uses: actions/[email protected] | |
with: | |
show-progress: false | |
fetch-depth: 0 | |
- name: Check commits | |
uses: greenled/[email protected] |