Skip to content

Commit

Permalink
Modernize CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Aug 23, 2024
1 parent 5fd6d5b commit 4aa2cf1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 33 deletions.
86 changes: 55 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,64 @@
name: "CI"
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
node-version:
- 18.x
- 20.x
- 22.x
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Ensure line endings are consistent
run: git config --global core.autocrlf input
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Load cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-test-modules-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --frozen-lockfile --ignore-engines
- name: Build project
run: yarn run build
- name: Run tests
run: export NODE_OPTIONS="--max_old_space_size=4096" && yarn run test-ci
- name: Build project -- esModuleInterop true
run: yarn run build:ts --esModuleInterop true
- name: Run unit tests (ubuntu, mac)
if: ${{ (matrix.os == 'ubuntu-latest') || (matrix.os == 'macos-latest') }}
run: export NODE_OPTIONS="--max_old_space_size=4096" && yarn run test-ci:unit
- name: Run unit tests (windows)
if: ${{ matrix.os == 'windows-latest' }}
run: set NODE_OPTIONS=--max-old-space-size=4096 && yarn run test-ci:unit
- name: Run system tests
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 2
max_attempts: 3
command: export NODE_OPTIONS="--max_old_space_size=4096" && yarn run test-ci:system
- name: Run browser tests
run: yarn run test-browser
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 3
max_attempts: 3
command: yarn run test-browser
- name: Submit coverage results
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.node-version }}
Expand All @@ -45,7 +69,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Consolidate test coverage from different jobs
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
Expand All @@ -54,18 +78,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: 18.x
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Load cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-lint-modules-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --frozen-lockfile --ignore-engines
- name: Run linter
run: yarn run lint

Expand All @@ -76,18 +100,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: 18.x
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Load cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-docker-modules-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --frozen-lockfile --ignore-engines
- name: Install Lerna Docker
run: sh -c "`curl -fsSl https://raw.githubusercontent.com/rubensworks/lerna-docker/master/install.sh`"
- name: Build Docker images
Expand All @@ -103,23 +127,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: 18.x
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Load cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-docs-modules-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --frozen-lockfile --ignore-engines
- name: Build docs
run: yarn run doc
- name: Deploy TSDoc to GitHub Pages
if: startsWith(github.ref, 'refs/heads/master')
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: documentation
Expand All @@ -132,18 +156,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: 18.x
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Load cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-webclients-modules-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --frozen-lockfile --ignore-engines
- name: Build web clients
run: ./web-clients/build-web-clients.sh
- name: Deploy web clients
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"test": "yarn run test:unit && yarn run test:system -i packages/",
"test-ci:unit": "jest packages/ --ci --maxWorkers=4 --coverage",
"test-ci:system": "jest engines/ --ci --maxWorkers=4 --coverage=false",
"test-ci": "yarn run test-ci:unit && yarn run test-ci:system",
"test-browser": "karma start karma.config.js --single-run || true",
"test-browser": "karma start karma.config.js --single-run",
"lint": "eslint . --cache",
"lint-fix": "eslint . --fix",
"clean": "tsc --build --clean && rm -rf ./node_modules && rm -rf ./packages/*/node_modules",
Expand Down

0 comments on commit 4aa2cf1

Please sign in to comment.