Skip to content

Commit

Permalink
Split main workflow into build, lint and test workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Sep 6, 2023
1 parent fcce40a commit 868c4c3
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 43 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge.
name: ci-build

# Trigger the workflow when:
on:
# A push occurs to one of the matched branches.
push:
branches:
- master
- stable/*
# Or when a pull request event occurs for a pull request against one of the
# matched branches.
pull_request:
branches:
- master
- stable/*

# Explicitly disable secrets.GITHUB_TOKEN permissions.
permissions: {}

jobs:
yarn_cache:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
id: yarn-cache
with:
node-version: '18.x'
cache: yarn
- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

build:
# NOTE: This name appears in GitHub's Checks API.
name: build
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build app
run: yarn build
59 changes: 59 additions & 0 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge.
name: ci-lint

# Trigger the workflow when:
on:
# A push occurs to one of the matched branches.
push:
branches:
- master
- stable/*
# Or when a pull request event occurs for a pull request against one of the
# matched branches.
pull_request:
branches:
- master
- stable/*

# Explicitly disable secrets.GITHUB_TOKEN permissions.
permissions: {}

jobs:
yarn_cache:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
id: yarn-cache
with:
node-version: '18.x'
cache: yarn
- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

lint:
# NOTE: This name appears in GitHub's Checks API.
name: lint
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: ESLint
# Disallow warnings and always throw errors.
run: yarn lint --max-warnings 0
- name: Validate Grommet icons types
run: |
yarn fix-grommet-icons-types
git diff --exit-code
- name: Validate TypeScript
run: yarn checkTs
89 changes: 48 additions & 41 deletions .github/workflows/build-test.yaml → .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,53 @@
name: Build and test
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge.
name: ci-test

# Trigger the workflow when:
on:
# A push occurs to one of the matched branches.
push:
branches: [stable, master]
branches:
- master
- stable/*
# Or when a pull request event occurs for a pull request against one of the
# matched branches.
pull_request:
branches: [stable, master]
branches:
- master
- stable/*

# disable secrets.GITHUB_TOKEN permissions
# Explicitly disable secrets.GITHUB_TOKEN permissions.
permissions: {}

jobs:
yarn_cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
id: yarn-cache
with:
node-version: 18
cache: 'yarn'
cache: yarn
- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

build:
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn lint --max-warnings 0
- run: |
yarn fix-grommet-icons-types
git diff --exit-code
- run: yarn checkTs
- run: yarn build

jest:
# NOTE: This name appears in GitHub's Checks API.
name: jest
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --frozen-lockfile
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: yarn test --coverage
- name: 'Upload coverage report'
uses: actions/upload-artifact@v3
Expand All @@ -61,16 +57,20 @@ jobs:
retention-days: 5

playwright:
# NOTE: This name appears in GitHub's Checks API.
name: playwright
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --frozen-lockfile
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: REACT_APP_E2E_TEST=1 yarn build:ext
- run: REACT_APP_E2E_TEST=1 yarn start:prod &
- name: Install playwright's npm dependencies
Expand All @@ -92,16 +92,20 @@ jobs:
retention-days: 5

cypress:
# NOTE: This name appears in GitHub's Checks API.
name: cypress
needs: [yarn_cache]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --frozen-lockfile
node-version: '18.x'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: docker-compose pull
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
Expand All @@ -118,10 +122,13 @@ jobs:
retention-days: 5

upload-coverage:
# NOTE: This name appears in GitHub's Checks API.
name: coverage
needs: [cypress, jest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4
- name: Download coverage reports
uses: actions/download-artifact@v3
- uses: codecov/codecov-action@v3
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Oasis Wallet

[![CI build status][github-ci-build-badge]][github-ci-build-link]
[![CI test status][github-ci-test-badge]][github-ci-test-link]
[![CI lint status][github-ci-lint-badge]][github-ci-lint-link]
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![codecov](https://codecov.io/gh/oasisprotocol/oasis-wallet-web/branch/master/graph/badge.svg)](https://codecov.io/gh/oasisprotocol/oasis-wallet-web)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
[![Build status](https://github.com/oasisprotocol/oasis-wallet-web/actions/workflows/build-test.yaml/badge.svg)](https://github.com/oasisprotocol/oasis-wallet-web/actions)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FEsya%2Foasis-wallet.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FEsya%2Foasis-wallet?ref=badge_shield)

> :warning: **NEVER use the private keys and mnemonics given as example in this repository.**
Expand Down Expand Up @@ -208,3 +209,9 @@ Adding a new language:
[useTranslation hook]: https://react.i18next.com/latest/usetranslation-hook
[English translation.json]: src/locales/en/translation.json
[i18n.ts]: src/locales/i18n.ts
[github-ci-build-badge]: https://github.com/oasisprotocol/oasis-wallet-web/actions/workflows/ci-build.yml/badge.svg
[github-ci-build-link]: https://github.com/oasisprotocol/oasis-wallet-web/actions?query=workflow:ci-build+branch:master
[github-ci-test-badge]: https://github.com/oasisprotocol/oasis-wallet-web/actions/workflows/ci-test.yml/badge.svg
[github-ci-test-link]: https://github.com/oasisprotocol/oasis-wallet-web/actions?query=workflow:ci-test+branch:master
[github-ci-lint-badge]: https://github.com/oasisprotocol/oasis-wallet-web/actions/workflows/ci-lint.yml/badge.svg
[github-ci-lint-link]: https://github.com/oasisprotocol/oasis-wallet-web/actions?query=workflow:ci-lint+branch:master

0 comments on commit 868c4c3

Please sign in to comment.