Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: DSW-1422 upgrade repo to use node 20 + add volta config #9

Merged
merged 16 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions .github/workflows/build-deploy.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ on:
inputs:
amplify-app-id:
description: "The ID for your Amplify app (which you can get from the end of its ARN)"
required: false
type: string
node-version:
description: "The node version to use when building the application"
required: true
type: number
os:
description: "The operating system to use when building the application"
required: true
type: string
package-name:
Expand All @@ -11,16 +19,20 @@ on:
type: string
package-dist-directory:
description: "The directory where the package dist is located"
required: true
required: false
type: string
bucket-name-preview:
description: "Name of the preview bucket being deployed to"
required: false
type: string
bucket-name-main:
description: "Name of the main bucket being deployed to"
required: true
required: false
type: string
deploy:
description: "Boolean flag on whether to deploy the application with the given node version"
required: true
type: boolean

env:
AMPLIFY_ID: ${{ inputs.amplify-app-id }}
Expand All @@ -33,18 +45,17 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ inputs.os }}
steps:
# Checkout the Repo
- name: Checkout
uses: actions/checkout@v3

# Setup Node
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: "yarn"
node-version: ${{ inputs.node-version }}

- name: Install Dependencies & Build - ${{ inputs.package-name }}
shell: bash
Expand All @@ -54,7 +65,7 @@ jobs:
# This is a slightly modified version of the following workflow - https://github.com/justeattakeaway/pie/blob/main/.github/workflows/amplify-deploy.yml
# Create Github Deployment
- name: Create Docs GitHub deployment
if: ${{ github.event_name == 'pull_request' }}
if: github.event_name == 'pull_request' && inputs.deploy == true
uses: chrnorm/deployment-action@v2
id: deploy
with:
Expand All @@ -63,13 +74,15 @@ jobs:

# Zip dist folder
- name: Zip build output
if: github.event_name == 'pull_request' && inputs.deploy == true
shell: bash
run: |
cd ${{ inputs.package-dist-directory }}
zip -r ./${{ env.ZIP_NAME }} .

# Upload zip to S3
- name: Upload to S3
if: github.event_name == 'pull_request' && inputs.deploy == true
id: upload-s3
uses: hkusu/s3-upload-action@v2
with:
Expand All @@ -85,6 +98,7 @@ jobs:

# Create branch on Amplify
- name: Create Amplify branch
if: github.event_name == 'pull_request' && inputs.deploy == true
shell: bash
# We return true to prevent the step from failing if the branch already exists
run: |
Expand All @@ -95,6 +109,7 @@ jobs:

# Deploy Amplify from S3
- name: Deploy Amplify from S3
if: github.event_name == 'pull_request' && inputs.deploy == true
shell: bash
run: |
aws amplify start-deployment \
Expand All @@ -104,7 +119,7 @@ jobs:

# If successful
- name: Update deployment status (success)
if: ${{ github.event_name == 'pull_request' && success() }}
if: github.event_name == 'pull_request' && inputs.deploy && success()
uses: chrnorm/deployment-status@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -114,7 +129,7 @@ jobs:

# If it failed
- name: Update deployment status (failure)
if: ${{ github.event_name == 'pull_request' && failure() }}
if: github.event_name == 'pull_request' && inputs.deploy && failure()
uses: chrnorm/deployment-status@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
68 changes: 61 additions & 7 deletions .github/workflows/ci-nextjs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Deploy - NextJS App
name: Build - NextJS App

on:
pull_request:
Expand All @@ -19,10 +19,64 @@ concurrency:

jobs:

build-deploy-next-app:
name: Build & Deploy
uses: ./.github/workflows/build-deploy.yml
# Commenting these out for now as there's currently an issue with Next.
# build-next-app-windows-node16:
# name: Windows - Node 16
# uses: ./.github/workflows/build.yml
# with:
# deploy: false
# node-version: 16
# os: 'windows-latest'
# package-name: 'nextjs-app'
# secrets: inherit

# build-next-app-windows-node18:
# name: Windows - Node 18
# uses: ./.github/workflows/build.yml
# with:
# deploy: false
# node-version: 18
# os: 'windows-latest'
# package-name: 'nextjs-app'
# secrets: inherit

