Skip to content

Commit 75552e6

Browse files
authored
CI improvements and GraphQL v16 support (#1930)
* Improve CI * Improve CI * Add missing script * Add tscheck script * :) * Fix lint * Fix v14 * Fix match-graphql * :)) * Skip federation testts for non v15 * Fix for v16 * Bump wrap * Improve CI cache * Add changeset * Ignore node version in benchmark
1 parent e78abcc commit 75552e6

23 files changed

+1487
-376
lines changed

.changeset/tasty-hounds-trade.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphql-modules': minor
3+
---
4+
5+
feat: GraphQL v16 support

.github/workflows/benchmark.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
node_version: [12, 16]
11+
node_version: [12, 17]
1212
env:
1313
CI: true
1414

@@ -26,13 +26,14 @@ jobs:
2626
name: Cache node_modules
2727
with:
2828
path: '**/node_modules'
29-
key: ${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
29+
key: ${{ runner.os }}-yarn-${{ matrix.node_version }}-15-${{ hashFiles('**/yarn.lock') }}
3030
restore-keys: |
31-
${{ runner.os }}-yarn-${{ matrix.node_version }}
31+
${{ runner.os }}-yarn-${{ matrix.node_version }}-15-
32+
${{ runner.os }}-yarn-${{ matrix.node_version }}-
3233
${{ runner.os }}-yarn-
3334
3435
- name: Install
35-
run: yarn
36+
run: yarn --ignore-engines
3637

3738
- name: Build
3839
run: yarn build

.github/workflows/canary.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Use Node
1919
uses: actions/setup-node@v2
2020
with:
21-
node-version: '14.x'
21+
node-version: 17
2222
- name: Configure Git Credentials
2323
run: |
2424
git config --global user.email "[email protected]"
@@ -32,9 +32,10 @@ jobs:
3232
name: Cache node_modules
3333
with:
3434
path: '**/node_modules'
35-
key: ${{ runner.os }}-yarn-14-${{ hashFiles('**/yarn.lock') }}
35+
key: ${{ runner.os }}-yarn-17-15-${{ hashFiles('**/yarn.lock') }}
3636
restore-keys: |
37-
${{ runner.os }}-yarn-14
37+
${{ runner.os }}-yarn-17-15
38+
${{ runner.os }}-yarn-17
3839
${{ runner.os }}-yarn-
3940
- name: Install Dependencies using Yarn
4041
run: yarn install --ignore-engines && git checkout yarn.lock

.github/workflows/ci.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Use Node
2727
uses: actions/setup-node@v2
2828
with:
29-
node-version: '14.x'
29+
node-version: 17
3030
- name: Setup NPM credentials
3131
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
3232
env:
@@ -35,9 +35,10 @@ jobs:
3535
name: Cache node_modules
3636
with:
3737
path: '**/node_modules'
38-
key: ${{ runner.os }}-yarn-14-${{ hashFiles('**/yarn.lock') }}
38+
key: ${{ runner.os }}-yarn-17-15-${{ hashFiles('**/yarn.lock') }}
3939
restore-keys: |
40-
${{ runner.os }}-yarn-14
40+
${{ runner.os }}-yarn-17-15-
41+
${{ runner.os }}-yarn-17-
4142
${{ runner.os }}-yarn-
4243
- name: Install Dependencies using Yarn
4344
run: yarn install --ignore-engines && git checkout yarn.lock

.github/workflows/tests.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request: {}
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Master
15+
uses: actions/checkout@v2
16+
- name: Use Node
17+
uses: actions/setup-node@master
18+
with:
19+
node-version: 17
20+
- name: Cache Yarn
21+
uses: actions/cache@v2
22+
with:
23+
path: '**/node_modules'
24+
key: ${{ runner.os }}-17-15-yarn-${{ hashFiles('yarn.lock') }}
25+
restore-keys: |
26+
${{ runner.os }}-17-15-yarn
27+
- name: Install Dependencies using Yarn
28+
run: yarn install --ignore-engines && git checkout yarn.lock
29+
- name: Lint
30+
run: yarn lint
31+
build:
32+
name: Type Check on GraphQL v${{matrix.graphql_version}}
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
graphql_version:
37+
- 14
38+
- 15
39+
- 16.0.0-rc.7
40+
steps:
41+
- name: Checkout Master
42+
uses: actions/checkout@v2
43+
- name: Use Node
44+
uses: actions/setup-node@master
45+
with:
46+
node-version: 17
47+
- name: Cache Yarn
48+
uses: actions/cache@v2
49+
with:
50+
path: '**/node_modules'
51+
key: ${{ runner.os }}-17-${{matrix.graphql_version}}-yarn-${{ hashFiles('yarn.lock') }}
52+
restore-keys: |
53+
${{ runner.os }}-17-${{matrix.graphql_version}}-yarn-
54+
- name: Use GraphQL v${{matrix.graphql_version}}
55+
run: node ./scripts/match-graphql.js ${{matrix.graphql_version}}
56+
- name: Install Dependencies using Yarn
57+
run: yarn install --ignore-engines && git checkout yarn.lock
58+
- name: Type Check
59+
run: yarn ts:check
60+
test:
61+
name: Unit Test on Node ${{matrix.node-version}} (${{matrix.os}}) and GraphQL v${{matrix.graphql_version}}
62+
runs-on: ${{matrix.os}}
63+
strategy:
64+
matrix:
65+
os: [ubuntu-latest] # remove windows to speed up the tests
66+
node-version: [12, 17]
67+
graphql_version:
68+
- 14
69+
- 15
70+
- 16.0.0-rc.7
71+
steps:
72+
- name: Checkout Master
73+
uses: actions/checkout@v2
74+
- name: Use Node
75+
uses: actions/setup-node@master
76+
with:
77+
node-version: ${{ matrix.node-version }}
78+
- name: Cache Yarn
79+
uses: actions/cache@v2
80+
with:
81+
path: '**/node_modules'
82+
key: ${{ runner.os }}-${{matrix.node-version}}-${{matrix.graphql_version}}-yarn-${{ hashFiles('yarn.lock') }}
83+
restore-keys: |
84+
${{ runner.os }}-${{matrix.node-version}}-${{matrix.graphql_version}}-yarn-
85+
- name: Use GraphQL v${{matrix.graphql_version}}
86+
run: node ./scripts/match-graphql.js ${{matrix.graphql_version}}
87+
- name: Install Dependencies using Yarn
88+
run: yarn install --ignore-engines && git checkout yarn.lock
89+
- name: Cache Jest
90+
uses: actions/cache@v2
91+
with:
92+
path: .cache/jest
93+
key: ${{ runner.os }}-${{matrix.node-version}}-${{matrix.graphql_version}}-jest-${{ hashFiles('yarn.lock') }}
94+
restore-keys: |
95+
${{ runner.os }}-${{matrix.node-version}}-${{matrix.graphql_version}}-jest-
96+
- name: Test
97+
run: yarn test --ci
98+
env:
99+
CI: true
100+
test_esm:
101+
name: ESM Test
102+
runs-on: ubuntu-latest
103+
steps:
104+
- name: Checkout Master
105+
uses: actions/checkout@v2
106+
- name: Use Node
107+
uses: actions/setup-node@master
108+
with:
109+
node-version: 17
110+
- name: Cache Yarn
111+
uses: actions/cache@v2
112+
with:
113+
path: '**/node_modules'
114+
key: ${{ runner.os }}-17-15-yarn-${{ hashFiles('yarn.lock') }}
115+
restore-keys: |
116+
${{ runner.os }}-17-15-yarn-
117+
- name: Install Dependencies using Yarn
118+
run: yarn install --ignore-engines && git checkout yarn.lock
119+
- name: Build Packages
120+
run: yarn build
121+
- name: Test ESM
122+
run: node scripts/test-esm.mjs

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"files.exclude": {
3+
"**/.git": true,
4+
"**/.DS_Store": true,
5+
"**/node_modules": true,
6+
"test-lib": true,
7+
"lib": true,
8+
"coverage": true,
9+
"npm": true,
10+
"**/dist": true
11+
},
12+
"typescript.tsdk": "node_modules/typescript/lib"
13+
}

