forked from dfinity/agent-js
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (107 loc) · 3.15 KB
/
nodejs-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
name: Node.js CI
on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04]
ghc: ['8.8.4']
spec:
- '0.16.1'
node:
- 12
- 14
- 16
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install -g npm
- run: npm install
- run: npm run lint --workspaces --if-present
# build monorepo incl. each subpackage
- run: npm run build --workspaces --if-present
# test monorepo incl. each subpackage
- run: npm run test
env:
CI: true
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- run: pip3 install mitmproxy~=6.0.2
# IC ref checkout and build.
- uses: actions/checkout@v2
with:
repository: 'dfinity/ic-hs'
# Personal Read-only Access Token created by Hans Larsen
path: ic-hs
ref: ${{ matrix.spec }}
- name: Cache ~/.cabal/store
uses: actions/cache@v2
with:
path: |
~/.cabal/store
key: cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('ic-hs/cabal.project', 'ic-hs/cabal.project.freeze') }}
restore-keys: cabal-${{ runner.os }}-${{ matrix.ghc }}-
- uses: actions/[email protected]
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.2'
- name: Cargo cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build ic-ref
run: |
ls -l /opt/ghc/
export PATH=/opt/ghc/bin:$PATH
cabal --version
ghc-${{ matrix.ghc }} --version
mkdir -p $HOME/bin
cd ic-hs
cabal update
cabal install -w ghc-${{ matrix.ghc }} --overwrite-policy=always --installdir=$HOME/bin
- name: Running ic-ref
id: ic_ref
run: |
set -ex
$HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port &
sleep 1
echo "::set-output name=IC_REF_PORT::$(cat $HOME/ic_ref_port)"
- name: Running mitmdump
id: mitmdump
run: |
set -ex
mitmdump -p 8888 --mode reverse:http://localhost:${{ steps.ic_ref.outputs.IC_REF_PORT }} \
--modify-body '/~s/Hello/Hullo' \
--modify-headers '/~s/Transfer-Encoding/' \
&
sleep 1
- run: npm run e2e --workspaces --if-present
env:
CI: true
IC_REF_PORT: ${{ steps.ic_ref.outputs.IC_REF_PORT }}
- name: mitm e2e
env:
CI: true
IC_REF_PORT: 8888
MITM: true
run: npm run mitm --workspaces --if-present
- name: clean up
run: |
killall mitmdump
killall ic-ref