Skip to content

Commit

Permalink
fix: elegage massive de la ci
Browse files Browse the repository at this point in the history
desactiovation de la preprod, test de build only
  • Loading branch information
LightInn committed Aug 27, 2024
1 parent 7301795 commit 1d55cf5
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 142 deletions.
174 changes: 87 additions & 87 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,90 +58,90 @@ jobs:
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_URL=${{ vars.NEXT_PUBLIC_URL }}

tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Run copies of the current job in parallel. These need to be a
# continuous series of numbers, starting with `0`. If you change the
# number of containers, change TOTAL_RUNNERS below.
containers: [ 0, 1, 2, 3 ]
needs: build
steps:
- uses: actions/checkout@v4
- name: Cache next.js build
id: cache-npm
uses: actions/cache@v4
with:
path: .next/
key: ${{ runner.os }}-next-build-${{ hashFiles('src/','public/','next*','package*','jsconfig.json') }}
- name: List files
run: ls -la
- name: Add container env vars
run: echo "THIS_RUNNER=${{ matrix.containers }}" >> $GITHUB_ENV
- name: Cypress run
uses: cypress-io/github-action@v5
with:
start: npm run start
browser: chrome
wait-on: 'http://localhost:3000'
command: yarn node cypress/cypress-ci-run.mjs
record: true
env: ENV=production
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_URL=${{ vars.NEXT_PUBLIC_URL }}
NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }}
NEXT_PUBLIC_DATABASE_URL=${{ secrets.NEXT_PUBLIC_DATABASE_URL }}
NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }}
GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}
FACEBOOK_CLIENT_ID=${{ secrets.FACEBOOK_CLIENT_ID }}
FACEBOOK_CLIENT_SECRET=${{ secrets.FACEBOOK_CLIENT_SECRET }}
MAILGUN_API_KEY=${{ secrets.MAILGUN_API_KEY }}
MAILGUN_API_URL=${{ secrets.MAILGUN_API_URL }}
MAILGUN_PUBLIC_KEY=${{ secrets.MAILGUN_PUBLIC_KEY }}
MAILGUN_DOMAIN=${{ secrets.MAILGUN_DOMAIN }}
CYPRESS_TEST_USER=${{ secrets.TEST_USER }}
CYPRESS_TEST_PW=${{ secrets.TEST_PW }}
CYPRESS_NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_RETRIES=3
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
# add the line below to store screenshots only on failures
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
- uses: actions/upload-artifact@v4
# add the line below to store screenshots only on failures
if: failure()
with:
name: cypress-videos
path: cypress/videos
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
SonarQube:
environment: testing
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- uses: sonarsource/sonarqube-scan-action@master
with:
projectBaseDir: ./
args: >
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dproject.settings=./sonar-project.properties
-Dsonar.verbose=true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# If you wish to fail your job when the Quality Gate is red use the
# following lines. This would typically be used to fail a deployment.
- uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# tests:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# # Run copies of the current job in parallel. These need to be a
# # continuous series of numbers, starting with `0`. If you change the
# # number of containers, change TOTAL_RUNNERS below.
# containers: [ 0, 1, 2, 3 ]
# needs: build
# steps:
# - uses: actions/checkout@v4
# - name: Cache next.js build
# id: cache-npm
# uses: actions/cache@v4
# with:
# path: .next/
# key: ${{ runner.os }}-next-build-${{ hashFiles('src/','public/','next*','package*','jsconfig.json') }}
# - name: List files
# run: ls -la
# - name: Add container env vars
# run: echo "THIS_RUNNER=${{ matrix.containers }}" >> $GITHUB_ENV
# - name: Cypress run
# uses: cypress-io/github-action@v5
# with:
# start: npm run start
# browser: chrome
# wait-on: 'http://localhost:3000'
# command: yarn node cypress/cypress-ci-run.mjs
# record: true
# env: ENV=production
# NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
# NEXT_PUBLIC_URL=${{ vars.NEXT_PUBLIC_URL }}
# NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }}
# NEXT_PUBLIC_DATABASE_URL=${{ secrets.NEXT_PUBLIC_DATABASE_URL }}
# NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }}
# GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}
# GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}
# FACEBOOK_CLIENT_ID=${{ secrets.FACEBOOK_CLIENT_ID }}
# FACEBOOK_CLIENT_SECRET=${{ secrets.FACEBOOK_CLIENT_SECRET }}
# MAILGUN_API_KEY=${{ secrets.MAILGUN_API_KEY }}
# MAILGUN_API_URL=${{ secrets.MAILGUN_API_URL }}
# MAILGUN_PUBLIC_KEY=${{ secrets.MAILGUN_PUBLIC_KEY }}
# MAILGUN_DOMAIN=${{ secrets.MAILGUN_DOMAIN }}
# CYPRESS_TEST_USER=${{ secrets.TEST_USER }}
# CYPRESS_TEST_PW=${{ secrets.TEST_PW }}
# CYPRESS_NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
# CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}
# CYPRESS_RETRIES=3
# GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
# - uses: actions/upload-artifact@v4
# # add the line below to store screenshots only on failures
# if: failure()
# with:
# name: cypress-screenshots
# path: cypress/screenshots
# if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
# - uses: actions/upload-artifact@v4
# # add the line below to store screenshots only on failures
# if: failure()
# with:
# name: cypress-videos
# path: cypress/videos
# if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
# SonarQube:
# environment: testing
# runs-on: ubuntu-latest
# needs: tests
# steps:
# - uses: actions/checkout@v4
# - uses: sonarsource/sonarqube-scan-action@master
# with:
# projectBaseDir: ./
# args: >
# -Dsonar.python.coverage.reportPaths=coverage.xml
# -Dproject.settings=./sonar-project.properties
# -Dsonar.verbose=true
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
#
# # If you wish to fail your job when the Quality Gate is red use the
# # following lines. This would typically be used to fail a deployment.
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
52 changes: 0 additions & 52 deletions .github/workflows/deploy-preprod.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/deploy-preprod.yml.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#name: Build and Deploy on preprod
#
#env:
# NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
# NEXT_PUBLIC_URL: ${{ vars.NEXT_PUBLIC_URL }}
#
#on:
# push:
# branches: [main]
#
#jobs:
# build-and-push:
# runs-on: ubuntu-latest
# environment: pre-prod
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Use Node.js 20.x
# uses: actions/setup-node@v4
# with:
# cache: 'npm'
# node-version: 20.x
# - name: Install dependencies in production
# run: npm ci --ignore-scripts
# - name: Cache next.js build
# id: cache-npm
# uses: actions/cache@v4
# with:
# path: .next/
# key: ${{ runner.os }}-next-build-${{ hashFiles('src/','public/','next*','package*','jsconfig.json') }}
# - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
# name: Build the app
# continue-on-error: true
# run: npm run build
# - name: List files
# run: ls -la
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# push: true
# tags: ${{ secrets.APP_IMAGE }}
# build-args:
# NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
# NEXT_PUBLIC_URL=${{ vars.NEXT_PUBLIC_URL }}
# - name: Deploy on cap rover
# run: docker run caprover/cli-caprover:latest caprover deploy --caproverUrl "${{ secrets.APP_URL }}" --appToken "${{ secrets.APP_TOKEN }}" --caproverApp "${{ secrets.APP_NAME }}" --imageName "${{ secrets.APP_IMAGE }}"
9 changes: 6 additions & 3 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Build and Deploy on prod


env:
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_URL: ${{ vars.NEXT_PUBLIC_URL }}


on:
push:
tags:
- v*
- 'v*.*.*'

jobs:
build-and-push:
Expand Down Expand Up @@ -49,5 +51,6 @@ jobs:
build-args:
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_URL=${{ vars.NEXT_PUBLIC_URL }}
- name: Deploy on cap rover
run: docker run caprover/cli-caprover:latest caprover deploy --caproverUrl "${{ secrets.APP_URL }}" --appToken "${{ secrets.APP_TOKEN }}" --caproverApp "${{ secrets.APP_NAME }}" --imageName "${{ secrets.APP_IMAGE }}"
- name: Deploy to Coolify
run: |
curl --request GET '${{ secrets.COOLIFY_WEBHOOK }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'

0 comments on commit 1d55cf5

Please sign in to comment.