Skip to content

Commit

Permalink
GH actions refactored into single CI workflow (#945)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuthan committed Nov 22, 2022
1 parent 75a6c7d commit be76228
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 171 deletions.
29 changes: 29 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Setup
description: Setup build

inputs:
node-version:
required: true
default: "16.15.0"
description: Node version

runs:
using: composite
steps:
- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ inputs.node-version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
shell: bash
run: npm ci
50 changes: 0 additions & 50 deletions .github/workflows/build.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

on:
workflow_dispatch: ~
push:
branches:
- master
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: npm run lint

unit-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.20.0, 16.15.0]

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
- run: npm run build
- run: npm run test

e2e-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.20.0, 16.15.0]

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
- run: npm run build
- run: npm run e2e

lighthouse-report:
needs: [lint, unit-test, e2e-test]
uses: ./.github/workflows/lighthouse-report.yml
secrets: inherit

size-report:
needs: [lint, unit-test, e2e-test]
uses: ./.github/workflows/size-report.yml
secrets: inherit
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Lighthouse CI
name: Lighthouse Report

on:
pull_request:
branches:
- master
workflow_call: ~
workflow_dispatch: ~

jobs:
build:
lighthouse-report:

runs-on: ubuntu-latest

Expand All @@ -17,28 +15,9 @@ jobs:
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 16.15.0

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: npm run build

- name: Run Lighthouse CI
run: |
Expand Down
34 changes: 5 additions & 29 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
Expand All @@ -21,34 +20,11 @@ jobs:
# release must bypass branch protection rules, built-in GITHUB_TOKEN doesn't work
token: ${{ secrets.RELEASE_GH_TOKEN }}

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.15.0'

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Unit Test
run: npm run test

- name: E2E Test
run: npm run e2e
- uses: ./.github/actions/setup
- run: npm run lint
- run: npm run build
- run: npm run test
- run: npm run e2e

- name: Configure GIT
run: |
Expand Down
36 changes: 6 additions & 30 deletions .github/workflows/release-final.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ on:
inputs:
increment:
description: 'Defines which part of a SemVer should be increased during the release process, e.g "major", "minor" or "patch"'
default: 'minor'
default: "minor"
required: true

jobs:
build:

runs-on: ubuntu-latest

steps:
Expand All @@ -26,34 +25,11 @@ jobs:
if: github.ref != 'refs/heads/master'
run: exit 1

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.15.0'

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Unit Test
run: npm run test

- name: E2E Test
run: npm run e2e
- uses: ./.github/actions/setup
- run: npm run lint
- run: npm run build
- run: npm run test
- run: npm run e2e

- name: Configure GIT
run: |
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/size-limit.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/size-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Size report

on:
workflow_call: ~
workflow_dispatch: ~

jobs:
size-report:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup

- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build_script: build:client
skip_step: install

0 comments on commit be76228

Please sign in to comment.