Bump the react group across 1 directory with 6 updates #7248
This file contains 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: "Push" | |
on: [push] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build and cache Docker image | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 10 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Cache Docker image | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/myimage.tar | |
key: mariners-dashboard-image-${{ github.sha }} | |
restore-keys: | | |
mariners-dashboard-image- | |
- name: "Login to Docker Hub" | |
uses: docker/[email protected] | |
continue-on-error: true | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker Image | |
uses: docker/[email protected] | |
with: | |
context: . | |
target: dev | |
push: false | |
tags: gmri/neracoos-mariners-dashboard:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=docker,dest=/tmp/myimage.tar | |
build-prod: | |
name: Build production Docker image | |
runs-on: ubuntu-20.04 | |
needs: build | |
timeout-minutes: 10 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Cache Docker image | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/myimage.tar | |
key: mariners-dashboard-image-${{ github.sha }} | |
restore-keys: | | |
mariners-dashboard-image- | |
- name: Cache production Docker image | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/prodimage.tar | |
key: mariners-dashboard-prod-image-${{ github.sha }} | |
restore-keys: | | |
mariners-dashboard-prod-image- | |
- name: Load Docker image | |
run: | | |
docker load --input /tmp/myimage.tar | |
docker image ls -a | |
- name: Build Docker Image | |
uses: docker/[email protected] | |
with: | |
context: . | |
target: runner | |
push: false | |
tags: gmri/neracoos-mariners-dashboard:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=docker,dest=/tmp/prodimage.tar | |
unit_tests: | |
name: Unit tests, typecheck and coverage | |
runs-on: ubuntu-20.04 | |
needs: build | |
timeout-minutes: 10 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: Cache Docker image | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/myimage.tar | |
key: mariners-dashboard-image-${{ github.sha }} | |
restore-keys: | | |
mariners-dashboard-image- | |
- name: Load Docker image | |
run: | | |
docker load --input /tmp/myimage.tar | |
docker image ls -a | |
- name: Run unit tests and coverage | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
if: env.CODACY_PROJECT_TOKEN != null | |
run: docker compose -f docker-compose.dev.yaml run -e CI=true client npm run test-with-coverage | |
- name: Codacy Coverage Reporter | |
if: env.CODACY_PROJECT_TOKEN != null | |
uses: codacy/[email protected] | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: ./coverage/lcov.info | |
- name: Run unit test (and skip coverage if no project token secret) | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
if: env.CODACY_PROJECT_TOKEN == null | |
run: docker compose -f docker-compose.dev.yaml run -e CI=true client npm run test-ci | |
- name: npm run Build | |
run: docker compose -f docker-compose.dev.yaml run client npm run build | |
- name: Build Storybook Pages | |
run: docker compose -f docker-compose.dev.yaml run client npm run build-storybook | |
# - name: Cache Storybook Build | |
# uses: actions/cache@v4 | |
# with: | |
# path: /tmp/storybook-public/ | |
# key: mariners-dashboard-storybook-${{ github.sha }} | |
# - name: Copy Storybook Build to cache directory | |
# run: | | |
# rm -rf /tmp/storybook-public | |
# cp -r storybook-public /tmp/storybook-public | |
playwright: | |
name: Playwright integration tests | |
runs-on: ubuntu-20.04 | |
needs: build-prod | |
timeout-minutes: 30 | |
env: | |
# Playwright uses this env var for the browser install path. See: | |
# https://playwright.dev/docs/ci#directories-to-cache | |
# It makes most sense to default this to something cross-platform | |
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/ms-playwright | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "22" | |
cache: npm | |
- name: Cache Docker image | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/prodimage.tar | |
key: mariners-dashboard-prod-image-${{ github.sha }} | |
restore-keys: | | |
mariners-dashboard-prod-image- | |
- name: Load Docker image | |
run: | | |
docker load --input /tmp/prodimage.tar | |
docker image ls -a | |
- name: Start container | |
run: docker compose up -d client | |
- run: npm install --frozen-lockfile | |
# Use Playwright version as part of the cache key | |
# AFAIK this is a x-platform way to get your installed Playwright version. | |
# Be sure to be diligent in specifying ^, ~, or locked versions. | |
- run: | | |
echo "PLAYWRIGHT_VERSION=$(node -e "process.stdout.write(require('@playwright/test/package.json').version)")" >> $GITHUB_OUTPUT | |
id: playwright-version | |
# Cache action | |
- uses: actions/cache@v4 | |
id: playwright-cache | |
with: | |
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }} | |
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} | |
# This command should work and only be ran on cold cache | |
- run: npx playwright install | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- name: Wait for container to become available | |
run: npx wait-on http://localhost:3000 | |
timeout-minutes: 1 | |
- name: Run Playwright tests | |
run: npm run test:e2e | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
# pages: | |
# name: Deploy Storybook to Github Pages on version tag | |
# runs-on: ubuntu-20.04 | |
# needs: [unit_tests, playwright] | |
# timeout-minutes: 10 | |
# if: | | |
# github.repository == 'gulfofmaine/Neracoos-1-Buoy-App' | |
# && contains(github.ref, 'refs/tags/v') | |
# steps: | |
# - name: "Checkout" | |
# uses: actions/checkout@v4 | |
# - name: Cache Storybook Build | |
# uses: actions/cache@v4 | |
# with: | |
# path: /tmp/storybook-public/ | |
# key: mariners-dashboard-storybook-${{ github.sha }} | |
# - name: Deploy Storybook to Github Pages 🚀 | |
# uses: JamesIves/[email protected] | |
# with: | |
# branch: gh-pages | |
# folder: /tmp/storybook-public/ | |
push_image: | |
name: Build and push tagged image to Docker Hub | |
runs-on: ubuntu-20.04 | |
needs: [unit_tests, playwright] | |
timeout-minutes: 20 | |
environment: Deploy with ArgoCD | |
if: | | |
github.repository == 'gulfofmaine/Neracoos-1-Buoy-App' | |
&& contains(github.ref, 'refs/tags/v') | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Cache Docker image | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/prodimage.tar | |
key: mariners-dashboard-prod-image-${{ github.sha }} | |
restore-keys: | | |
mariners-dashboard-prod-image- | |
- name: Load Docker image | |
run: | | |
docker load --input /tmp/prodimage.tar | |
docker image ls -a | |
- name: "Login to Docker Hub" | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get tag name | |
uses: olegtarasov/[email protected] | |
id: tagName | |
- name: Build and push Docker Image | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: gmri/neracoos-mariners-dashboard:${{ steps.tagName.outputs.tag }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
build-args: | | |
NEXT_PUBLIC_ERDDAP_SERVICE=https://buoybarn.neracoos.org | |
NEXT_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN_PROD }} | |
- name: Make GitOps directory | |
run: mkdir gitops | |
- name: Clone GitOps config repo | |
run: git clone "https://[email protected]/gulfofmaine/neracoos-aws-cd.git" | |
working-directory: ./gitops | |
env: | |
GITOPS_TOKEN: ${{ secrets.GITOPS_TOKEN }} | |
- name: Update GitOps config repo | |
working-directory: ./gitops/neracoos-aws-cd | |
run: | | |
sed -i 's/?ref=.\+/?ref=${{ steps.tagName.outputs.tag }}/' overlays/mariners/kustomization.yaml | |
sed -i 's/newTag: .\+/newTag: ${{ steps.tagName.outputs.tag }}/' overlays/mariners/kustomization.yaml | |
git config --global user.email '[email protected]' | |
git config --global user.name 'NERACOOS Mariners Dashboard CI' | |
git diff --exit-code && echo 'Already Deployed' || (git commit -am 'Upgrade Mariners Dashboard to ${{ steps.tagName.outputs.tag }}' && git push) | |
- name: Copy Next.JS sourcemaps | |
run: docker run -v $PWD:/opt/mount --rm --entrypoint cp gmri/neracoos-mariners-dashboard -r /app/.next /opt/mount/next-build | |
- name: Create Sentry Release | |
uses: getsentry/[email protected] | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: production | |
version: ${{ steps.tagName.outputs.tag }} | |
sourcemaps: ./next-build | |
push_dev_image: | |
name: Build and push dev image to Docker Hub | |
runs-on: ubuntu-20.04 | |
needs: [unit_tests, playwright] | |
timeout-minutes: 20 | |
environment: Deploy with ArgoCD | |
if: | | |
github.repository == 'gulfofmaine/Neracoos-1-Buoy-App' | |
&& github.ref == 'refs/heads/main' | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Cache Docker image | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/prodimage.tar | |
key: mariners-dashboard-prod-image-${{ github.sha }} | |
restore-keys: | | |
mariners-dashboard-prod-image- | |
- name: Load Docker image | |
run: | | |
docker load --input /tmp/prodimage.tar | |
docker image ls -a | |
- name: "Login to Docker Hub" | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get tag name | |
id: tagName | |
run: echo "tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Build and push Docker Image | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: gmri/neracoos-mariners-dashboard:${{ steps.tagName.outputs.tag }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
build-args: | | |
NEXT_PUBLIC_ERDDAP_SERVICE=https://buoybarn.neracoos.org | |
NEXT_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN_DEV }} | |
- name: Make GitOps directory | |
run: mkdir gitops | |
- name: Clone GitOps config repo | |
run: git clone "https://[email protected]/gulfofmaine/neracoos-aws-cd.git" | |
working-directory: ./gitops | |
env: | |
GITOPS_TOKEN: ${{ secrets.GITOPS_TOKEN }} | |
- name: Update GitOps config repo | |
working-directory: ./gitops/neracoos-aws-cd | |
run: | | |
sed -i 's/?ref=.\+/?ref=${{ github.sha }}/' overlays/mariners-dev/kustomization.yaml | |
sed -i 's/newTag: .\+/newTag: "${{ steps.tagName.outputs.tag }}"/' overlays/mariners-dev/kustomization.yaml | |
git config --global user.email '[email protected]' | |
git config --global user.name 'NERACOOS Mariners Dashboard CI' | |
git diff --exit-code && echo 'Already Deployed' || (git commit -am 'Upgrade Mariners Dashboard dev deployment to ${{ steps.tagName.outputs.tag }}' && git push) | |
- name: Copy Next.JS sourcemaps | |
run: docker run -v $PWD:/opt/mount --rm --entrypoint cp gmri/neracoos-mariners-dashboard -r /app/.next /opt/mount/next-build | |
- name: Create Sentry Release | |
uses: getsentry/[email protected] | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: dev | |
version: ${{ steps.tagName.outputs.tag }} | |
sourcemaps: ./next-build |