Skip to content

test: fix import for node 18 #12044

test: fix import for node 18

test: fix import for node 18 #12044

Workflow file for this run

name: tests
on:
push:
branches: [ master, renovate/** ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Workflow Action
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Source code
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Enable corepack
run: |
corepack enable
corepack prepare yarn@stable --activate
# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn
- name: Install
run: yarn
- name: Test TS
run: yarn tsc-check-tests
- name: Build
run: yarn build
docs:
name: Docs build
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
steps:
- name: Checkout Source code
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Enable corepack
run: |
corepack enable
corepack prepare yarn@stable --activate
# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn
- name: Install
run: yarn
- name: Build & deploy docs
run: |
cd docs
yarn
export MIKRO_ORM_DOCS_TESTING=1
yarn build
lint:
name: Lint
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
steps:
- name: Checkout Source code
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Enable corepack
run: |
corepack enable
corepack prepare yarn@stable --activate
# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn
- name: Install
run: yarn
- name: Lint
run: yarn lint
test:
name: Tests
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [ 18, 20 ]
steps:
- name: Checkout Source code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Enable corepack
run: |
corepack enable
corepack prepare yarn@stable --activate
# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn
- name: Install
run: yarn
- name: Init docker
run: |
docker compose up -d
- name: Set CC Required env vars
run: export GIT_BRANCH=$GITHUB_HEAD_REF && export GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v2
- name: Test
run: |
yarn coverage --max-workers ${{ steps.cpu-cores.outputs.count }} > COVERAGE_RESULT
echo "$(cat COVERAGE_RESULT)"
git status && git diff
env:
RETRY_TESTS: 1
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Teardown docker
run: docker compose down
publish:
name: Publish
if: github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
needs: [ test, build, lint ]
steps:
- name: Checkout Source code
uses: actions/checkout@v4
with:
fetch-depth: 0 # we need to pull everything to have correct dev version suffix
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Enable corepack
run: |
corepack enable
corepack prepare yarn@stable --activate
# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn
- name: Install
run: yarn
- name: Build
run: yarn build
- name: Release dev version for testing
run: |
git config --global user.name 'MikroORM Release Bot'
git config --global user.email '[email protected]'
yarn lerna run copy -- -- --canary
git commit -am 'chore: bump canary versions [skip ci]'
echo "access=public" >> .npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
yarn publish:next --yes --no-verify-access
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}