forked from entrepreneur-interet-general/opensignauxfaibles
-
Notifications
You must be signed in to change notification settings - Fork 1
169 lines (145 loc) · 4.88 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI
on:
push:
branches:
jobs:
go-tests:
name: Go tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
- run: go test -v -coverprofile=go-coverage.out -covermode=atomic -coverpkg=./... ./...
- name: Show coverage
run: go tool cover -func=go-coverage.out
# - name: Generate coverage report
# run: go run github.com/richardlt/gocover-cobertura < go-coverage.out > go-coverage.xml
# - uses: actions/upload-artifact@v3
# with:
# name: go-coverage-report
# path: go-coverage.xml
mr-tests:
name: Map-Reduce tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ./js/.nvmrc
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install --prefer-offline --no-audit
working-directory: js
- name: Reveal golden master files for tests
uses: entrostat/git-secret-action@v4
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY_FOR_GIT_SECRET }}
gpg-private-key-passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
- name: Run tests + generate coverage report
working-directory: js
run: npm run test:coverage # stores the coverage report in ./coverage/lcov.info
- uses: actions/upload-artifact@v3
with:
name: mr-coverage-report
path: js/coverage/lcov.info
build:
name: Generate and lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
- run: make build
- uses: actions/setup-node@v4
with:
node-version-file: ./js/.nvmrc
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install --prefer-offline --no-audit
working-directory: js
- name: Check that generated files are up to date (jsFunctions.go and variables.json)
run: |
go generate -x ./...
git diff
exit $(git diff | wc -l)
- run: npm run lint
working-directory: js
- name: Typescript type checks
run: npx tsc --noEmit
working-directory: js
e2e-tests:
name: End-to-end tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
- name: Reveal golden master files for tests
uses: entrostat/git-secret-action@v4
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY_FOR_GIT_SECRET }}
gpg-private-key-passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
- run: make build
- name: Remove source code
run: |
# delete all files, except the binary, config, NAF and other data files used by tests
find . \
! -name 'sfdata' \
! -name '*.toml' \
! -name 'test*.sh' \
! -name 'sfdata-wrapper.sh' \
! -name 'diff-or-update-golden-master.sh' \
! -name 'mongodb-container.sh' \
! -name 'populate-from-objects.sh' \
! -name 'remove-random_order.sh' \
! -name '*.txt' \
! -name '*.csv' \
! -name '*.json' \
! -name '*.excel' \
! -name 'objects.js' \
-type f \
-exec rm -v {} +
- run: ./tests/test-cli.sh
- run: ./tests/test-prune-entities.sh
- run: ./tests/test.sh
- run: ./tests/test-import.sh
- run: ./tests/test-validate.sh
- run: ./tests/test-check.sh
- run: ./tests/test-export.sh
- run: ./tests/test-public.sh
- run: ./tests/test-reduce.sh
- run: ./tests/test-purge-batch.sh
- run: ./tests/test-compact-failure.sh
- run: ./tests/test-compact.sh # relies on encrypted files
- run: ./tests/test-reduce-2.sh # relies on encrypted files
coverage:
name: Send coverage data to Codacy
needs:
- mr-tests
- go-tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# - uses: actions/download-artifact@v3
# with:
# name: go-coverage-report
- uses: actions/download-artifact@v3
with:
name: mr-coverage-report
- run: cat lcov.info
# - uses: codacy/codacy-coverage-reporter-action@master
# with:
# project-token: ${{ secrets.CODACY_REPOSITORY_TOKEN_FOR_COVERAGE }}
# coverage-reports: go-coverage.xml,lcov.info