# build-next-app-windows-node20:
# name: Windows - Node 20
# uses: ./.github/workflows/build.yml
# with:
# deploy: false
# node-version: 20
# os: 'windows-latest'
# package-name: 'nextjs-app'
# secrets: inherit

build-next-app-ubuntu-node16:
name: Ubuntu - Node 16
uses: ./.github/workflows/build.yml
with:
deploy: false
node-version: 16
os: 'ubuntu-latest'
package-name: 'nextjs-app'
secrets: inherit

build-next-app-ubuntu-node18:
name: Ubuntu - Node 18
uses: ./.github/workflows/build.yml
with:
deploy: false
node-version: 18
os: 'ubuntu-latest'
package-name: 'nextjs-app'
secrets: inherit

build-deploy-next-app-ubuntu-node20:
name: Ubuntu - Node 20
uses: ./.github/workflows/build.yml
with:
deploy: true
node-version: 20
os: 'ubuntu-latest'
amplify-app-id: 'd1106vmj1ozg8d'
package-name: 'nextjs-app'
package-dist-directory: './nextjs-app/out'
Expand All @@ -31,7 +85,7 @@ jobs:
secrets: inherit

browser-tests:
needs: 'build-deploy-next-app'
needs: 'build-deploy-next-app-ubuntu-node20'
name: Run WebDriverIO Tests
runs-on: ubuntu-latest
steps:
Expand All @@ -41,9 +95,9 @@ jobs:

# Setup Node
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "yarn"

- name: Install Dependencies - Root
Expand Down
68 changes: 60 additions & 8 deletions .github/workflows/ci-vanilla.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Deploy - Vanilla App
name: Build - Vanilla App

on:
pull_request:
Expand All @@ -18,10 +18,63 @@ concurrency:

jobs:

build-deploy-vanilla-app:
name: Build & Deploy
uses: ./.github/workflows/build-deploy.yml
build-vanilla-app-windows-node16:
name: Windows - Node 16
uses: ./.github/workflows/build.yml
with:
deploy: false
node-version: 16
os: 'windows-latest'
package-name: 'vanilla-app'
secrets: inherit

build-vanilla-app-windows-node18:
name: Windows - Node 18
uses: ./.github/workflows/build.yml
with:
deploy: false
node-version: 18
os: 'windows-latest'
package-name: 'vanilla-app'
secrets: inherit

build-vanilla-app-windows-node20:
name: Windows - Node 20
uses: ./.github/workflows/build.yml
with:
deploy: false
node-version: 20
os: 'windows-latest'
package-name: 'vanilla-app'
secrets: inherit

build-vanilla-app-ubuntu-node16:
name: Ubuntu - Node 16
uses: ./.github/workflows/build.yml
with:
deploy: false
node-version: 16
os: 'ubuntu-latest'
package-name: 'vanilla-app'
secrets: inherit

build-vanilla-app-ubuntu-node18:
name: Ubuntu - Node 18
uses: ./.github/workflows/build.yml
with:
deploy: false
node-version: 18
os: 'ubuntu-latest'
package-name: 'vanilla-app'
secrets: inherit

build-deploy-vanilla-app-node20:
name: Ubuntu - Node 20
uses: ./.github/workflows/build.yml
with:
deploy: true
os: ubuntu-latest
node-version: 20
amplify-app-id: 'd2vb6sjgivffb3'
package-name: 'vanilla-app'
package-dist-directory: './vanilla-app/dist'
Expand All @@ -30,7 +83,7 @@ jobs:
secrets: inherit

browser-tests:
needs: 'build-deploy-vanilla-app'
needs: 'build-deploy-vanilla-app-node20'
name: Run WebDriverIO Tests
runs-on: ubuntu-latest
steps:
Expand All @@ -40,10 +93,9 @@ jobs:

# Setup Node
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: "yarn"
node-version: 20

- name: Install Dependencies - Root
shell: bash
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ esm
.vscode-test

# yarn v2
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
**/.yarn/cache
**/.yarn/unplugged
**/.yarn/build-state.yml
**/.yarn/install-state.gz

# Comment out for Zero installs (see https://yarnpkg.com/features/zero-installs#gatsby-focus-wrapper)
#.yarn/cache
Expand Down
Loading