Skip to content

Add DefinitelyTyped tests to CI #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
56 changes: 56 additions & 0 deletions .github/workflows/test_dt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test DT subset
on: [pull_request]

jobs:
test_shard:
runs-on: ubuntu-latest
strategy:
matrix:
job_position: [1, 2, 3, 4, 5, 6]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "15.x"
registry-url: "https://registry.npmjs.org"
- run: npm install
- run: npm run build

- name: Setup
run: |
mkdir tester
cd tester
yarn init -y
yarn add typescript@next
yarn add @definitelytyped/dtslint-runner

- name: Tests
run: |
cd tester
echo "Nightly run: Shard $SYSTEM_JOBPOSITIONINPHASE of $SYSTEM_TOTALJOBSINPHASE"
yarn dtslint-runner --clone --localTypeScriptPath node_modules/typescript/lib --selection all --expectOnly --shardId $SYSTEM_JOBPOSITIONINPHASE --shardCount $SYSTEM_TOTALJOBSINPHASE 2>nightlyErrors.txt

cp $GITHUB_WORKSPACE/generated/dom.generated.d.ts node_modules/typescript/lib/lib.dom.d.ts
cp $GITHUB_WORKSPACE/generated/dom.iterable.generated.d.ts node_modules/typescript/lib/lib.dom.iterable.d.ts
cp $GITHUB_WORKSPACE/generated/webworker.generated.d.ts node_modules/typescript/lib/lib.webworker.d.ts
cp $GITHUB_WORKSPACE/generated/webworker.iterable.generated.d.ts node_modules/typescript/lib/lib.webworker.iterable.d.ts

echo "Branch run - Shard $SYSTEM_JOBPOSITIONINPHASE of $SYSTEM_TOTALJOBSINPHASE"
yarn dtslint-runner --clone --localTypeScriptPath node_modules/typescript/lib --selection all --expectOnly --shardId $SYSTEM_JOBPOSITIONINPHASE --shardCount $SYSTEM_TOTALJOBSINPHASE 2>branchErrors.txt
branchRunResult=$

echo
echo "=== Errors only in nightly ==="
diff --changed-group-format='%<' --unchanged-group-format='' nightlyErrors.txt branchErrors.txt | egrep -v '^(===|[12]>)'

echo
echo "=== Errors only in branch ==="
diff --changed-group-format='%>' --unchanged-group-format='' nightlyErrors.txt branchErrors.txt | egrep -v '^(===|[12]>)'

exit $branchRunResult
continue-on-error: true
env:
SYSTEM_JOBPOSITIONINPHASE: ${{ matrix.job_position }}
SYSTEM_TOTALJOBSINPHASE: "6"

10 changes: 10 additions & 0 deletions .github/workflows/test_typescript.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Runs with TypeScript Tests
on: [push, pull_request]

# When it's ready
# on:
# push:
# paths:
# - "baselines/*"
# pull_request:
# paths:
# - "baselines/*"


jobs:
test:
runs-on: ubuntu-latest
Expand Down