diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 0000000000..f7d1b7c28a --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,37 @@ +# 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: + build: + # NOTE: This name appears in GitHub's Checks API. + name: build + 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 diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml new file mode 100644 index 0000000000..3cea0ad8fd --- /dev/null +++ b/.github/workflows/ci-lint.yml @@ -0,0 +1,44 @@ +# 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: + lint: + # NOTE: This name appears in GitHub's Checks API. + name: lint + 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 diff --git a/.github/workflows/build-test.yaml b/.github/workflows/ci-test.yml similarity index 64% rename from .github/workflows/build-test.yaml rename to .github/workflows/ci-test.yml index 2395e343b8..9f5e0651e9 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/ci-test.yml @@ -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@v4 - - 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@v4 - - 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@v4 - - 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 @@ -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@v4 - - 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 @@ -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@v4 - - 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/action-docker-layer-caching@v0.0.11 # Ignore the failure of a step and avoid terminating the job. @@ -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@v4 + - name: Checkout code + uses: actions/checkout@v4 - name: Download coverage reports uses: actions/download-artifact@v3 - uses: codecov/codecov-action@v3 diff --git a/README.md b/README.md index 4732afe89a..508957d610 100644 --- a/README.md +++ b/README.md @@ -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.** @@ -182,9 +183,10 @@ Transifex a few hours after changes are merged. After they are translated, click _"i18n: Update translations from Transifex"_. Adding a new language: + 1. first add it to Transifex and translate the strings, 2. create a folder with the new language code in `src/locales` and download the - translation file there, + translation file there, 3. add the new language to the [list of resources][i18n.ts] ## Preparing a Release @@ -208,3 +210,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