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

GH workflows refactored #945

Merged
merged 2 commits into from
Nov 22, 2022
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
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As next step, we should bump this version thanks to #946

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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff!

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