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

remove excessive recompilation in CI #26

Merged
merged 3 commits into from
Jan 20, 2023
Merged
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
30 changes: 15 additions & 15 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SOURCE=./...
GOFMT_FILES?=$$(find . -type f -name '*.go')
VERSION?=0.1.3
VERSION?=0.1.4

default: build

Expand Down
12 changes: 0 additions & 12 deletions cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package main

import (
"fmt"
"os"
"os/exec"
"strings"
"testing"
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion scripts/ensure-unique-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down