From 085c46e867fe11d1ce077d2fd3c28fc2fcdabd72 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Tue, 30 Aug 2022 12:23:32 -0700 Subject: [PATCH] build: include type checking in CI test (#182) * build: check as part of tests * build: check all src files * build: name job test Co-authored-by: Jordan Frankfurt --- .github/actions/setup/action.yml | 21 +++++++++++++++++++++ .github/workflows/crowdin-download.yaml | 9 +-------- .github/workflows/crowdin-upload.yaml | 9 +-------- .github/workflows/lint.yml | 9 +-------- .github/workflows/release.yaml | 10 ++-------- .github/workflows/test.yaml | 22 +++++++++++++--------- package.json | 4 +++- 7 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 000000000..9ff0ccc9a --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,21 @@ +name: Setup +runs: + using: composite + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org + cache: yarn + + - uses: actions/cache@v3 + id: install-cache + with: + path: node_modules/ + key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }} + + - if: steps.install-cache.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile --ignore-scripts + shell: bash diff --git a/.github/workflows/crowdin-download.yaml b/.github/workflows/crowdin-download.yaml index 1599031ec..5e08127ee 100644 --- a/.github/workflows/crowdin-download.yaml +++ b/.github/workflows/crowdin-download.yaml @@ -11,14 +11,7 @@ jobs: steps: - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 14 - registry-url: https://registry.npmjs.org - cache: 'yarn' - - - run: yarn install --frozen-lockfile --ignore-scripts + - uses: ./.github/actions/setup - run: yarn i18n:extract diff --git a/.github/workflows/crowdin-upload.yaml b/.github/workflows/crowdin-upload.yaml index 28c338d1e..da05771d0 100644 --- a/.github/workflows/crowdin-upload.yaml +++ b/.github/workflows/crowdin-upload.yaml @@ -11,14 +11,7 @@ jobs: steps: - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 14 - registry-url: https://registry.npmjs.org - cache: 'yarn' - - - run: yarn install --frozen-lockfile --ignore-scripts + - uses: ./.github/actions/setup - run: yarn i18n:extract diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4d3add1a4..c837926bb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,14 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: https://registry.npmjs.org - cache: 'yarn' - - - run: yarn install --frozen-lockfile --ignore-scripts + - uses: ./.github/actions/setup - uses: wearerequired/lint-action@v2 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 944a6f7a1..0d74a6a33 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,14 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: https://registry.npmjs.org - cache: 'yarn' - - - run: yarn install --frozen-lockfile + - uses: ./.github/actions/setup + - run: yarn prepare - run: yarn test if: success() diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d36a946fb..ec0fc4365 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,23 +7,27 @@ on: pull_request: branches: - main + # manual trigger + workflow_dispatch: jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: https://registry.npmjs.org - cache: 'yarn' - - - run: yarn install --frozen-lockfile + - uses: ./.github/actions/setup + - run: yarn prepare - run: yarn test - - run: yarn test:e2e env: JSON_RPC_PROVIDER: ${{ secrets.JSON_RPC_PROVIDER }} + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup + - run: yarn prepare + + - run: yarn typecheck diff --git a/package.json b/package.json index 199984920..e66f5d1a6 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,9 @@ "prepare": "yarn contracts:compile && yarn i18n:compile && yarn ajv:compile", "prepublishOnly": "yarn build", "start": "cosmos", - "build": "tsc -p tsconfig.build.json && rollup --config --failAfterWarnings", + "typecheck": "tsc -p tsconfig.json", + "prebuild": "tsc -p tsconfig.build.json", + "build": "rollup --config --failAfterWarnings", "release": "semantic-release", "lint": "eslint .", "test": "jest src",