Merge pull request #23 from MSPRProject/nlauvray-patch-4 #25
This file contains hidden or 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
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| frontend-build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '21' | |
| - name: Install dependencies | |
| run: npm install | |
| working-directory: ./ | |
| - name: Run Angular unit tests | |
| run: npm run test -- --watch=false --browsers=ChromeHeadless | |
| working-directory: ./ | |
| - name: Build Angular app | |
| run: npm run build | |
| working-directory: ./ | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:latest | |
| env: | |
| POSTGRES_USER: sanalyz | |
| POSTGRES_PASSWORD: sanalyz | |
| POSTGRES_DB: sanalyz | |
| ports: | |
| - 5432:5432 | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Run tests | |
| run: mvn test | |
| working-directory: ./API | |
| gh-pages-deploy: | |
| runs-on: ubuntu-latest | |
| needs: frontend-build-and-test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '21' | |
| - name: Build Angular app | |
| run: | | |
| npm install | |
| npm run build | |
| working-directory: ./ | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./ | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: [test, frontend-build-and-test, gh-pages-deploy] | |
| steps: | |
| - name: Final deployment | |
| run: echo "✅ Deployment done" |