Skip to content

Commit

Permalink
Improve CI (#1704)
Browse files Browse the repository at this point in the history
* Improve CI

* check caching

* do not use globs

* use ts-jest again

* another attempts

* Better cache keys'

* better cache keys

* BETTER BETTER CACHE KEYS

* ANOTHER ROUND
  • Loading branch information
ardatan committed Feb 25, 2021
1 parent 9ac16d6 commit 5b4f070
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 69 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ jobs:
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-15-yarn-${{ hashFiles('yarn.lock') }}
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-15-yarn-
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-
${{ runner.os }}-node-modules-15-
${{ runner.os }}-node-modules-
node-modules-
- name: Install Dependencies using Yarn
run: yarn install && git checkout yarn.lock && yarn patch-package
- name: Release Canary
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ jobs:
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-15-yarn-${{ hashFiles('yarn.lock') }}
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-15-yarn-
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-
${{ runner.os }}-node-modules-15-
${{ runner.os }}-node-modules-
node-modules-
- name: Install Dependencies using Yarn
run: yarn install && git checkout yarn.lock && yarn patch-package
- name: Create Release Pull Request or Publish to npm
Expand Down
47 changes: 26 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 15
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-15-yarn-${{ hashFiles('yarn.lock') }}
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-15-yarn-
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-
${{ runner.os }}-node-modules-15-
${{ runner.os }}-node-modules-
node-modules-
- name: Install Dependencies using Yarn
run: yarn install && git checkout yarn.lock
- name: Lint
Expand All @@ -47,16 +48,17 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 15
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-15-yarn-${{ hashFiles('yarn.lock') }}
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-15-yarn-
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-
${{ runner.os }}-node-modules-15-
${{ runner.os }}-node-modules-
node-modules-
- name: Install Dependencies using Yarn
run: yarn install && git checkout yarn.lock
- name: Build
Expand All @@ -79,26 +81,29 @@ jobs:
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node_version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-${{matrix.node_version}}-yarn-${{ hashFiles('yarn.lock') }}
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{matrix.node_version}}-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{matrix.node_version}}-yarn-
${{ runner.os }}-node-modules-${{matrix.node_version}}-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-node-modules-${{matrix.node_version}}-${{ hashFiles('**/package.json') }}-
${{ runner.os }}-node-modules-${{matrix.node_version}}-
${{ runner.os }}-node-modules-
- name: Install Dependencies using Yarn
run: yarn install && git checkout yarn.lock
- name: Cache Jest
uses: actions/cache@v2
with:
path: .cache/jest
key: ${{ runner.os }}-${{matrix.node_version}}-jest-${{ hashFiles('yarn.lock') }}
key: ${{ runner.os }}-jest-${{matrix.node_version}}-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{matrix.node_version}}-jest-
${{ runner.os }}-jest-${{matrix.node_version}}-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-jest-${{matrix.node_version}}-${{ hashFiles('**/package.json') }}-
${{ runner.os }}-jest-${{matrix.node_version}}-
${{ runner.os }}-jest-
- name: Test
run: yarn test --logHeapUsage --ci
run: yarn test
env:
CI: true
13 changes: 7 additions & 6 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: '15.x'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-15-yarn-${{ hashFiles('yarn.lock') }}
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-15-yarn-
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-node-modules-15-${{ hashFiles('**/package.json') }}-
${{ runner.os }}-node-modules-15-
${{ runner.os }}-node-modules-
node-modules-
- name: Install Dependencies using Yarn
run: yarn install && git checkout yarn.lock
- name: Deploy 🚀
Expand Down
3 changes: 1 addition & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
plugins: ['@babel/plugin-proposal-class-properties'],
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
};
8 changes: 8 additions & 0 deletions examples/thrift-calculator/tests/thrift-calculator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import { introspectionFromSchema, lexicographicSortSchema } from 'graphql';
import { loadDocuments } from '@graphql-tools/load';
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
import thriftServer from '../src/main';
import { mkdirSync, writeFileSync } from 'fs';

const problematicModulePath = join(__dirname, '../../../node_modules/core-js/modules');
const emptyModuleContent = 'module.exports = {};';

// Fix core-js issue
mkdirSync(problematicModulePath, { recursive: true });
writeFileSync(join(problematicModulePath, './es.array.join.js'), emptyModuleContent);

