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
Open
54 changes: 54 additions & 0 deletions .github/workflows/test_dt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test DT subset
on: [push, pull_request]

jobs:
deploy:
runs-on: ubuntu-latest

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: |
git config --global core.longpaths true
git clone https://github.com/microsoft/DefinitelyTyped-tools $BUILD_SOURCESDIRECTORY/DefinitelyTyped-tools --depth 1
pushd $BUILD_SOURCESDIRECTORY/DefinitelyTyped-tools
echo '1'
npm i
echo '2'
pushd $BUILD_SOURCESDIRECTORY/DefinitelyTyped-tools/packages/dtslint-runner
npm i
echo '3'
npm i typescript@next
node ../../node_modules/typescript/lib/tsc.js
echo '4'

echo "Nightly run: Shard $SYSTEM_JOBPOSITIONINPHASE of $SYSTEM_TOTALJOBSINPHASE"
node ./dist/index.js --clone $DT_SHA --localTypeScriptPath $BUILD_SOURCESDIRECTORY/DefinitelyTyped-tools/packages/dtslint-runner/node_modules/typescript/lib --selection all --expectOnly --shardId $SYSTEM_JOBPOSITIONINPHASE --shardCount $SYSTEM_TOTALJOBSINPHASE 2>nightlyErrors.txt
echo '5'

echo "Branch run: Shard $SYSTEM_JOBPOSITIONINPHASE of $SYSTEM_TOTALJOBSINPHASE"
node ./dist/index.js --clone $DT_SHA --localTypeScriptPath $BUILD_SOURCESDIRECTORY/built/local --selection all --expectOnly --shardId $SYSTEM_JOBPOSITIONINPHASE --shardCount $SYSTEM_TOTALJOBSINPHASE 2>branchErrors.txt
branchRunResult=$?
echo '6'

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
env:
BUILD_SOURCESDIRECTORY: "/tmp/build"
SYSTEM_JOBPOSITIONINPHASE: "0"
SYSTEM_TOTALJOBSINPHASE: "6"