forked from FerretDB/FerretDB
113 lines (94 loc) · 2.77 KB
/
js.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
---
name: JS
on:
pull_request:
types:
- unlabeled # if GitHub Actions stuck, add and remove "not ready" label to force rebuild
- opened
- reopened
- synchronize
paths:
- build/legacy-mongo-shell/*.js
push:
branches:
- main
- main-*
- releases/*
schedule:
- cron: "12 0 * * *"
# Do not run this workflow in parallel for any PR change.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
GOPATH: /home/runner/go
GOCACHE: /home/runner/go/cache
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint
GOMODCACHE: /home/runner/go/mod
GOPROXY: https://proxy.golang.org
GOTOOLCHAIN: local
jobs:
testjs:
name: Test script
runs-on: ubuntu-22.04
timeout-minutes: 10
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # for `git describe` to work
lfs: false # LFS is used only by website
- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: testjs
- name: Install Task
run: go generate -x
working-directory: tools
- name: Start environment
run: bin/task env-up-detach
- name: Run init
run: bin/task init
- name: Build bin/ferretdb
run: bin/task build-host
- name: Wait for and setup environment
run: bin/task env-setup
- name: Start FerretDB in the background
run: >
bin/ferretdb
--listen-addr=:27017
--proxy-addr=127.0.0.1:47017
--mode=diff-normal
--handler=pg
--postgresql-url='postgres://username@127.0.0.1:5432/ferretdb'
2> ferretdb.log &
- name: Run testjs for MongoDB
run: bin/task testjs TESTJS_PORT=47017
- name: Run testjs for FerretDB
run: bin/task testjs
- name: Compress FerretDB log before upload
if: failure()
run: zip -q -9 ferretdb-log.zip ferretdb.log
- name: Upload FerretDB log
if: failure()
uses: actions/upload-artifact@v4
with:
name: ferretdb-log
path: ferretdb-log.zip
retention-days: 1
if-no-files-found: error
- name: Show FerretDB log
if: always()
run: |
cat ferretdb.log
rm ferretdb.log
# we don't want them on CI
- name: Clean test and fuzz caches
if: always()
run: go clean -testcache -fuzzcache
- name: Check dirty
run: |
git status
git diff --exit-code