feat: enable React Compiler #2679
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 | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - 'master' | |
| concurrency: | |
| group: deploy-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| format: | |
| name: 💅 Check format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@main | |
| - uses: pnpm/action-setup@v4.2.0 | |
| name: Install pnpm | |
| - uses: actions/setup-node@main | |
| with: | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile --prefer-offline | |
| - run: pnpm fmt:check | |
| - run: pnpm lint | |
| nextjs: | |
| name: ⚛️ NextJS application | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@main | |
| - uses: pnpm/action-setup@v4.2.0 | |
| name: Install pnpm | |
| - uses: actions/setup-node@main | |
| with: | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile --prefer-offline | |
| - run: pnpm build | |
| docker: | |
| name: 🐳 Docker build & push | |
| needs: [format, nextjs] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| scw_image: ${{ steps.meta.outputs.scw_image }} | |
| steps: | |
| - uses: actions/checkout@main | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to Scaleway Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: rg.fr-par.scw.cloud | |
| username: nologin | |
| password: ${{ secrets.SCW_SECRET_KEY }} | |
| - name: Compute image tags | |
| id: meta | |
| run: | | |
| SCW_REGISTRY="${{ vars.SCW_REGISTRY_ENDPOINT }}" | |
| GHCR_IMAGE="ghcr.io/lyonjs/lyonjs.github.com" | |
| SCW_IMAGE="${SCW_REGISTRY}/lyonjs-website" | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| ALL_TAGS="${GHCR_IMAGE}:latest,${GHCR_IMAGE}:${{ github.sha }},${SCW_IMAGE}:latest,${SCW_IMAGE}:${{ github.sha }}" | |
| echo "scw_image=${SCW_IMAGE}:${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
| else | |
| PR_NUMBER="${{ github.event.pull_request.number }}" | |
| ALL_TAGS="${SCW_IMAGE}:pr-${PR_NUMBER}" | |
| echo "scw_image=${SCW_IMAGE}:pr-${PR_NUMBER}" >> "$GITHUB_OUTPUT" | |
| fi | |
| echo "tags=${ALL_TAGS}" >> "$GITHUB_OUTPUT" | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| load: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Docker image summary | |
| run: | | |
| IMAGE=$(echo "${{ steps.meta.outputs.tags }}" | cut -d',' -f1) | |
| SIZE_BYTES=$(docker image inspect "$IMAGE" --format='{{.Size}}') | |
| SIZE_MB=$(awk "BEGIN {printf \"%.1f\", ${SIZE_BYTES}/1024/1024}") | |
| LAYERS=$(docker image inspect "$IMAGE" --format='{{len .RootFS.Layers}}') | |
| CREATED=$(docker image inspect "$IMAGE" --format='{{.Created}}') | |
| echo "## 🐳 Docker image" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "| | |" >> "$GITHUB_STEP_SUMMARY" | |
| echo "|---|---|" >> "$GITHUB_STEP_SUMMARY" | |
| echo "| **Image** | \`${IMAGE}\` |" >> "$GITHUB_STEP_SUMMARY" | |
| echo "| **Size** | ${SIZE_MB} MB |" >> "$GITHUB_STEP_SUMMARY" | |
| echo "| **Layers** | ${LAYERS} |" >> "$GITHUB_STEP_SUMMARY" | |
| echo "| **Created** | ${CREATED} |" >> "$GITHUB_STEP_SUMMARY" | |
| deploy-production: | |
| name: 🚀 Deploy production | |
| if: github.event_name == 'push' | |
| needs: docker | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| url: ${{ steps.deploy.outputs.url }} | |
| env: | |
| SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }} | |
| SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }} | |
| SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }} | |
| SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }} | |
| steps: | |
| - name: Install Scaleway CLI | |
| run: curl -s https://raw.githubusercontent.com/scaleway/scaleway-cli/master/scripts/get.sh | sudo sh | |
| - name: Deploy container | |
| id: deploy | |
| run: | | |
| scw container container update \ | |
| "${{ vars.SCW_PROD_CONTAINER_ID }}" \ | |
| registry-image="${{ needs.docker.outputs.scw_image }}" \ | |
| redeploy=true \ | |
| region=fr-par | |
| # Poll until ready (timeout 3 min) | |
| for i in $(seq 1 36); do | |
| STATUS=$(scw container container get "${{ vars.SCW_PROD_CONTAINER_ID }}" region=fr-par -o json | jq -r '.status') | |
| if [ "$STATUS" = "ready" ]; then | |
| URL=$(scw container container get "${{ vars.SCW_PROD_CONTAINER_ID }}" region=fr-par -o json | jq -r '.domain_name') | |
| echo "url=https://${URL}" >> "$GITHUB_OUTPUT" | |
| echo "Container is ready at https://${URL}" | |
| exit 0 | |
| fi | |
| echo "Status: ${STATUS} - waiting..." | |
| sleep 5 | |
| done | |
| echo "::error::Deployment timed out" | |
| exit 1 | |
| deploy-preview: | |
| name: 🔍 Deploy preview | |
| if: github.event_name == 'pull_request' | |
| needs: docker | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: preview-pr-${{ github.event.pull_request.number }} | |
| url: ${{ steps.deploy.outputs.url }} | |
| env: | |
| SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }} | |
| SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }} | |
| SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }} | |
| SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }} | |
| steps: | |
| - name: Install Scaleway CLI | |
| run: curl -s https://raw.githubusercontent.com/scaleway/scaleway-cli/master/scripts/get.sh | sudo sh | |
| - name: Deploy preview container | |
| id: deploy | |
| run: | | |
| PR_NUMBER="${{ github.event.pull_request.number }}" | |
| CONTAINER_NAME="preview-pr-${PR_NUMBER}" | |
| NAMESPACE_ID="${{ vars.SCW_PREVIEW_NAMESPACE_ID }}" | |
| IMAGE="${{ needs.docker.outputs.scw_image }}" | |
| # Check if the container already exists (exact name match) | |
| EXISTING=$(scw container container list \ | |
| namespace-id="${NAMESPACE_ID}" \ | |
| region=fr-par \ | |
| -o json | jq -r --arg name "$CONTAINER_NAME" '.[] | select(.name == $name) | .id') | |
| if [ -n "$EXISTING" ]; then | |
| echo "Updating existing container ${EXISTING}" | |
| scw container container update \ | |
| "${EXISTING}" \ | |
| registry-image="${IMAGE}" \ | |
| redeploy=true \ | |
| region=fr-par | |
| CONTAINER_ID="${EXISTING}" | |
| else | |
| echo "Creating new preview container" | |
| RESULT=$(scw container container create \ | |
| namespace-id="${NAMESPACE_ID}" \ | |
| name="${CONTAINER_NAME}" \ | |
| registry-image="${IMAGE}" \ | |
| port=3000 \ | |
| min-scale=0 \ | |
| max-scale=1 \ | |
| memory-limit=256 \ | |
| cpu-limit=250 \ | |
| privacy=public \ | |
| http-option=redirected \ | |
| environment-variables.DEPLOY_ENV=preview \ | |
| environment-variables.NODE_ENV=production \ | |
| environment-variables.HOSTNAME=0.0.0.0 \ | |
| region=fr-par \ | |
| -o json) | |
| CONTAINER_ID=$(echo "$RESULT" | jq -r '.id') | |
| # Deploy the newly created container | |
| scw container container deploy "${CONTAINER_ID}" region=fr-par | |
| fi | |
| # Poll until ready (timeout 3 min) | |
| for i in $(seq 1 36); do | |
| STATUS=$(scw container container get "${CONTAINER_ID}" region=fr-par -o json | jq -r '.status') | |
| if [ "$STATUS" = "ready" ]; then | |
| URL=$(scw container container get "${CONTAINER_ID}" region=fr-par -o json | jq -r '.domain_name') | |
| echo "url=https://${URL}" >> "$GITHUB_OUTPUT" | |
| echo "Container is ready at https://${URL}" | |
| exit 0 | |
| fi | |
| echo "Status: ${STATUS} - waiting..." | |
| sleep 5 | |
| done | |
| echo "::error::Preview deployment timed out" | |
| exit 1 |