Skip to content

Update dependency wrangler to v3.67.0 #2683

Update dependency wrangler to v3.67.0

Update dependency wrangler to v3.67.0 #2683

Workflow file for this run

name: Build, test, and deploy
on:
push:
pull_request:
schedule:
# Run once per week to ensure that the pipeline is okay.
- cron: "23 13 * * 0"
permissions:
contents: read
env:
ARTIFACT_NAME: jdkcomparison-site
# Use Node.js LTS. Schedule: https://nodejs.org/en/about/releases/
NODE_VERSION: 20.x
jobs:
common-checks:
name: Run common checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run shellcheck on shell scripts
run: find . -name node_modules -prune -o -type f -name "*.sh" -exec shellcheck {} \;
- name: Run Prettier to ensure files are properly formatted
run: npx prettier@`node -p -e "require('./package.json').devDependencies['prettier']"` --check .
build:
name: Build and test
runs-on: ubuntu-latest
needs:
- common-checks
permissions:
contents: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Run unit tests
run: npm run jest
- name: Run component tests
run: npm run component:headless
# Starts the Next.js development server and puts it into the background before running the tests and stopping the
# development server by looking for the PID of the process that listens on port 3000. Capturing the PID with $! is
# not possible because `next` seems to spawn a separate process, even if invoked directly. xargs handles 0..n
# matching processes correctly.
- name: Run E2E tests
run: |
npm run dev > /tmp/nextjs-dev.txt 2>&1 &
npm run e2e:headless
lsof -t -i:3000 -sTCP:LISTEN | xargs -r kill -TERM
- name: Build
run: npx @cloudflare/next-on-pages@`node -p -e "require('./package.json').devDependencies['@cloudflare/next-on-pages']"`
# Upload build output before anything can alter it.
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: .vercel/output/static
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Test Results of Node.js ${{ env.NODE_VERSION }}
files: |
cypress/results/*.xml
build/reports/*.xml
- name: Upload Cypress Screenshots and Videos on Failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-tests-node.js-${{ env.NODE_VERSION }}
path: |
cypress/screenshots/
cypress/videos/
if-no-files-found: ignore
deploy-preview:
name: Deploy preview
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: read
deployments: write
pull-requests: write
outputs:
preview-url: ${{ steps.cloudflare-deployment.outputs.url }}
steps:
- name: Set PREVIEW_NAME for main branch
if: github.ref == 'refs/heads/main'
run: |
echo "PREVIEW_NAME=main-preview" >> $GITHUB_ENV
- name: Set PREVIEW_NAME for all branches other than main
if: github.ref != 'refs/heads/main'
run: |
echo "PREVIEW_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: site
- name: Publish to Cloudflare Pages
id: cloudflare-deployment
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 6db44e986b34e7b9e118f48872f9e729
projectName: jdkcomparison
directory: site
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# Tells Cloudflare Pages which branch this deployment originates from.
branch: ${{ env.PREVIEW_NAME }}
- uses: mshick/add-pr-comment@v2
with:
message: |
### <span aria-hidden="true">✅</span> Your deployment is ready!
| Name | Link |
|-|-|
|Deployed Commit | ${{ github.sha }} |
|Workflow Log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
|Preview URL | ${{ steps.cloudflare-deployment.outputs.url }} |
|Environment | ${{ steps.cloudflare-deployment.outputs.environment }} |
---
acceptance:
name: Run acceptance tests
runs-on: ubuntu-latest
needs:
- build
- deploy-preview
permissions:
contents: read
checks: write
pull-requests: write
env:
CYPRESS_BASE_URL: ${{ needs.deploy-preview.outputs.preview-url }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm install
- name: Run acceptance tests
run: |
echo "Run acceptance tests against ${{ env.CYPRESS_BASE_URL }}"
npm run acceptance
- name: Publish Acceptance Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Acceptance Test Results
files: |
cypress/results/*.xml
build/reports/*.xml
- name: Upload Cypress Screenshots and Videos on Failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-acceptance-tests
path: |
cypress/screenshots/
cypress/videos/
if-no-files-found: ignore
deploy-to-production:
name: Deploy to production
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- build
- acceptance
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: site
- name: Publish to Cloudflare Pages
id: cloudflare-deployment
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 6db44e986b34e7b9e118f48872f9e729
projectName: jdkcomparison
directory: site
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# Tells Cloudflare Pages which branch this deployment originates from.
branch: ${{ github.ref_name }}