diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 2fa31f5..7136828 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -8,21 +8,21 @@ jobs: build-and-test-snapshot: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version-file: go.mod - - name: Build - run: make - - name: Install gh dispatch - run: make install - - name: Acceptance test - run: make acc-test - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Ensure unique version - run: make check-tag + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version-file: go.mod + - name: Build + run: make + - name: Install gh dispatch + run: make install + - name: Acceptance test + run: make acc-test + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Ensure unique version + run: make check-tag build-and-publish-release: if: github.ref == 'refs/heads/main' diff --git a/Makefile b/Makefile index 3741fc1..2358f20 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SOURCE=./... GOFMT_FILES?=$$(find . -type f -name '*.go') -VERSION?=0.1.3 +VERSION?=0.1.4 default: build diff --git a/cmd/main_test.go b/cmd/main_test.go index 692119f..37a4b98 100644 --- a/cmd/main_test.go +++ b/cmd/main_test.go @@ -5,7 +5,6 @@ package main import ( "fmt" - "os" "os/exec" "strings" "testing" @@ -15,17 +14,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestMain(m *testing.M) { - // compile a 'gh-dispatch' for for use in running tests - exe := exec.Command("go", "build", "-ldflags", "-X main.version=test", "-o", "gh-dispatch") - err := exe.Run() - if err != nil { - os.Exit(1) - } - - os.Exit(m.Run()) -} - func TestRootAcceptance(t *testing.T) { basicOut := heredoc.Doc(`Send a workflow_dispatch or repository_dispatch event and watch the resulting GitHub Actions run. diff --git a/scripts/ensure-unique-version.sh b/scripts/ensure-unique-version.sh index 8ee738a..57bbb4d 100755 --- a/scripts/ensure-unique-version.sh +++ b/scripts/ensure-unique-version.sh @@ -6,7 +6,7 @@ repo="mdb/gh-dispatch" result="$(curl \ --header "Accept: application/vnd.github.v3+json" \ --write "%{http_code}" \ - --out "/dev/null" \ + --output "/dev/null" \ "https://api.github.com/repos/${repo}/releases/tags/${version}")" if [ "${result}" = "404" ]; then