Fixed CI/CD and .env vars
Run Tests on Branches / Detect Changes (push) Successful in 13s
Run Tests on Branches / Backend Tests (push) Successful in 1m45s
Run Tests on Branches / Frontend Tests (push) Successful in 1m46s
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Has been skipped
Run Tests on Branches / PIP Platform Tests (push) Failing after 1m37s

This commit is contained in:
Antoni Nuñez Romeu
2026-07-16 18:10:17 +02:00
parent 8763f54071
commit cf087fc0b7
4 changed files with 163 additions and 16 deletions
+138 -15
View File
@@ -13,6 +13,7 @@ jobs:
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
parapharmacy-api: ${{ steps.filter.outputs.parapharmacy-api }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
@@ -25,6 +26,9 @@ jobs:
frontend:
- 'apps/frontend/**'
- 'packages/**'
parapharmacy-api:
- 'apps/parapharmacy-api/**'
- 'packages/**'
test-backend:
name: Backend Tests
@@ -46,6 +50,46 @@ jobs:
- name: Run tests
run: npm test --workspace=farma-clic-backend
test-parapharmacy-api:
name: Parapharmacy API Tests
needs: detect-changes
if: needs.detect-changes.outputs.parapharmacy-api == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Install parapharmacy-api native deps
run: npm rebuild sqlite3 bcrypt --workspace=farma-clic-parapharmacy-api
- name: Run Parapharmacy API Tests
run: npm test --workspace=farma-clic-parapharmacy-api
test-pip-platform:
name: Pip Platform Tests
needs: detect-changes
if: needs.detect-changes.outputs.backend == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Install pip-platform native deps
run: npm rebuild sqlite3 bcrypt --workspace=farma-clic-pip-platform
- name: Run Pip Platform Tests
run: npm test --workspace=farma-clic-pip-platform
test-frontend:
name: Frontend Tests
needs: detect-changes
@@ -90,6 +134,58 @@ jobs:
git.hacecalor.net/ichitux/farmafinder-backend:latest
git.hacecalor.net/ichitux/farmafinder-backend:${{ gitea.sha }}
build-parapharmacy-api:
name: Build Parapharmacy API
needs: [ detect-changes, test-parapharmacy-api ]
if: |
always() &&
needs.detect-changes.outputs.parapharmacy-api == 'true' &&
(needs.test-parapharmacy-api.result == 'success' || needs.test-parapharmacy-api.result == 'skipped')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea registry
uses: docker/login-action@v3
with:
registry: git.hacecalor.net
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push parapharmacy-api image
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/parapharmacy-api/Dockerfile
push: true
tags: |
git.hacecalor.net/ichitux/farmafinder-parapharmacy-api:latest
git.hacecalor.net/ichitux/farmafinder-parapharmacy-api:${{ gitea.sha }}
build-pip-platform:
name: Build Pip Platform
needs: [ detect-changes, test-pip-platform ]
if: |
always() &&
needs.detect-changes.outputs.backend == 'true' &&
(needs.test-pip-platform.result == 'success' || needs.test-pip-platform.result == 'skipped')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to Gitea registry
uses: docker/login-action@v3
with:
registry: git.hacecalor.net
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push pip-platform image
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/pip-platform/Dockerfile
push: true
tags: |
git.hacecalor.net/ichitux/farmafinder-pip-platform:latest
git.hacecalor.net/ichitux/farmafinder-pip-platform:${{ gitea.sha }}
build-frontend:
name: Build Frontend
needs: [ detect-changes, test-frontend ]
@@ -117,24 +213,51 @@ jobs:
deploy:
name: Deploy
needs: [ detect-changes, build-backend, build-frontend ]
needs: [ detect-changes, build-backend, build-frontend, build-parapharmacy-api, build-pip-platform ]
if: |
always() &&
(needs.build-backend.result == 'success' || needs.build-backend.result == 'skipped') &&
(needs.build-frontend.result == 'success' || needs.build-frontend.result == 'skipped') &&
(needs.build-parapharmacy-api.result == 'success' || needs.build-parapharmacy-api.result == 'skipped') &&
(needs.build-pip-platform.result == 'success' || needs.build-pip-platform.result == 'skipped') &&
(needs.detect-changes.outputs.backend == 'true' || needs.detect-changes.outputs.frontend == 'true')
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: SSH to remote server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cd /docker/FarmaFinder
git pull
docker compose pull
docker compose down --remove-orphans
docker compose up -d
- name: Pull latest code
working-directory: /docker/FarmaFinder
run: |
set -euo pipefail
git pull
- name: Sync .env files from .env.example
working-directory: /docker/FarmaFinder
run: |
set -euo pipefail
while IFS= read -r env_example; do
dir=$(dirname "$env_example")
env_file="$dir/.env"
if [ ! -f "$env_file" ]; then
cp "$env_example" "$env_file"
echo "[env-sync] Created $env_file from $env_example"
else
while IFS= read -r line || [ -n "$line" ]; do
case "$line" in
''|\#*) continue ;;
esac
key=$(echo "$line" | cut -d'=' -f1)
if ! grep -qF "$key=" "$env_file"; then
echo "$line" >> "$env_file"
echo "[env-sync] Added missing key '$key' to $env_file"
fi
done < "$env_example"
fi
done < <(find apps -name ".env.example" -type f)
- name: Deploy containers
working-directory: /docker/FarmaFinder
run: |
set -euo pipefail
docker compose pull
docker compose down --remove-orphans
docker compose up -d
+20
View File
@@ -108,3 +108,23 @@ jobs:
run: npm rebuild sqlite3 bcrypt --workspace=farma-clic-parapharmacy-api
- name: Run Parapharmacy API Tests
run: npm test --workspace=farma-clic-parapharmacy-api
test-pip-platform:
name: PIP Platform Tests
needs: detect-changes
if: needs.detect-changes.outputs.backend == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Install pip-platform native deps
run: npm rebuild sqlite3 bcrypt --workspace=farma-clic-pip-platform
- name: Run PIP Platform Tests
run: npm test --workspace=farma-clic-pip-platform