Skip to content

Commit f9f760b

Browse files
committed
Setup Github workflow
1 parent f0e72b7 commit f9f760b

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Test And Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test-and-build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
graphql-version: ['~14.6', '~14.7', '~15.0', '~16.0']
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: 'latest'
25+
26+
- name: Restore cache
27+
uses: actions/cache@v2
28+
with:
29+
path: node_modules
30+
key: v1-dependencies-${{ hashFiles('package.json') }}-${{ matrix.graphql-version }}
31+
restore-keys: |
32+
v1-dependencies-
33+
34+
- name: Install dependencies
35+
if: matrix.graphql-version != ''
36+
run: yarn install --ignore-scripts
37+
38+
- name: Add specific graphql version
39+
if: matrix.graphql-version != ''
40+
run: yarn --ignore-scripts add --dev graphql@${{ matrix.graphql-version }}
41+
42+
- name: Install dependencies with frozen lockfile
43+
if: matrix.graphql-version == ''
44+
run: yarn install --frozen-lockfile
45+
46+
- name: Save cache
47+
uses: actions/cache@v2
48+
with:
49+
path: node_modules
50+
key: v1-dependencies-${{ hashFiles('package.json') }}-${{ matrix.graphql-version }}
51+
52+
- name: Run tests
53+
run: yarn test
54+
55+
test-and-build-with-typecheck:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v2
60+
61+
- name: Set up Node.js
62+
uses: actions/setup-node@v2
63+
with:
64+
node-version: 'latest'
65+
66+
- name: Restore cache
67+
uses: actions/cache@v2
68+
with:
69+
path: node_modules
70+
key: v1-dependencies-${{ hashFiles('package.json') }}
71+
restore-keys: |
72+
v1-dependencies-
73+
74+
- name: Install dependencies
75+
run: yarn install --frozen-lockfile
76+
77+
- name: Save cache
78+
uses: actions/cache@v2
79+
with:
80+
path: node_modules
81+
key: v1-dependencies-${{ hashFiles('package.json') }}
82+
83+
- name: Run tests
84+
run: yarn test

0 commit comments

Comments
 (0)