Skip to content

Commit 79e40f4

Browse files
authored
Merge pull request #26 from mdb/improve-acceptance-tests
remove excessive recompilation in CI
2 parents 3b484ea + b25fc0b commit 79e40f4

File tree

4 files changed

+17
-29
lines changed

4 files changed

+17
-29
lines changed

.github/workflows/cicd.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ jobs:
88
build-and-test-snapshot:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
12-
- name: Set up Go
13-
uses: actions/setup-go@v3
14-
with:
15-
go-version-file: go.mod
16-
- name: Build
17-
run: make
18-
- name: Install gh dispatch
19-
run: make install
20-
- name: Acceptance test
21-
run: make acc-test
22-
env:
23-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
- name: Ensure unique version
25-
run: make check-tag
11+
- uses: actions/checkout@v3
12+
- name: Set up Go
13+
uses: actions/setup-go@v3
14+
with:
15+
go-version-file: go.mod
16+
- name: Build
17+
run: make
18+
- name: Install gh dispatch
19+
run: make install
20+
- name: Acceptance test
21+
run: make acc-test
22+
env:
23+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Ensure unique version
25+
run: make check-tag
2626

2727
build-and-publish-release:
2828
if: github.ref == 'refs/heads/main'

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SOURCE=./...
22
GOFMT_FILES?=$$(find . -type f -name '*.go')
3-
VERSION?=0.1.3
3+
VERSION?=0.1.4
44

55
default: build
66

cmd/main_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package main
55

66
import (
77
"fmt"
8-
"os"
98
"os/exec"
109
"strings"
1110
"testing"
@@ -15,17 +14,6 @@ import (
1514
"github.com/stretchr/testify/assert"
1615
)
1716

18-
func TestMain(m *testing.M) {
19-
// compile a 'gh-dispatch' for for use in running tests
20-
exe := exec.Command("go", "build", "-ldflags", "-X main.version=test", "-o", "gh-dispatch")
21-
err := exe.Run()
22-
if err != nil {
23-
os.Exit(1)
24-
}
25-
26-
os.Exit(m.Run())
27-
}
28-
2917
func TestRootAcceptance(t *testing.T) {
3018
basicOut := heredoc.Doc(`Send a workflow_dispatch or repository_dispatch event and watch the resulting
3119
GitHub Actions run.

scripts/ensure-unique-version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repo="mdb/gh-dispatch"
66
result="$(curl \
77
--header "Accept: application/vnd.github.v3+json" \
88
--write "%{http_code}" \
9-
--out "/dev/null" \
9+
--output "/dev/null" \
1010
"https://api.github.com/repos/${repo}/releases/tags/${version}")"
1111

1212
if [ "${result}" = "404" ]; then

0 commit comments

Comments
 (0)