babel.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{ targets: { node: process.versions.node.split('.')[0] } },
6+
],
7+
'@babel/preset-typescript',
8+
],
9+
plugins: [
10+
'babel-plugin-transform-typescript-metadata',
11+
['@babel/plugin-proposal-decorators', { legacy: true }],
12+
'babel-plugin-parameter-decorator',
13+
'@babel/plugin-proposal-class-properties',
14+
],
15+
};

jest.config.base.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@ const CI = !!process.env.CI;
99

1010
module.exports = (dir) => {
1111
return {
12-
preset: 'ts-jest',
1312
testEnvironment: 'node',
1413
rootDir: dir,
15-
globals: {
16-
'ts-jest': {
17-
diagnostics: false,
18-
tsconfig: TSCONFIG_TEST_PATH,
19-
},
20-
},
2114
reporters: ['default'],
2215
modulePathIgnorePatterns: ['dist'],
2316
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,25 @@
99
],
1010
"scripts": {
1111
"postinstall": "patch-package",
12+
"ts:check": "tsc --project tsconfig.json --noEmit",
1213
"build": "tsc --project tsconfig.json && bob build",
1314
"test": "jest",
1415
"prerelease": "yarn build",
1516
"release": "changeset publish",
1617
"release:canary": "(node scripts/canary-release.js && yarn build && yarn changeset publish --tag alpha) || echo Skipping Canary...",
1718
"format": "prettier --write \"packages/**/*.{js,json,css,md,ts,tsx}\"",
1819
"pr": "changeset",
19-
"lint": "eslint \"packages/**\"",
20+
"lint": "eslint \"packages/**/*.{js,jsx,ts,tsx}\"",
2021
"benchmark:basic": "NODE_ENV=production ts-node --project tsconfig.app.json benchmark/basic.case.ts",
2122
"deploy-website": "cd website && yarn && yarn build && mkdir graphql-modules && mv build/* graphql-modules && mv graphql-modules build"
2223
},
2324
"devDependencies": {
2425
"@apollo/federation": "0.33.3",
26+
"@babel/core": "7.15.8",
27+
"@babel/preset-env": "7.15.8",
28+
"@babel/preset-typescript": "7.15.0",
29+
"@babel/plugin-proposal-decorators": "7.15.8",
30+
"@babel/plugin-proposal-class-properties": "7.14.5",
2531
"@changesets/apply-release-plan": "5.0.1",
2632
"@changesets/cli": "2.17.0",
2733
"@graphql-tools/merge": "8.2.1",
@@ -36,14 +42,17 @@
3642
"apollo-server-express": "3.4.0",
3743
"artillery": "1.7.9",
3844
"benchmark": "2.1.4",
45+
"babel-plugin-parameter-decorator": "1.0.16",
46+
"babel-plugin-transform-typescript-metadata": "0.3.2",
47+
"babel-jest": "27.3.1",
3948
"bob-the-bundler": "1.5.1",
4049
"chalk": "4.1.2",
4150
"dataloader": "2.0.0",
4251
"eslint": "7.32.0",
4352
"express": "4.17.1",
4453
"express-graphql": "0.11.0",
4554
"globby": "11.0.4",
46-
"graphql": "15.7.0",
55+
"graphql": "15.7.1",
4756
"graphql-subscriptions": "1.2.1",
4857
"husky": "7.0.4",
4958
"jest": "27.3.1",

0 commit comments

Comments
 (0)