const config$ = findAndParseConfig({
dir: join(__dirname, '..'),
Expand Down
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ const TSCONFIG = resolve(ROOT_DIR, 'tsconfig.json');
const tsconfig = require(TSCONFIG);

module.exports = {
transform: { '^.+\\.tsx?$': 'ts-jest', '^.+\\.jsx?$': 'babel-jest' },
testEnvironment: 'node',
rootDir: ROOT_DIR,
globals: {
'ts-jest': {
diagnostics: false,
tsconfig: TSCONFIG,
babelConfig: true,
},
},
restoreMocks: true,
reporters: ['default'],
modulePathIgnorePatterns: ['dist'],
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
"@ardatan/graphql-to-config-schema": "0.1.8",
"@babel/core": "7.13.1",
"@babel/preset-env": "7.13.5",
"@babel/preset-typescript": "7.13.0",
"@babel/plugin-proposal-class-properties": "7.13.0",
"@changesets/cli": "2.14.0",
"@graphql-tools/schema": "7.1.3",
"@types/jest": "26.0.20",
Expand Down
27 changes: 1 addition & 26 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@
"@babel/helper-create-class-features-plugin" "^7.12.1"
"@babel/helper-plugin-utils" "^7.10.4"

"@babel/plugin-proposal-class-properties@7.13.0", "@babel/plugin-proposal-class-properties@^7.13.0":
"@babel/plugin-proposal-class-properties@^7.13.0":
version "7.13.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.13.0.tgz#146376000b94efd001e57a40a88a525afaab9f37"
integrity sha512-KnTDjFNC1g+45ka0myZNvSBFLhNCLN+GeGYLDEA8Oq7MZ6yMgfLoIRh86GRT0FjtJhZw8JyUskP9uvj5pHM9Zg==
Expand Down Expand Up @@ -1337,13 +1337,6 @@
dependencies:
"@babel/helper-plugin-utils" "^7.10.4"

"@babel/plugin-syntax-typescript@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.12.13.tgz#9dff111ca64154cef0f4dc52cf843d9f12ce4474"
integrity sha512-cHP3u1JiUiG2LFDKbXnwVad81GvfyIOmCD6HIEId6ojrY0Drfy2q1jw7BwN7dE84+kTnBjLkXoL3IEy/3JPu2w==
dependencies:
"@babel/helper-plugin-utils" "^7.12.13"

"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.12.1":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.12.1.tgz#8083ffc86ac8e777fbe24b5967c4b2521f3cb2b3"
Expand Down Expand Up @@ -1942,15 +1935,6 @@
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-syntax-typescript" "^7.12.1"

"@babel/plugin-transform-typescript@^7.13.0":
version "7.13.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.13.0.tgz#4a498e1f3600342d2a9e61f60131018f55774853"
integrity sha512-elQEwluzaU8R8dbVuW2Q2Y8Nznf7hnjM7+DSCd14Lo5fF63C9qNLbwZYbmZrtV9/ySpSUpkRpQXvJb6xyu4hCQ==
dependencies:
"@babel/helper-create-class-features-plugin" "^7.13.0"
"@babel/helper-plugin-utils" "^7.13.0"
"@babel/plugin-syntax-typescript" "^7.12.13"

"@babel/plugin-transform-unicode-escapes@^7.12.1":
version "7.12.1"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.12.1.tgz#5232b9f81ccb07070b7c3c36c67a1b78f1845709"
Expand Down Expand Up @@ -2255,15 +2239,6 @@
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-transform-typescript" "^7.12.1"

"@babel/preset-typescript@7.13.0":
version "7.13.0"
resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.13.0.tgz#ab107e5f050609d806fbb039bec553b33462c60a"
integrity sha512-LXJwxrHy0N3f6gIJlYbLta1D9BDtHpQeqwzM0LIfjDlr6UE/D5Mc7W4iDiQzaE+ks0sTjT26ArcHWnJVt0QiHw==
dependencies:
"@babel/helper-plugin-utils" "^7.13.0"
"@babel/helper-validator-option" "^7.12.17"
"@babel/plugin-transform-typescript" "^7.13.0"

"@babel/preset-typescript@^7.12.7":
version "7.12.7"
resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.12.7.tgz#fc7df8199d6aae747896f1e6c61fc872056632a3"
Expand Down

0 comments on commit 5b4f070

Please sign in to comment.