👷(CI) configure Minio with the CI

Add the minio container to the CI on the
job test-back. Adapt the conf to have
Minio working with the backend.
This commit is contained in:
Anthony LC
2024-05-08 10:47:01 +02:00
committed by Anthony LC
parent b94f08d275
commit df0ff61faf
2 changed files with 38 additions and 6 deletions

View File

@@ -108,6 +108,7 @@ jobs:
- name: Set services env variables - name: Set services env variables
run: | run: |
make data/media
make create-env-files make create-env-files
cat env.d/development/common.e2e.dist >> env.d/development/common cat env.d/development/common.e2e.dist >> env.d/development/common

View File

@@ -93,8 +93,10 @@ jobs:
- name: Lint code with pylint - name: Lint code with pylint
run: ~/.local/bin/pylint impress run: ~/.local/bin/pylint impress
test-back: test-back:
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:
run: run:
working-directory: src/backend working-directory: src/backend
@@ -121,26 +123,55 @@ jobs:
DB_USER: dinum DB_USER: dinum
DB_PASSWORD: pass DB_PASSWORD: pass
DB_PORT: 5432 DB_PORT: 5432
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
AWS_S3_ENDPOINT_URL: http://localhost:9000
AWS_S3_ACCESS_KEY_ID: impress
AWS_S3_SECRET_ACCESS_KEY: password
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Create writable /data - name: Create writable /data
run: | run: |
sudo mkdir -p /data/media && \ sudo mkdir -p /data/media && \
sudo mkdir -p /data/static sudo mkdir -p /data/static
- name: Start Minio
run: |
docker pull minio/minio
docker run -d --name minio \
-p 9000:9000 \
-e "MINIO_ACCESS_KEY=impress" \
-e "MINIO_SECRET_KEY=password" \
-v /data/media:/data \
minio/minio server --console-address :9001 /data
- name: Configure MinIO
run: |
MINIO=$(docker ps | grep minio/minio | sed -E 's/.*\s+([a-zA-Z0-9_-]+)$/\1/')
docker exec ${MINIO} sh -c \
"mc alias set impress http://localhost:9000 impress password && \
mc alias ls && \
mc mb impress/impress-media-storage && \
mc version enable impress/impress-media-storage"
- name: Install Python - name: Install Python
uses: actions/setup-python@v3 uses: actions/setup-python@v3
with: with:
python-version: '3.10' python-version: '3.10'
- name: Install development dependencies - name: Install development dependencies
run: pip install --user .[dev] run: pip install --user .[dev]
- name: Install gettext (required to compile messages) - name: Install gettext (required to compile messages)
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y gettext sudo apt-get install -y gettext
- name: Generate a MO file from strings extracted from the project - name: Generate a MO file from strings extracted from the project
run: python manage.py compilemessages run: python manage.py compilemessages
- name: Run tests - name: Run tests
run: ~/.local/bin/pytest -n 2 run: ~/.local/bin/pytest -n 2