Skip to content

chore: Updated CI to use native arm64 runner #583

chore: Updated CI to use native arm64 runner

chore: Updated CI to use native arm64 runner #583

Workflow file for this run

name: native-metrics CI
on:
pull_request:
push:
branches:
- '**'
tags-ignore: # Do not run for tags
- '**'
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [lts/*]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install
- name: Run Linting
run: npm run lint
- name: Inspect Lockfile
run: npm run lint:lockfile
test_x86_x64:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
node: [ 16, 18, 20, 22 ]
arch: [ x86, x64 ]
exclude:
# Ubuntu does not ship x86 builds.
- { os: ubuntu-latest, arch: x86 }
runs-on: ${{ matrix.os }}
name: "${{ matrix.os }} / Node ${{ matrix.node }} ${{ matrix.arch }}"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/node_modules
key: "${{ matrix.os }}-${{ matrix.arch }}-node-${{ matrix.node }}-${{ hashFiles('./package.json') }}"
- name: Install
run: npm install
- name: Unit Test
run: npm run unit
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/unit/
files: lcov.info
flags: unit-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
- name: Integration Test
run: npm run integration
- name: Post Integration Test Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/integration/
files: lcov.info
flags: integration-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
# Disabled due to the macOS environment in GHA being very inconsistent,
# but also consistently too slow.
# test_macos_arm:
# strategy:
# matrix:
# os: [ macos-14 ]
# node: [ 16, 18, 20, 22 ]
# arch: [ arm64 ]
# runs-on: ${{ matrix.os }}
# name: "${{ matrix.os }} / Node ${{ matrix.node }} ${{ matrix.arch }}"
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - uses: actions/cache@v4
# with:
# path: ${{ github.workspace }}/node_modules
# key: "${{ matrix.os }}-${{ matrix.arch }}-node-${{ matrix.node }}-${{ hashFiles('./package.json') }}"
# - name: Use node ${{ matrix.node }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node }}
# architecture: ${{ matrix.arch }}
# - name: Install
# run: npm install
# - name: Unit Test
# run: npm run unit
# - name: Post Unit Test Coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./coverage/unit/
# files: lcov.info
# flags: unit-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
# - name: Integration Test
# run: npm run integration
# - name: Post Integration Test Coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./coverage/integration/
# files: lcov.info
# flags: integration-tests-${{ matrix.node }}-${{ matrix.os }}-${{ matrix.arch }}
test_linux_arm:
# Skip this group if the PR doesn't originate from the main repo.
# Trying to run this on standard runners is just going to fail due to
# lack of CPU resources.
if: ${{ vars.NR_RUNNER != '' }}
strategy:
matrix:
node: [ 16, 18, 20, 22 ]
runs-on: ${{ vars.NR_RUNNER }}
name: Linux / Node ${{ matrix.node }} arm64
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute cache key
run: echo -e "CACHE_KEY=$(shasum -a 256 package.json | cut -f1 -d ' ')" >> "$GITHUB_ENV"
- name: Restore modules cache
id: cache_restore
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/node_modules
key: linux-arm-node-${{ matrix.node }}-${{ env.CACHE_KEY }}
- name: Install
run: npm install
- name: Unit Test
run: npm run unit
- name: Post Unit Test Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/unit/
files: lcov.info
flags: unit-tests-${{ matrix.node }}-linux-arm64
- name: Integration Test
run: npm run integration
- name: Post Integration Test Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/integration
files: lcov.info
flags: integration-tests-${{ matrix.node }}-linux-arm64