This repository has been archived by the owner on May 3, 2024. It is now read-only.
forked from EGCETSII/decide
-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (118 loc) · 3.77 KB
/
decide.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Decide 🗳️
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
pull_request:
paths-ignore:
- "**/*.md"
merge_group:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- "**/*.md"
jobs:
test:
name: Pruebas unitarias 🧪
runs-on: ubuntu-latest
defaults:
run:
working-directory: decide
strategy:
fail-fast: false
matrix:
module:
- "authentication"
- "base"
- "booth"
- "census"
- "decide"
- "gateway"
- "mixnet"
- "postproc"
- "store"
- "test-scripts"
- "visualizer"
- "voting"
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: decide
POSTGRES_PASSWORD: decide
POSTGRES_DB: decide
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: Clonar ⬇️
uses: actions/checkout@v4.1.1
with:
show-progress: false
- name: Configurar Python 🐍
uses: actions/setup-python@v5.0.0
with:
python-version: '3.x'
check-latest: true
- name: Instalar dependencias 📦
run: |
sudo apt update
sudo apt install libpq-dev chromium-browser chromium-chromedriver
echo "pynose==1.4.8" >> ../requirements.txt
echo "selenium" >> ../requirements.txt
echo "coverage" >> ../requirements.txt
# Necesario a partir de Python 3.12: https://github.com/Becksteinlab/GromacsWrapper/issues/263#issue-1966724749
echo "setuptools" >> ../requirements.txt
pip install -r ../requirements.txt
cp local_settings.gactions.py local_settings.py
- name: Aplicar migraciones 🗃️
run: |
python manage.py migrate
- name: Ejecutar pruebas 🔬
run: |
python manage.py test ${{ matrix.module }}
docker:
name: Construir imágenes de Docker 💿💻
runs-on: ubuntu-latest
steps:
- name: Clonar ⬇️
uses: actions/checkout@v4.1.1
with:
show-progress: false
- name: Configurar QEMU ⚙️
if: ${{ github.event_name == 'push' }}
uses: docker/setup-qemu-action@v3.0.0
- name: Configurar Docker Buildx ⚙️
uses: docker/setup-buildx-action@v3.0.0
- name: Iniciar sesión en GitHub Container Registry 🔑
uses: docker/login-action@v3.0.0
if: ${{ github.event_name == 'push' }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.DECIDE_PROJECT_SECRET }}
- name: Construir y publicar imágenes de Docker 🛠️⬆️
uses: docker/build-push-action@v5.1.0
with:
context: .
file: packaging/docker/Dockerfile
push: ${{ github.event_name == 'push' }}
load: ${{ github.event_name == 'pull_request' }}
platforms: ${{ github.event_name == 'push' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
tags: |
ghcr.io/us-ferferga/decide:latest
- name: Extraer la imagen de Docker 📦
if: ${{ github.event_name == 'pull_request' }}
run: |
docker save ghcr.io/us-ferferga/decide:latest > docker_image.tar.gz
- name: Subir artefacto (imagen de Docker) ⬆️📦
uses: actions/upload-artifact@v4.0.0
if: ${{ github.event_name == 'pull_request' }}
with:
compression-level: 0
name: docker_image
path: |
docker_image.tar.gz