mongodb/bson-ruby

View on GitHub
.evergreen/config.yml

Summary

Maintainability
Test Coverage
# GENERATED FILE - DO NOT EDIT.
# Run ./.evergreen/update-evergreen-configs to regenerate this file.

# -----------------------------------------------
# .evergreen/config/settings.yml.erb
# -----------------------------------------------

# When a task that used to pass starts to fail
# Go through all versions that may have been skipped to detect
# when the task started failing
stepback: true

# Fail builds when pre tasks fail.
pre_error_fails_task: true

# Mark a failure as a system/bootstrap failure (purple box) rather then a task
# failure by default.
# Actual testing tasks are marked with `type: test`
command_type: system

# Protect ourself against rogue test case, or curl gone wild, that runs forever
# 12 minutes is the longest we'll ever run
exec_timeout_secs: 3600 # 12 minutes is the longest we'll ever run

# What to do when evergreen hits the timeout (`post:` tasks are run automatically)
timeout:
  - command: shell.exec
    params:
      script: |
        ls -la


# -----------------------------------------------
# .evergreen/config/functions.yml.erb
# -----------------------------------------------

functions:
  "fetch source":
    # Executes git clone and applies the submitted patch, if any
    - command: git.get_project
      params:
        directory: "src"
    - command: shell.exec
      params:
        working_dir: "src"
        script: |
          set -ex

          git submodule update --init --recursive

    # Make an evergreen exapanstion file with dynamic values
    - command: shell.exec
      params:
        working_dir: "src"
        script: |
           # Get the current unique version of this checkout
           if [ "${is_patch}" = "true" ]; then
              CURRENT_VERSION=$(git describe)-patch-${version_id}
           else
              CURRENT_VERSION=latest
           fi

           export DRIVERS_TOOLS="$(pwd)/../drivers-tools"

           # Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory
           if [ "Windows_NT" == "$OS" ]; then # Magic variable in cygwin
              export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
           fi

           export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
           export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
           export UPLOAD_BUCKET="${project}"
           export PROJECT_DIRECTORY="$(pwd)"

           cat <<EOT > expansion.yml
           CURRENT_VERSION: "$CURRENT_VERSION"
           DRIVERS_TOOLS: "$DRIVERS_TOOLS"
           MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME"
           MONGODB_BINARIES: "$MONGODB_BINARIES"
           UPLOAD_BUCKET: "$UPLOAD_BUCKET"
           PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
           MACHINE: "$MACHINE"
           PREPARE_SHELL: |
              set -o errexit
              set -o xtrace
              export DRIVERS_TOOLS="$DRIVERS_TOOLS"
              export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
              export MONGODB_BINARIES="$MONGODB_BINARIES"
              export UPLOAD_BUCKET="$UPLOAD_BUCKET"
              export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"

              export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
              export PATH="$MONGODB_BINARIES:$PATH"
              export PROJECT="${project}"
              export MACHINE="${MACHINE}"
              export CI=1
              export WITH_ACTIVE_SUPPORT="${WITH_ACTIVE_SUPPORT}"
              export COMPACT="${COMPACT}"
           EOT
           # See what we've done
           cat expansion.yml

    # Load the expansion file to make an evergreen variable with the current unique version
    - command: expansions.update
      params:
        file: src/expansion.yml

  "prepare resources":
    - command: shell.exec
      params:
        script: |
          ${PREPARE_SHELL}
          rm -rf $DRIVERS_TOOLS
          if [ "${project}" = "drivers-tools" ]; then
            # If this was a patch build, doing a fresh clone would not actually test the patch
            cp -R ${PROJECT_DIRECTORY}/ $DRIVERS_TOOLS
          else
            git clone https://github.com/mongodb-labs/drivers-evergreen-tools $DRIVERS_TOOLS
          fi
          echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config

  "upload mo artifacts":
    - command: shell.exec
      params:
        script: |
          ${PREPARE_SHELL}
          find $MONGO_ORCHESTRATION_HOME -name \*.log | xargs tar czf ${PROJECT_DIRECTORY}/mongodb-logs.tar.gz
    - command: s3.put
      params:
        aws_key: ${aws_key}
        aws_secret: ${aws_secret}
        local_file: ${PROJECT_DIRECTORY}/mongodb-logs.tar.gz
        remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-logs.tar.gz
        bucket: mciuploads
        permissions: public-read
        content_type: ${content_type|application/x-gzip}
        display_name: "mongodb-logs.tar.gz"
    - command: s3.put
      params:
        aws_key: ${aws_key}
        aws_secret: ${aws_secret}
        local_file: ${DRIVERS_TOOLS}/.evergreen/orchestration/server.log
        remote_file: ${UPLOAD_BUCKET}/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-orchestration.log
        bucket: mciuploads
        permissions: public-read
        content_type: ${content_type|text/plain}
        display_name: "orchestration.log"

  "upload test results":
    - command: attach.xunit_results
      params:
        file: ./src/*/build/test-results/TEST-*.xml

  "run tests":
    - command: shell.exec
      type: test
      params:
        shell: bash
        working_dir: "src"
        script: |
          ${PREPARE_SHELL}
          RVM_RUBY="${RVM_RUBY}" .evergreen/run-tests.sh

  "cleanup":
    - command: shell.exec
      params:
        script: |
          ${PREPARE_SHELL}
          cd "$MONGO_ORCHESTRATION_HOME"
          # source the mongo-orchestration virtualenv if it exists
          if [ -f venv/bin/activate ]; then
            . venv/bin/activate
          elif [ -f venv/Scripts/activate ]; then
            . venv/Scripts/activate
          fi
          mongo-orchestration stop
          cd -
          rm -rf $DRIVERS_TOOLS || true

  "fix absolute paths":
    - command: shell.exec
      params:
        script: |
          ${PREPARE_SHELL}
          for filename in $(find ${DRIVERS_TOOLS} -name \*.json); do
            perl -p -i -e "s|ABSOLUTE_PATH_REPLACEMENT_TOKEN|${DRIVERS_TOOLS}|g" $filename
          done

  "windows fix":
    - command: shell.exec
      params:
        script: |
          ${PREPARE_SHELL}
          for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do
            cat $i | tr -d '\r' > $i.new
            mv $i.new $i
          done

  "make files executable":
    - command: shell.exec
      params:
        script: |
          ${PREPARE_SHELL}
          for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do
            chmod +x $i
          done

  "init test-results":
    - command: shell.exec
      params:
        script: |
          ${PREPARE_SHELL}
          echo '{"results": [{ "status": "FAIL", "test_file": "Build", "log_raw": "No test-results.json found was created"  } ]}' > ${PROJECT_DIRECTORY}/test-results.json

  "install dependencies":
    - command: shell.exec
      type: test
      params:
        working_dir: "src"
        script: |
          ${PREPARE_SHELL}
          file="${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh"
          [ -f ${file} ] && sh ${file} || echo "${file} not available, skipping"

pre:
  - func: "fetch source"
  - func: "prepare resources"
  - func: "windows fix"
  - func: "fix absolute paths"
  - func: "init test-results"
  - func: "make files executable"
  - func: "install dependencies"

post:
  - func: "upload mo artifacts"
  - func: "upload test results"
  - func: "cleanup"

tasks:
    - name: "test"
      commands:
        - func: "run tests"


# -----------------------------------------------
# .evergreen/config/axes.yml.erb
# -----------------------------------------------

axes:
  - id: "all-os"
    display_name: OS
    values:
      - id: debian
        display_name: "Debian 11"
        run_on: debian11-small
        variables:
          MACHINE: "debian11"
      - id: "ubuntu"
        display_name: "Ubuntu 22.04"
        run_on: ubuntu2204-small
        variables:
          MACHINE: "ubuntu2204"
      - id: "rhel"
        display_name: "RHEL 8.0"
        run_on: rhel80-small
        variables:
          MACHINE: "rhel80"

  - id: "special-os"
    display_name: OS
    values:
      - id: "rhel82-arm64"
        display_name: "RHEL 8.2 ARM64"
        run_on: rhel82-arm64-small
        variables:
          MACHINE: rhel82-arm64

  - id: ruby
    display_name: Ruby Version
    values:

      - id: ruby-3.2
        display_name: ruby-3.2
        variables:
           RVM_RUBY: ruby-3.2

      - id: ruby-3.1
        display_name: ruby-3.1
        variables:
           RVM_RUBY: ruby-3.1

      - id: ruby-3.0
        display_name: ruby-3.0
        variables:
           RVM_RUBY: ruby-3.0

      - id: ruby-2.7
        display_name: ruby-2.7
        variables:
           RVM_RUBY: ruby-2.7

      - id: ruby-2.6
        display_name: ruby-2.6
        variables:
           RVM_RUBY: ruby-2.6

      - id: jruby-9.4
        display_name: jruby-9.4
        variables:
           RVM_RUBY: jruby-9.4

      - id: jruby-9.3
        display_name: jruby-9.3
        variables:
           RVM_RUBY: jruby-9.3


  - id: "as"
    display_name: ActiveSupport
    values:
      - id: "5.1"
        display_name: 5.1
        variables:
          WITH_ACTIVE_SUPPORT: "~> 5.1.0"
      - id: "5.2"
        display_name: 5.2
        variables:
          WITH_ACTIVE_SUPPORT: "~> 5.2.0"
      - id: "6.0"
        display_name: 6.0
        variables:
          WITH_ACTIVE_SUPPORT: "~> 6.0.0"
      - id: "6.1"
        display_name: 6.1
        variables:
          WITH_ACTIVE_SUPPORT: "~> 6.1.0"
      - id: "7.0"
        display_name: 7.0
        variables:
          WITH_ACTIVE_SUPPORT: "~> 7.0.0"

  - id: "compact"
    display_name: GC.compact
    values:
      - id: "on"
        display_name: with GC.compact
        variables:
          COMPACT: true


# -----------------------------------------------
# .evergreen/config/variants.yml.erb
# -----------------------------------------------

buildvariants:
  - matrix_name: "mri-latest"
    matrix_spec: { ruby: ruby-3.2, all-os: '*' }
    display_name: "${ruby}, ${all-os}"
    tasks:
      - name: "test"

  - matrix_name: "mri-sample"
    matrix_spec: { ruby: ["ruby-2.7"], all-os: rhel }
    display_name: "${ruby}, ${all-os}"
    tasks:
      - name: "test"

  - matrix_name: "activesupport-5-6"
    matrix_spec:
      ruby: ["ruby-3.0", "ruby-2.7", "ruby-2.6"]
      all-os: rhel
      as: [ '5.1', '5.2', '6.0', '6.1' ]
    display_name: "AS ${as} ${ruby}, ${all-os}"
    tasks:
      - name: "test"

  - matrix_name: "activesupport-7"
    matrix_spec:
      ruby: ["ruby-3.2", "ruby-2.7"]
      all-os: rhel
      as: '7.0'
    display_name: "AS ${as} ${ruby}, ${all-os}"
    tasks:
      - name: "test"

  - matrix_name: "special-os"
    matrix_spec: { ruby: ["ruby-3.2", "ruby-3.1", "jruby-9.4"], special-os: '*' }
    display_name: "${ruby}, ${special-os}"
    tasks:
      - name: "test"

  - matrix_name: "jruby"
    matrix_spec: { ruby: ["jruby-9.4", "jruby-9.3"], all-os: rhel }
    display_name: "${ruby}, ${all-os}"
    tasks:
      - name: "test"

  - matrix_name: "compact"
    matrix_spec:
      ruby: ["ruby-3.2", "ruby-2.7"]
      all-os: rhel
      compact: "on"
    display_name: "${ruby} with GC.compact"
    tasks:
      - name: "test"