Skip to content

Commit

Permalink
[FEATURE] Test all supported TS versions in CI
Browse files Browse the repository at this point in the history
As part of implementing RFC 0800, introduce support for testing all
supported versions of TypeScript against our types. For the moment, the
only additional supported version is the TypeScript nightly (`next`)
build. When we get to publishing stable types, the current version will
be the first version we support, and we will add new versions to the
matrix over time in line with the "rolling window" support policy.

Additionally, *remove* type checking from the `lint` scripts and create
a new set of `type-check` scripts instead. This is pragmatic, not
philosophical: we treat it differently from the "lints" here in that we
need to be able to run it repeatedly against different versions,
whereas the lints are all one-and-done.
  • Loading branch information
chriskrycho committed Sep 27, 2022
1 parent 3ec1778 commit 5bb4934
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 15 deletions.
88 changes: 77 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,40 @@ jobs:
- name: linting
run: yarn lint

types:
name: Type Checking (current version)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12.x
cache: yarn
- name: install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Check types
run: yarn type-check

types-range:
name: Type Checking (other supported versions)
runs-on: ubuntu-latest
needs: ['types']
strategy:
matrix:
ts-version: ['next']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12.x
cache: yarn
- name: install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: install TS@${{matrix.ts-version}}
run: yarn add -D typescript@${{ matrix.ts-version }}
- name: Check types with TS@${{matrix.ts-version}}
run: yarn type-check

basic-test:
name: Debug and Prebuilt (All Tests by Package + Canary Features)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -61,7 +95,7 @@ jobs:
browserstack-test:
name: Browserstack Tests (Safari, Edge)
runs-on: ubuntu-latest
needs: [basic-test, lint]
needs: [basic-test, lint, types]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -87,7 +121,7 @@ jobs:
smoke-test:
name: Smoke tests (Full Ember Apps)
runs-on: ubuntu-latest
needs: [basic-test, lint]
needs: [basic-test, lint, types]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
Expand All @@ -110,7 +144,7 @@ jobs:
production-test:
name: Production (All Tests + Canary Features)
runs-on: ubuntu-latest
needs: [basic-test, lint]
needs: [basic-test, lint, types]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -130,7 +164,7 @@ jobs:
production-debug-render-test:
name: Production (All Tests + Canary Features with Debug Render Tree)
runs-on: ubuntu-latest
needs: [basic-test, lint]
needs: [basic-test, lint, types]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -151,7 +185,7 @@ jobs:
extend-prototypes-test:
name: Extend Prototypes
runs-on: ubuntu-latest
needs: [basic-test, lint]
needs: [basic-test, lint, types]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -172,7 +206,7 @@ jobs:
node-test:
name: Node.js Tests
runs-on: ubuntu-latest
needs: [basic-test, lint]
needs: [basic-test, lint, types]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down Expand Up @@ -212,7 +246,7 @@ jobs:
browser-test:
name: Browser Tests (Firefox)
runs-on: ubuntu-latest
needs: [basic-test, lint]
needs: [basic-test, lint, types]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -236,7 +270,18 @@ jobs:
deploy-tag:
name: Deploy tags to npm
runs-on: ubuntu-latest
needs: [basic-test, lint, browserstack-test, production-test, production-debug-render-test, extend-prototypes-test, node-test, blueprint-test, browser-test]
needs:
[
basic-test,
lint,
browserstack-test,
production-test,
production-debug-render-test,
extend-prototypes-test,
node-test,
blueprint-test,
browser-test,
]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
Expand All @@ -257,7 +302,18 @@ jobs:
publish:
name: Publish channel to s3
runs-on: ubuntu-latest
needs: [basic-test, lint, browserstack-test, production-test, production-debug-render-test, extend-prototypes-test, node-test, blueprint-test, browser-test]
needs:
[
basic-test,
lint,
browserstack-test,
production-test,
production-debug-render-test,
extend-prototypes-test,
node-test,
blueprint-test,
browser-test,
]
# Only run on pushes to branches that are not from the cron workflow
if: github.event_name == 'push' && contains(github.ref, 'cron') != true
steps:
Expand All @@ -280,7 +336,18 @@ jobs:
publish-alpha:
name: Publish alpha from default branch
runs-on: ubuntu-latest
needs: [basic-test, lint, browserstack-test, production-test, production-debug-render-test, extend-prototypes-test, node-test, blueprint-test, browser-test]
needs:
[
basic-test,
lint,
browserstack-test,
production-test,
production-debug-render-test,
extend-prototypes-test,
node-test,
blueprint-test,
browser-test,
]
# Only run on pushes to master
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
Expand All @@ -301,4 +368,3 @@ jobs:
S3_BUCKET_NAME: 'builds.emberjs.com'
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY}}
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID}}

18 changes: 18 additions & 0 deletions .github/workflows/night-ts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Nightly TypeScript Run

jobs:
ts-next:
name: typescript@next
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
- run: yarn install --frozen-lockfile --non-interactive
- run: yarn add -D typescript@next
- run: yarn type-check

# ...nightly at midnight
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
"lint:docs": "qunit tests/docs/coverage-test.js",
"lint:eslint": "eslint --report-unused-disable-directives --cache .",
"lint:eslint:fix": "npm-run-all \"lint:eslint --fix\"",
"lint:tsc:stable": "tsc --noEmit",
"lint:tsc:preview": "tsc --noEmit --project type-tests/preview",
"lint:tsc": "npm-run-all lint:tsc:*",
"lint:fix": "npm-run-all lint:*:fix",
"test": "node bin/run-tests.js",
"test:blueprints:js": "mocha node-tests/blueprints/**/*-test.js",
"test:blueprints:ts": "EMBER_TYPESCRIPT_BLUEPRINTS=true yarn test:blueprints:js",
"test:blueprints": "yarn test:blueprints:js && yarn test:blueprints:ts",
"test:node": "qunit tests/node/**/*-test.js",
"test:browserstack": "node bin/run-browserstack-tests.js"
"test:browserstack": "node bin/run-browserstack-tests.js",
"type-check:stable": "tsc --noEmit",
"type-check:preview": "tsc --noEmit --project type-tests/preview",
"type-check": "npm-run-all type-check:*"
},
"dependencies": {
"@babel/helper-module-imports": "^7.16.7",
Expand Down

0 comments on commit 5bb4934

Please sign in to comment.