Merge pull request #477 from ets-cfuhrman-pfe/rename-workflows #1
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: Integration - Backend API Tests on Preprod | |
| on: | |
| push: | |
| branches: [ staging ] | |
| workflow_dispatch: | |
| jobs: | |
| api-tests: | |
| name: Run Backend API Integration Tests Against Preprod | |
| runs-on: [self-hosted, preprod] | |
| env: | |
| PREPROD_PATH: ${{ vars.PREPROD_PATH || '/opt/EvalueTonSavoir' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Verify runner environment | |
| run: | | |
| echo "=== Runner Information ===" | |
| echo "Runner OS: $RUNNER_OS" | |
| echo "Runner Architecture: $RUNNER_ARCH" | |
| echo "Runner Name: $RUNNER_NAME" | |
| echo "Runner Workspace: $RUNNER_WORKSPACE" | |
| echo "=== System Information ===" | |
| uname -a | |
| whoami | |
| pwd | |
| - name: Validate PREPROD_PATH | |
| run: | | |
| if [ ! -d "$PREPROD_PATH" ]; then | |
| echo "Error: PREPROD_PATH directory '$PREPROD_PATH' does not exist." | |
| echo "Please set the PREPROD_PATH variable in repository variables or ensure the default directory exists." | |
| exit 1 | |
| fi | |
| - name: Verify preprod environment is running | |
| run: | | |
| echo "Checking if preprod services are running..." | |
| if ! docker compose -f ${{ env.PREPROD_PATH }}/docker-compose.yaml ps | grep -q "Up"; then | |
| echo "ERROR: Preprod services are not running. Please start them before running this workflow." | |
| exit 1 | |
| fi | |
| echo "Preprod services are running:" | |
| docker compose -f ${{ env.PREPROD_PATH }}/docker-compose.yaml ps | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install server dependencies | |
| run: | | |
| cd server | |
| npm install | |
| - name: Create test auth config | |
| run: | | |
| cd server | |
| echo '{"auth": {"simpleauth": {"enabled": true}}}' > auth_config.json | |
| - name: Run API integration tests | |
| run: | | |
| cd server | |
| npm run test:api | |
| env: | |
| MONGO_URI: mongodb://localhost:27017/evaluetonsavoir | |
| MONGO_DATABASE: evaluetonsavoir | |
| JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
| SESSION_Secret: ${{ secrets.SESSION_SECRET }} | |
| NODE_ENV: test | |
| TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }} | |
| TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }} | |
| - name: Show API test logs on failure | |
| if: failure() | |
| run: | | |
| echo "=== Backend logs ===" | |
| docker logs backend --tail 50 | |
| echo "=== MongoDB logs ===" | |
| docker logs mongo --tail 20 |