Skip to content

build: automatically build types in prepack (#2258) #8471

build: automatically build types in prepack (#2258)

build: automatically build types in prepack (#2258) #8471

Workflow file for this run

name: CI
# run CI on pushes to master, and on all PRs (even the ones that target other
# branches)
on:
push:
branches: [master]
pull_request:
# This file has necessary redundancies since of github actions aren't supporting:
# - the definition of macros, which could be called from each job.
# - reporting the status of steps in the PR (only jobs and workflows are reported).
# Steps between "begin" and "end" should be the same in every job.
jobs:
lint:
name: lint
# begin macro
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
platform: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
# without this, setup-node errors on mismatched yarn versions
- run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Echo node version
run: node --version
- name: Install dependencies
run: yarn install --immutable
# end macro
- name: Run yarn build
run: yarn build
- name: Run yarn lint
run: yarn lint
# build the API docs to verify it works
- name: build API docs
run: yarn docs
# build the API docs in markdown for agoric/documentation repo to verify it works
- name: build API docs in markdown
run: yarn docs:markdown-for-agoric-documentation-repo
test:
name: test
# begin macro
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 21.x]
platform: [ubuntu-latest]
# windows-latest exhibited flakey tests that are not yet worth the
# trouble to investigate, and blocked us from upgrading yarn from 1 to
# 4.
steps:
- name: Checkout
uses: actions/checkout@v3
# without this, setup-node errors on mismatched yarn versions
- run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Echo node version
run: node --version
- name: Install dependencies
run: yarn install --immutable
# end macro
- name: Run yarn build
run: yarn build
- name: Run yarn test
run: yarn test
test-async-hooks:
name: test-async-hooks
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
node-version:
# '16.1' last version before some significant promise hooks changes
# '16.5' last version before unconditional promise fast-path
# '16.6' first version after unconditional promise fast-path
- '18'
# '20.6' not viable due to https://github.com/nodejs/node/issues/49497
# '20.3' to '20.6' not viable due to https://github.com/nodejs/node/pull/49211
# '20.7' first SES-viable version
# '20.9' first LTS of 20
- '20'
platform:
- ubuntu-latest
# begin macro
steps:
- name: Checkout
uses: actions/checkout@v3
# without this, setup-node errors on mismatched yarn versions
- run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Echo node version
run: node --version
# end macro
- name: Install dependencies
run: yarn install --immutable
- name: Run yarn build
run: yarn build
- name: Run yarn test (@endo/init)
working-directory: packages/init
run: yarn test
cover:
name: cover
# begin macro
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
platform: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
# without this, setup-node errors on mismatched yarn versions
- run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Echo node version
run: node --version
- name: Install dependencies
run: yarn install --immutable
# end macro
- name: Run yarn build
run: yarn build
- name: Run yarn cover
run: yarn cover
test262:
name: test262
# begin macro
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
platform: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
# without this, setup-node errors on mismatched yarn versions
- run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Echo node version
run: node --version
- name: Install dependencies
run: yarn install --immutable
# end macro
- name: Run yarn build
run: yarn build
- name: Run yarn test262
run: exit 0 # TODO remove test262 from required tests for CI
platform-compatibility-test:
name: platform-compatibility-test
# begin macro
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
platform: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
# without this, setup-node errors on mismatched yarn versions
- run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Echo node version
run: node --version
- name: Install dependencies
run: yarn install --immutable
# end macro
- name: 'build'
run: yarn run build
# fails under Node v12
- run: corepack disable
- name: 'switch to node v12'
uses: actions/setup-node@v3
with:
node-version: '12.x'
- name: Echo node version
run: node --version
- name: Run test:platform-compatibility
# npm b/c Yarn 4 doesn't work in Node 12
run: cd packages/ses && npm run test:platform-compatibility
viable-release:
name: viable-release
# begin macro
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
platform: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
# without this, setup-node errors on mismatched yarn versions
- run: corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Echo node version
run: node --version
- name: Install dependencies
run: yarn install --immutable
# end macro
- name: build
run: yarn run build
- name: pack
# Cannot use yarn lerna run pack
run: yarn lerna exec yarn pack
# Prepack (without cleanup per package) to ensure that type resolution in
# dependent packages continues to work when the typedefs are generated by
# their upstream packages. This helps avoid a situation in which the types
# only resolve because of the state of the local filesystem, and fails
# when imported in an NPM node_modules tree.
- name: Prepack packages
run: yarn lerna run --reject-cycles --concurrency 1 prepack