ethers.js/.github/workflows/test-ci.yml

110 lines
2.5 KiB
YAML
Raw Permalink Normal View History

2022-12-05 22:19:41 -05:00
name: CI Tests
2022-09-30 19:31:00 -04:00
on:
push:
branches:
- main
2023-02-22 04:49:50 -05:00
paths:
- "src.ts/**"
2023-04-28 00:56:38 +09:00
- "lib.esm/**"
- "lib.commonjs/**"
2022-09-30 19:31:00 -04:00
jobs:
test-node:
2022-12-03 17:02:20 -05:00
#if: ${{ false }} # disable for now
2022-09-30 19:31:00 -04:00
2022-09-30 20:24:29 -04:00
name: Run Node.js Tests
2022-09-30 20:05:00 -04:00
2022-09-30 19:31:00 -04:00
runs-on: ubuntu-latest
2022-10-20 05:04:12 -04:00
environment: ethers-tests
env:
FAUCET_PRIVATEKEY: ${{ secrets.FAUCET_PRIVATEKEY }}
2022-09-30 19:31:00 -04:00
strategy:
fail-fast: false
matrix:
node-version: [ 18.x, 20.x ]
2022-09-30 19:38:49 -04:00
test-type: [ esm, commonjs ]
2022-09-30 19:31:00 -04:00
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install and run Geth
2023-03-20 12:59:57 -04:00
uses: ethers-io/run-geth-action@main
2022-09-30 19:31:00 -04:00
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Build ESM and CommonJS (from TypeScript)
run: npm run build-all
- name: Run tests (${{ matrix.test-type }})
2022-09-30 19:38:49 -04:00
run: npm run test-${{ matrix.test-type }}
2022-09-30 19:31:00 -04:00
coverage:
2022-12-03 17:02:20 -05:00
#if: ${{ false }} # disable for now
2022-09-30 19:31:00 -04:00
2022-09-30 20:24:29 -04:00
name: Generate Coverage Report
2022-09-30 19:31:00 -04:00
runs-on: ubuntu-latest
2022-10-20 05:04:12 -04:00
environment: ethers-tests
env:
FAUCET_PRIVATEKEY: ${{ secrets.FAUCET_PRIVATEKEY }}
2022-09-30 19:31:00 -04:00
continue-on-error: true
steps:
- uses: actions/setup-node@v1
with:
node-version: 20.x
2022-09-30 19:31:00 -04:00
- name: Install and run Geth
2023-03-20 12:59:57 -04:00
uses: ethers-io/run-geth-action@main
2022-09-30 19:31:00 -04:00
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
- name: Build ESM (from TypeScript)
run: npm run build
2022-11-09 02:58:06 -05:00
- name: Run coverage tests
2022-09-30 19:31:00 -04:00
run: npm run test-coverage
2022-11-09 02:58:06 -05:00
- name: Store coverage summary artifact
2022-09-30 19:31:00 -04:00
uses: actions/upload-artifact@v2
with:
name: coverage-summary
path: ./output/summary.txt
2022-11-09 02:58:06 -05:00
- name: Tar coverage files
2022-09-30 19:31:00 -04:00
run: tar -cvf ./output/coverage.tar ./output/lcov-report/
2022-11-09 02:58:06 -05:00
- name: Store full coverage artifact
2022-09-30 19:31:00 -04:00
uses: actions/upload-artifact@v2
with:
name: coverage-complete
path: ./output/coverage.tar
2022-10-20 19:51:11 -04:00
2022-10-20 20:57:38 -04:00
- name: Upload coverage to to build.ethers.org
2022-10-20 19:54:28 -04:00
uses: ethers-io/sync-s3-action@main
2022-10-20 19:51:11 -04:00
with:
aws_access_key_id: ${{ secrets.BUILD_AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.BUILD_AWS_SECRET_ACCESS_KEY}}
2022-10-20 20:57:38 -04:00
aws_s3_bucket: ethers.org
2022-10-20 19:51:11 -04:00
source_folder: 'output/'
2022-10-20 20:57:38 -04:00
destination_prefix: 'build/output/'
2022-10-20 19:51:11 -04:00
aws_cloudfront_id: ${{ secrets.BUILD_AWS_CLOUDFRONT_ID }}