From d3738bb02467d7b145b1936cbfcd987c96e0eb88 Mon Sep 17 00:00:00 2001 From: Richard Jennings Date: Fri, 25 Oct 2024 12:57:19 +0100 Subject: [PATCH] single workflow --- .github/workflows/golanglint-ci.yml | 20 ----------------- .github/workflows/test.yml | 34 +++++++++++++++++++---------- config.go | 4 ---- git/commit.go | 2 +- go.mod | 2 +- index_test.go | 1 + integration_test.go | 1 + 7 files changed, 26 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/golanglint-ci.yml diff --git a/.github/workflows/golanglint-ci.yml b/.github/workflows/golanglint-ci.yml deleted file mode 100644 index 53d954b..0000000 --- a/.github/workflows/golanglint-ci.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Lint - -on: - push: - pull_request: - types: [opened, reopened] -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.20' - cache: false - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81a49d3..4b62220 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,17 +1,27 @@ -name: Tests - -on: - push: +name: "Tests" +on: ["push"] jobs: - build: - runs-on: ubuntu-latest + ci: + name: "Run CI" + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macOS-latest"] + go: ["1.23.x"] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: WillAbides/setup-go-faster@v1.14.0 with: - fetch-depth: 2 - - uses: actions/setup-go@v3 + go-version: ${{ matrix.go }} + - run: "go test ./..." + - run: "go vet ./..." + - uses: dominikh/staticcheck-action@v1 with: - go-version: '1.20' - - name: Run tests - run: go test -v ./... \ No newline at end of file + version: "latest" + install-go: false + cache-key: ${{ matrix.go }} + working-directory: ${{ matrix.dir }} \ No newline at end of file diff --git a/config.go b/config.go index 2e978bf..80c8120 100644 --- a/config.go +++ b/config.go @@ -20,10 +20,6 @@ const ( DefaultPackfileDirectory = "pack" ) -func init() { - Configure() -} - var config Cnf type ( diff --git a/git/commit.go b/git/commit.go index cc4a659..75876c7 100644 --- a/git/commit.go +++ b/git/commit.go @@ -59,7 +59,7 @@ func Commit(message []byte) (g.Sha, error) { commit.Message = msg } if len(commit.Message) == 0 { - return g.Sha{}, errors.New("Aborting commit due to empty commit message.") + return g.Sha{}, errors.New("aborting commit due to empty commit message") } return g.WriteCommit(commit) } diff --git a/go.mod b/go.mod index f89e52e..23ab80a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/richardjennings/g -go 1.20 +go 1.23 require ( github.com/spf13/cobra v1.8.0 diff --git a/index_test.go b/index_test.go index d813682..8d6a1ab 100644 --- a/index_test.go +++ b/index_test.go @@ -6,6 +6,7 @@ import ( ) func TestAdd_WDUntracked(t *testing.T) { + assert.Nil(t, Configure()) idx := NewIndex() err := idx.Add(&File{Path: "test_assets/test.file", Sha: Sha{}, wdStatus: WDUntracked}) assert.Nil(t, err) diff --git a/integration_test.go b/integration_test.go index 5c9b76c..ea6474f 100644 --- a/integration_test.go +++ b/integration_test.go @@ -77,6 +77,7 @@ func Test_Library(t *testing.T) { // write the tree to the object store treeSha, err := tree.WriteTree() + e(err, t) // check for no previous commits pc, err := PreviousCommits()