JS #607
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |