diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index adfc4ee..83b66da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,7 @@ name: CI on: # Triggers the workflow on push or pull request events but only for the master branch push: - + pull_request: # Allows you to run this workflow manually from the Actions tab @@ -20,7 +20,20 @@ jobs: runs-on: ${{ matrix.os }} steps: - - name: Test plugin + - name: Checkout code + uses: actions/checkout@v2 + + - name: 🏗️ Create dummy install directories + run: | + ./test-fixtures/create-dummy-installs.sh + + - name: Test parsing 'go.mod' + run: | + bin/parse-legacy-file test-fixtures/go.mod | grep "^1.19.3" + - name: Test parsing '.go-version' + run: | + bin/parse-legacy-file test-fixtures/.go-version | grep "^1.17.13" + - name: Test plugin works to get latest version uses: asdf-vm/actions/plugin-test@v1 with: command: go version diff --git a/test-fixtures/.go-version b/test-fixtures/.go-version new file mode 100644 index 0000000..47287f1 --- /dev/null +++ b/test-fixtures/.go-version @@ -0,0 +1 @@ +1.17.13 diff --git a/test-fixtures/create-dummy-installs.sh b/test-fixtures/create-dummy-installs.sh new file mode 100755 index 0000000..d8a1c9b --- /dev/null +++ b/test-fixtures/create-dummy-installs.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +declare -a fake_install_versions=( + 1.16 + 1.17.1 + 1.17.7 + 1.17.13 + 1.18.1 + 1.18.2 + 1.18.6 + 1.19 + 1.19.3 +) + +mkdir -p ../../installs/asdf-golang +for version in "${fake_install_versions[@]}"; do + mkdir "../../installs/asdf-golang/${version}" +done diff --git a/test-fixtures/go.mod b/test-fixtures/go.mod new file mode 100644 index 0000000..511d5df --- /dev/null +++ b/test-fixtures/go.mod @@ -0,0 +1,3 @@ +module github.com/kennyp/asdf-golang + +go 1.18