diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index 8fa2fd09..1d80d15e 100755 --- a/.evergreen/ensure-binary.sh +++ b/.evergreen/ensure-binary.sh @@ -18,10 +18,10 @@ if [ -z "$DRIVERS_TOOLS" ]; then return 1 fi -# if command -v $NAME &> /dev/null; then -# echo "$NAME found in PATH!" -# return 0 -# fi +if command -v $NAME &> /dev/null; then + echo "$NAME found in PATH!" + return 0 +fi OS_NAME=$(uname -s | tr '[:upper:]' '[:lower:]') MARCH=$(uname -m | tr '[:upper:]' '[:lower:]') @@ -66,28 +66,51 @@ case $NAME in esac esac -if [ -z "$URL" ]; then - echo "Unsupported for $NAME: $OS_NAME-$MARCH" - return 1 +set -x +# Set up variables for Go and ensure go is on the path. +if ! command -v go &> /dev/null; then + GOROOT=${GOROOT:-/opt/golang/go1.22} + if [ "${OS:-}" == "Windows_NT" ]; then + GOROOT=${GOROOT:-C:/golang/go1.22} + fi + export PATH="${GOROOT}/bin:$PATH" fi +GOBIN=${DRIVERS_TOOLS}/.bin +GOCACHE=${DRIVERS_TOOLS}/.go-cache echo "Installing $NAME..." -if [ "$NAME" != "gcloud" ]; then - mkdir -p ${DRIVERS_TOOLS}/.bin - TARGET=${DRIVERS_TOOLS}/.bin/$NAME - retry_with_backoff curl -L -s $URL -o $TARGET - chmod +x $TARGET - -else - # Google Cloud needs special handling: we need a symlink to the source location. - pushd /tmp - rm -rf google-cloud-sdk - FNAME=/tmp/google-cloud-sdk.tgz - retry_with_backoff curl -L -s $URL -o $FNAME - tar xfz $FNAME - popd - ln -s /tmp/google-cloud-sdk/bin/gcloud $DRIVERS_TOOLS/.bin/gcloud -fi +case $NAME in + gcloud) + # Google Cloud needs special handling: we need a symlink to the source location. + if [ -z "$URL" ]; then + echo "Unsupported for $NAME: $OS_NAME-$MARCH" + return 1 + fi + pushd /tmp + rm -rf google-cloud-sdk + FNAME=/tmp/google-cloud-sdk.tgz + retry_with_backoff curl -L -s $URL -o $FNAME + tar xfz $FNAME + popd + ln -s /tmp/google-cloud-sdk/bin/gcloud $DRIVERS_TOOLS/.bin/gcloud + ;; + task) + # Task is installed using "go install". + go version + env GOBIN=${GOBIN} GOCACHE=${GOCACHE} go install github.com/go-task/task/v3/cmd/task@latest + ;; + *) + # Download directly using curl. + if [ -z "$URL" ]; then + echo "Unsupported for $NAME: $OS_NAME-$MARCH" + return 1 + fi + mkdir -p ${DRIVERS_TOOLS}/.bin + TARGET=${DRIVERS_TOOLS}/.bin/$NAME + retry_with_backoff curl -L -s $URL -o $TARGET + chmod +x $TARGET + ;; +esac echo "Installing $NAME... done." diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7d03291b..5faed8dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,43 +9,43 @@ on: - "master" jobs: - tests: - name: "Tests" - runs-on: ${{ matrix.os }} + # tests: + # name: "Tests" + # runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - "ubuntu-latest" - - "windows-latest" - - "macos-latest" - mongodb-version: - - "7.0" - topology: - - "server" - - "replica_set" - - "sharded_cluster" - auth: - - "noauth" - - "auth" - ssl: - - "nossl" - - "ssl" + # strategy: + # matrix: + # os: + # - "ubuntu-latest" + # - "windows-latest" + # - "macos-latest" + # mongodb-version: + # - "7.0" + # topology: + # - "server" + # - "replica_set" + # - "sharded_cluster" + # auth: + # - "noauth" + # - "auth" + # ssl: + # - "nossl" + # - "ssl" - steps: - - name: "Checkout" - uses: "actions/checkout@v4" - with: - fetch-depth: 2 + # steps: + # - name: "Checkout" + # uses: "actions/checkout@v4" + # with: + # fetch-depth: 2 - - id: setup-mongodb - name: "Test GitHub Action" - uses: ./ - with: - version: ${{ matrix.mongodb-version }} - topology: ${{ matrix.topology }} - auth: ${{ matrix.auth }} - ssl: ${{ matrix.ssl }} + # - id: setup-mongodb + # name: "Test GitHub Action" + # uses: ./ + # with: + # version: ${{ matrix.mongodb-version }} + # topology: ${{ matrix.topology }} + # auth: ${{ matrix.auth }} + # ssl: ${{ matrix.ssl }} pre-commit: runs-on: ubuntu-latest @@ -71,3 +71,21 @@ jobs: - name: Lint working-directory: .evergreen/github_app run: npm run lint + + taskfile: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - "ubuntu-latest" + - "windows-latest" + - "macos-latest" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + - name: Install task + run: ./.evergreen/ensure-binary.sh task + - name: Print task version + run: .bin/task --version