From 5d147074ddea0d8ce9dfa75b48b504744d7fd19f Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 17:34:01 -0500 Subject: [PATCH 01/12] add taskfile support --- .evergreen/ensure-binary.sh | 56 ++++++++++++++++++++++++------------- .github/workflows/tests.yml | 15 ++++++++++ 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index 8fa2fd09..ceedecc6 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:]') @@ -71,23 +71,39 @@ if [ -z "$URL" ]; then return 1 fi -echo "Installing $NAME..." +# Set up variables for Go. +GOROOT=${GOROOT:-/opt/golang/go1.22} +if [ "${OS:-}" == "Windows_NT" ]; then + GOROOT=${GOROOT:-C:/golang/go1.22} +fi +GOBIN=${DRIVERS_TOOLS}/.bin +GOCACHE=${DRIVERS_TOOLS}/.go-cache -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 +echo "Installing $NAME..." -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. + 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". + export PATH="${GOROOT}/bin:$PATH" + env GOBIN=${GOBIN} GOCACHE=${GOCACHE} go install github.com/go-task/task/v3/cmd/task@latest + ;; + *) + # Download directly using curl. + 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..fca2f3c7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,3 +71,18 @@ 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 + - name: Install task + run: ./.evergreen/ensure-binary.sh task + - name: Print task version + run: task --version From baf97965ccae3283e889a84c2103c2f310167309 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 17:35:45 -0500 Subject: [PATCH 02/12] fix up --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fca2f3c7..52f86858 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -83,6 +83,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install task - run: ./.evergreen/ensure-binary.sh task + run: . ./.evergreen/ensure-binary.sh task - name: Print task version run: task --version From 0db1d5f83fa55b964208483b388f86f70df779d1 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 17:38:10 -0500 Subject: [PATCH 03/12] fix up --- .evergreen/ensure-binary.sh | 13 ++++--- .github/workflows/tests.yml | 68 ++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index ceedecc6..d5f36959 100755 --- a/.evergreen/ensure-binary.sh +++ b/.evergreen/ensure-binary.sh @@ -66,11 +66,6 @@ case $NAME in esac esac -if [ -z "$URL" ]; then - echo "Unsupported for $NAME: $OS_NAME-$MARCH" - return 1 -fi - # Set up variables for Go. GOROOT=${GOROOT:-/opt/golang/go1.22} if [ "${OS:-}" == "Windows_NT" ]; then @@ -84,6 +79,10 @@ echo "Installing $NAME..." 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 @@ -99,6 +98,10 @@ case $NAME in ;; *) # 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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 52f86858..bd618f9c 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 From 040061d1696f1b0d3de5515e47a4044db05d1306 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 17:40:01 -0500 Subject: [PATCH 04/12] fix up --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bd618f9c..f6b80f30 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -82,6 +82,7 @@ jobs: - "macos-latest" steps: - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 - name: Install task run: . ./.evergreen/ensure-binary.sh task - name: Print task version From 3c9976d0534fc663845a3da570981e39d6f29511 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 17:40:43 -0500 Subject: [PATCH 05/12] fix up --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f6b80f30..88b51239 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -83,6 +83,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 + with: + go-version: '1.20' - name: Install task run: . ./.evergreen/ensure-binary.sh task - name: Print task version From 8ee33ccf253df928fe00fec476b2c8a2b333b69c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 17:42:49 -0500 Subject: [PATCH 06/12] fix up --- .evergreen/ensure-binary.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index d5f36959..730fbf45 100755 --- a/.evergreen/ensure-binary.sh +++ b/.evergreen/ensure-binary.sh @@ -66,6 +66,7 @@ case $NAME in esac esac +set -x # Set up variables for Go. GOROOT=${GOROOT:-/opt/golang/go1.22} if [ "${OS:-}" == "Windows_NT" ]; then From c9855a859233fb05d84cc1231d9d3efe95543e36 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 17:46:19 -0500 Subject: [PATCH 07/12] fix up --- .evergreen/ensure-binary.sh | 12 +++++++----- .github/workflows/tests.yml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index 730fbf45..ee13b9c6 100755 --- a/.evergreen/ensure-binary.sh +++ b/.evergreen/ensure-binary.sh @@ -67,10 +67,13 @@ case $NAME in esac set -x -# Set up variables for Go. -GOROOT=${GOROOT:-/opt/golang/go1.22} -if [ "${OS:-}" == "Windows_NT" ]; then - GOROOT=${GOROOT:-C:/golang/go1.22} +# 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 @@ -94,7 +97,6 @@ case $NAME in ;; task) # Task is installed using "go install". - export PATH="${GOROOT}/bin:$PATH" env GOBIN=${GOBIN} GOCACHE=${GOCACHE} go install github.com/go-task/task/v3/cmd/task@latest ;; *) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 88b51239..1fb07880 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -86,6 +86,6 @@ jobs: with: go-version: '1.20' - name: Install task - run: . ./.evergreen/ensure-binary.sh task + run: ./.evergreen/ensure-binary.sh task - name: Print task version run: task --version From 50285475c1a07281ffd22d0702bb8e85d4241ea4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 18:55:09 -0500 Subject: [PATCH 08/12] fix up --- .evergreen/ensure-binary.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index ee13b9c6..42744d60 100755 --- a/.evergreen/ensure-binary.sh +++ b/.evergreen/ensure-binary.sh @@ -68,13 +68,13 @@ esac set -x # Set up variables for Go and ensure go is on the path. -if command -v go &> /dev/null; then +if [ -z "${GOROOT:-}" ]; 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 +export PATH="${GOROOT}/bin:$PATH" GOBIN=${DRIVERS_TOOLS}/.bin GOCACHE=${DRIVERS_TOOLS}/.go-cache From 3834c90652930cc64dcfd2ebb92bd724ddccee3a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 18:56:42 -0500 Subject: [PATCH 09/12] fix up --- .evergreen/ensure-binary.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index 42744d60..89ada37f 100755 --- a/.evergreen/ensure-binary.sh +++ b/.evergreen/ensure-binary.sh @@ -68,13 +68,13 @@ esac set -x # Set up variables for Go and ensure go is on the path. -if [ -z "${GOROOT:-}" ]; then +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 -export PATH="${GOROOT}/bin:$PATH" GOBIN=${DRIVERS_TOOLS}/.bin GOCACHE=${DRIVERS_TOOLS}/.go-cache From 3d636683863edea6e51677b31d737095d136a4a7 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 18:58:37 -0500 Subject: [PATCH 10/12] fix up --- .evergreen/ensure-binary.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.evergreen/ensure-binary.sh b/.evergreen/ensure-binary.sh index 89ada37f..1d80d15e 100755 --- a/.evergreen/ensure-binary.sh +++ b/.evergreen/ensure-binary.sh @@ -97,6 +97,7 @@ case $NAME in ;; 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 ;; *) From 5a0a9efb9e29e25e1851880c9598995219a9d8ff Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 19:00:09 -0500 Subject: [PATCH 11/12] fix up --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1fb07880..8c315957 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -84,7 +84,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.22' - name: Install task run: ./.evergreen/ensure-binary.sh task - name: Print task version From 7524e1ea04b8c66f1acac2b73de0bca983421310 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Sep 2024 19:00:59 -0500 Subject: [PATCH 12/12] fix up --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8c315957..5faed8dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -88,4 +88,4 @@ jobs: - name: Install task run: ./.evergreen/ensure-binary.sh task - name: Print task version - run: task --version + run: .bin/task --version