-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
192 additions
and
27 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Accessibility Test | ||
run-name: Checking Accessibility | ||
|
||
on: [push] | ||
|
||
jobs: | ||
accessibility: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Set up Docker | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Install Docker Compose | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
- name: Build and run Docker Compose for DB | ||
env: | ||
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} | ||
run: | | ||
docker-compose -f docker-compose.dev.yml up -d | ||
echo "Waiting for database to be ready..." | ||
sleep 30 | ||
- name: Run Prisma migrations | ||
env: | ||
DATABASE_URL: postgres://postgres:${{ secrets.DATABASE_PASSWORD }}@localhost:5433/patrigma_db | ||
run: | | ||
npx prisma migrate dev | ||
npx prisma db seed | ||
- name: Build Next.js application | ||
run: npm run build | ||
|
||
- name: Start Next.js application | ||
env: | ||
DATABASE_URL: postgres://postgres:${{ secrets.DATABASE_PASSWORD }}@localhost:5433/patrigma_db | ||
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} | ||
NEXTAUTH_URL: http://localhost:3000 | ||
run: | | ||
npm run start & # Start the Next.js application in the background | ||
echo "Waiting for Next.js to be ready..." | ||
sleep 10 | ||
- name: Install xvfb | ||
run: sudo apt-get install -y xvfb | ||
|
||
- name: Run Lighthouse CI with xvfb | ||
uses: treosh/lighthouse-ci-action@v12 | ||
with: | ||
urls: http://localhost:3000 | ||
uploadArtifacts: true | ||
env: | ||
XVFB_RUN_CMD: xvfb-run --auto-servernum --server-args='-screen 0 1024x768x24' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Build, Test, Release, and Publish | ||
run-name: Release and Publish Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- tesci | ||
|
||
env: | ||
VERSION: "" # Définition initiale de la variable | ||
|
||
jobs: | ||
test-app: | ||
name: Test App | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Docker Compose | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
create_release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
needs: test-app | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get version from package.json | ||
id: get_version | ||
run: | | ||
VERSION=$(jq -r .version package.json) | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
with: | ||
tag_name: "v${{ env.VERSION }}" | ||
release_name: "Release v${{ env.VERSION }}" | ||
draft: false | ||
prerelease: false | ||
|
||
build-docker-prod: | ||
runs-on: ubuntu-latest | ||
needs: [test-app, create_release] | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/${{ github.repository_owner }}/patrigma:v${{ env.VERSION }} # Utilisation de la variable VERSION globale | ||
labels: "version=${{ env.VERSION }},commit=${{ github.sha }}" | ||
|
||
notify: | ||
runs-on: ubuntu-latest | ||
needs: build-docker-prod | ||
steps: | ||
- name: Notify Discord on failure | ||
if: failure() | ||
uses: containrrr/shoutrrr-action@v1 | ||
with: | ||
url: ${{ secrets.NOTIFICATION_URL }} | ||
title: "Build Failed for Release v${{ env.VERSION }}" | ||
message: | | ||
The build for release v${{ env.VERSION }} has failed. | ||
Commit message: ${{ github.event.head_commit.message }} | ||
Commit SHA: ${{ github.sha }} | ||
- name: Notify Discord on success | ||
if: success() | ||
uses: containrrr/shoutrrr-action@v1 | ||
with: | ||
url: ${{ secrets.NOTIFICATION_URL }} | ||
title: "Build Succeeded for Release v${{ env.VERSION }}" | ||
message: | | ||
The build for release v${{ env.VERSION }} was successful. | ||
Commit message: ${{ github.event.head_commit.message }} | ||
Commit SHA: ${{ github.sha }} | ||
The Docker image has been published. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
services: | ||
patrigma_db: | ||
image: postgres:latest | ||
container_name: patrigma_db | ||
ports: | ||
- "5433:5432" | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD} | ||
POSTGRES_DB: patrigma_db | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres -d patrigma_db -h localhost -p 5432"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
volumes: | ||
postgres_data: |
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
This file was deleted.
Oops, something went wrong.
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
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