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

Fix build #54

Merged
merged 8 commits into from
Feb 15, 2024
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
38 changes: 14 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,32 @@ on:
- main
# Launches build when release is published
release:
types: [ published ]
types: [published]

jobs:
build:
name: Build Package
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
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
31 changes: 13 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading