diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01480d2..8808b93 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ on: - main # Launches build when release is published release: - types: [ published ] + types: [published] jobs: build: @@ -18,34 +18,24 @@ jobs: runs-on: ubuntu-latest steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - - name: Remove broken apt repos [Ubuntu] - if: ${{ matrix.os }} == 'ubuntu-latest' - run: | - for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - - uses: actions/checkout@v3 - - name: Setup Node.js + - name: Set up Node.js uses: actions/setup-node@v3 - - - uses: actions/cache@v2 with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + node-version: 14 - - run: | - # Due to some dependencies yarn may randomly throw an error about invalid cache - # This approach is taken from https://github.com/yarnpkg/yarn/issues/7212#issuecomment-506155894 to fix the issue - # Another approach is to install with flag --network-concurrency 1, but this will make the installation pretty slow (default value is 8) - mkdir .yarncache - yarn install --cache-folder ./.yarncache --frozen-lockfile - rm -rf .yarncache - yarn cache clean + - name: Cache Yarn dependencies + uses: actions/cache@v2 + with: + path: | + node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install - name: Build app run: yarn build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59774fe..c226823 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,33 +1,28 @@ name: Unit tests -on: [ push, pull_request ] +on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Setup Node.js + - name: Set up Node.js uses: actions/setup-node@v3 + with: + node-version: 14 - - name: Yarn cache + - name: Cache Yarn dependencies uses: actions/cache@v2 with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + path: | + node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - - name: Yarn install - run: | - mkdir .yarncache - yarn install --cache-folder ./.yarncache --frozen-lockfile - rm -rf .yarncache - yarn cache clean + - name: Install dependencies + run: yarn install - name: Run tests run: yarn test diff --git a/package.json b/package.json index ed5b148..9126648 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ ], "scripts": { "clean": "rm -rf dist/* && rm -rf src/generatedTypes/* && rm -rf schemas/", - "compile": "ts-node --esm src/scripts/compile.ts --experimental-specifier-resolution=node", + "compile": "npx ts-node --esm src/scripts/compile.ts --experimental-specifier-resolution=node", "build": "yarn clean && yarn compile && microbundle -f modern,esm,cjs", "test": "jest", "prepare": "yarn build && yarn test"