feat: add mongodb-ts-autocomplete package MONGOSH-2034 #1162
This file contains hidden or 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
# This action runs lint checks and tests against the code. | |
name: Check and Test | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read # we just need to checkout the repo | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
check-and-test: | |
name: Check and Test | |
timeout-minutes: 45 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Sets env vars | |
if: github.event_name == 'pull_request' | |
run: echo "SINCE_REF=remotes/origin/main" >> $GITHUB_ENV | |
shell: bash | |
# On main we run all the checks with changes since the last commit | |
- name: Sets env vars (main) | |
if: github.event_name != 'pull_request' | |
run: echo "SINCE_REF=HEAD~1" >> $GITHUB_ENV | |
shell: bash | |
- name: Install Deps Ubuntu | |
if: ${{ runner.os == 'Linux' }} | |
run: sudo apt-get -y update && sudo apt-get -y install libkrb5-dev libsecret-1-dev net-tools libstdc++6 gnome-keyring | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: "npm" | |
- name: Use python@3.11 | |
# Default Python (3.12) doesn't have support for distutils | |
# https://github.com/nodejs/node-gyp/issues/2869 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install Dependencies | |
run: | | |
# Dependencies are included when installing as npm workspaces will | |
# hoist every package in the repo and it's important that the | |
# dependencies of packages we are planning to test are also prepared | |
npm run bootstrap-ci -- --scope @mongodb-js/monorepo-tools --stream --include-dependencies | |
npm run bootstrap-ci -- --stream --include-dependencies | |
# saslprep source code may have been modified by bootstrapping, | |
# depending on the OS, so undo that change if it has happened | |
# (since it can influence subsequent lerna invocations) | |
git checkout -- packages/saslprep/src/code-points-data.ts | |
shell: bash | |
- name: Info | |
run: | | |
LERNA_VERSION=$(npm ls lerna --json | jq -r .dependencies.lerna.version) | |
echo "Packages changed since: ${SINCE_REF}" | |
npx lerna@${LERNA_VERSION} ls --all --since ${SINCE_REF} | |
shell: bash | |
- name: Run Checks | |
run: npm run check-ci -- --stream | |
shell: bash | |
- name: Run Tests | |
run: npm run test-ci -- --stream | |
shell: bash | |
- name: Report Coverage | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
curl -L https://coveralls.io/coveralls-linux.tar.gz | tar -xz -C /usr/local/bin | |
coverage_reports=(packages/*/coverage/lcov.info) | |
for report in "${coverage_reports[@]}"; do | |
echo "Processing report: $report" | |
flag_name=$(sed -E 's/packages\/([^\/]*)\/coverage\/lcov.info/\1/g' <<<$report) | |
coveralls report --base-path . --job-flag=$flag_name $report --parallel --no-logo | |
done | |
coveralls done | |
env: | |
COVERALLS_GIT_BRANCH: ${{ github.head_ref || github.ref_name }} | |
COVERALLS_REPO_TOKEN: ${{ github.token }} | |
COVERALLS_GIT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }} |