|
10 | 10 | - main |
11 | 11 | - release-* |
12 | 12 |
|
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
13 | 16 | jobs: |
14 | 17 | test: |
15 | 18 | runs-on: ubuntu-latest |
|
39 | 42 | - run: npm ci |
40 | 43 |
|
41 | 44 | - name: Tests |
42 | | - run: npm run test -- --bundle=${{ matrix.bundle }} |
| 45 | + # run tests, but lint separately |
| 46 | + run: npm run test -- --no-lint --bundle=${{ matrix.bundle }} |
43 | 47 |
|
44 | 48 | lint: |
45 | 49 | runs-on: ubuntu-latest |
@@ -91,65 +95,76 @@ jobs: |
91 | 95 |
|
92 | 96 | steps: |
93 | 97 | - uses: actions/checkout@v3 |
| 98 | + |
94 | 99 | - uses: actions/setup-node@v3 |
95 | 100 | with: |
96 | 101 | node-version: "*" |
97 | 102 | check-latest: true |
| 103 | + - run: | |
| 104 | + corepack enable npm |
| 105 | + npm --version |
| 106 | + |
98 | 107 | - run: npm ci |
99 | 108 |
|
100 | 109 | - run: npx hereby lkg |
101 | 110 | - run: | |
102 | 111 | npm pack |
103 | 112 | mv typescript*.tgz typescript.tgz |
104 | | - echo "PACKAGE=$PWD/typescript.tgz" >> $GITHUB_ENV |
| 113 | + echo "package=$PWD/typescript.tgz" >> "$GITHUB_OUTPUT" |
| 114 | + id: pack |
105 | 115 |
|
106 | 116 | - name: Smoke test |
107 | 117 | run: | |
108 | 118 | cd "$(mktemp -d)" |
109 | 119 | npm init --yes |
110 | | - npm install $PACKAGE tslib |
| 120 | + npm install ${{ steps.pack.outputs.package }} |
111 | 121 |
|
112 | 122 | echo "Testing tsc..." |
113 | 123 | npx tsc --version |
114 | 124 |
|
115 | 125 | echo "Testing tsserver..." |
116 | 126 | echo '{"seq": 1, "command": "status"}' | npx tsserver |
117 | 127 |
|
118 | | - cat > smoke.js << 'EOF' |
119 | | - console.log(`Testing ${process.argv[2]}...`); |
120 | | - const { __importDefault, __importStar } = require("tslib"); |
121 | | - const ts = require(process.argv[2]); |
122 | | -
|
123 | | - // See: https://github.com/microsoft/TypeScript/pull/51474#issuecomment-1310871623 |
124 | | - const fns = [ |
125 | | - [() => ts.version, true], |
126 | | - [() => ts.default.version, false], |
127 | | - [() => __importDefault(ts).version, false], |
128 | | - [() => __importDefault(ts).default.version, true], |
129 | | - [() => __importStar(ts).version, true], |
130 | | - [() => __importStar(ts).default.version, true], |
131 | | - ]; |
132 | | -
|
133 | | - for (const [fn, shouldSucceed] of fns) { |
134 | | - let success = false; |
135 | | - try { |
136 | | - success = !!fn(); |
137 | | - } |
138 | | - catch {} |
139 | | - const status = success ? "succeeded" : "failed"; |
140 | | - if (success === shouldSucceed) { |
141 | | - console.log(`${fn.toString()} ${status} as expected.`); |
142 | | - } |
143 | | - else { |
144 | | - console.log(`${fn.toString()} unexpectedly ${status}.`); |
145 | | - process.exitCode = 1; |
146 | | - } |
147 | | - } |
148 | | - console.log("ok"); |
149 | | - EOF |
150 | | -
|
151 | | - node ./smoke.js typescript |
152 | | - node ./smoke.js typescript/lib/tsserverlibrary |
| 128 | + node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript |
| 129 | + node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript/lib/tsserverlibrary |
| 130 | +
|
| 131 | + package-size: |
| 132 | + runs-on: ubuntu-latest |
| 133 | + if: github.event_name == 'pull_request' |
| 134 | + |
| 135 | + steps: |
| 136 | + - uses: actions/checkout@v3 |
| 137 | + with: |
| 138 | + path: pr |
| 139 | + |
| 140 | + - uses: actions/checkout@v3 |
| 141 | + with: |
| 142 | + path: base |
| 143 | + ref: ${{ github.base_ref }} |
| 144 | + |
| 145 | + - uses: actions/setup-node@v3 |
| 146 | + with: |
| 147 | + node-version: "*" |
| 148 | + check-latest: true |
| 149 | + - run: | |
| 150 | + corepack enable npm |
| 151 | + npm --version |
| 152 | +
|
| 153 | + - run: npm ci |
| 154 | + working-directory: ./pr |
| 155 | + |
| 156 | + - run: npm ci |
| 157 | + working-directory: ./base |
| 158 | + |
| 159 | + - run: npx hereby lkg |
| 160 | + working-directory: ./pr |
| 161 | + |
| 162 | + - run: npx hereby lkg |
| 163 | + working-directory: ./base |
| 164 | + |
| 165 | + - run: | |
| 166 | + echo "See $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID for more info." |
| 167 | + node ./pr/scripts/checkPackageSize.mjs ./base ./pr >> $GITHUB_STEP_SUMMARY |
153 | 168 |
|
154 | 169 | misc: |
155 | 170 | runs-on: ubuntu-latest |
|
0 commit comments