-
Notifications
You must be signed in to change notification settings - Fork 17
137 lines (114 loc) · 3.66 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
pull-requests: write
jobs:
unit_tests:
name: Unit tests Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- elixir: "1.14"
otp: "25"
- elixir: "1.12"
otp: "23"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Restore deps cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
- name: Restore _build cache
uses: actions/cache@v3
with:
path: _build
key: ${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
- name: Restore plt cache
if: ${{ matrix.otp == '25' && matrix.elixir == '1.14' }}
uses: actions/cache@v3
with:
path: priv/plts
key: ${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
- name: Install deps
run: mix deps.get
- name: Check Formatting
run: mix format --check-formatted
- name: Run unit tests
run: |
mix clean
mix test
- name: Run unit tests with persistent_term backend
run: |
mix clean
mix test
env:
SCHEMA_PROVIDER: persistent_term
- name: Run dialyzer
if: ${{ matrix.otp == '25' && matrix.elixir == '1.14' }}
run: |
mkdir -p priv/plts/{local,core}
MIX_ENV=test mix dialyzer
federation_compatibility_tests:
name: Federation compatibility tests
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- elixir: "1.14"
otp: "25"
steps:
- name: Save action secrets
id: actionsecrets
shell: bash
run: |
if [ $IS_FORK != "true" ]; then
echo "github_token=$GITHUB_TOKEN" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
- name: Checkout
uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Restore deps cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
- name: Restore _build cache
uses: actions/cache@v3
with:
path: _build
key: ${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
- name: Print federation compatibility schema
run: |
mix deps.get
mix absinthe.federation.schema.sdl --schema ProductsWeb.Schema --out schema.graphql
working-directory: ./federation_compatibility
- name: Test subgraph compatibility
uses: apollographql/federation-subgraph-compatibility@v1
with:
compose: "federation_compatibility_docker_compose.yml"
schema: "federation_compatibility/schema.graphql"
token: ${{ steps.actionsecrets.outputs.github_token }}
port: 4001
failOnWarning: true
failOnRequired: true