Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add taskfile support #3

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 46 additions & 23 deletions .evergreen/ensure-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:]')
Expand Down Expand Up @@ -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."
86 changes: 52 additions & 34 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Loading