From 865875481b825b16d9ab000057bf823129dbbb4d Mon Sep 17 00:00:00 2001 From: leonnicolas Date: Tue, 19 Mar 2024 15:43:23 +0100 Subject: [PATCH] CI: travis-ci -> github actions It looks like travis is not running CI for this project anymore. This PR moves the CI to github actions. Fix tests: - install embedmd for integration test - use t.Helper() to not get confused with where the error happened in a test. - require go 1.11 (go mod is not available in earlier versions) Note: to run test for later go version > 1.13, we would have to update an expected error in `embedmd_test.go`. Signed-off-by: leonnicolas --- .github/workflows/ci.yaml | 20 ++++++++++++++++++++ .travis.yml | 9 --------- embedmd/command_test.go | 1 + go.mod | 2 ++ 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..f485dff --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,20 @@ +name: Build and Test + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + go: [ '1.11', '1.12', '1.13' ] + name: Go Version ${{ matrix.go }} + steps: + - uses: actions/checkout@v4 + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + - run: go install . + - run: go test ./... diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c9b96e5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go - -go: - - 1.7.x - - 1.8.x - - 1.x - - master -script: - - go test ./... diff --git a/embedmd/command_test.go b/embedmd/command_test.go index 84e2ce8..da978cc 100644 --- a/embedmd/command_test.go +++ b/embedmd/command_test.go @@ -112,6 +112,7 @@ func eqPtr(a, b *string) bool { } func eqErr(t *testing.T, id string, err error, msg string) bool { + t.Helper() if err == nil && msg == "" { return true } diff --git a/go.mod b/go.mod index cd01135..ca9be07 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/campoy/embedmd +go 1.11 + require github.com/pmezard/go-difflib v1.0.0