Skip to content

Add linting and tests to Github Actions#243

Merged
rubenv merged 4 commits intorubenv:masterfrom
peterldowns:ci-and-format
Jun 5, 2023
Merged

Add linting and tests to Github Actions#243
rubenv merged 4 commits intorubenv:masterfrom
peterldowns:ci-and-format

Conversation

@peterldowns
Copy link
Copy Markdown
Contributor

@peterldowns peterldowns commented May 30, 2023

While I was working on #242 I was surprised to find a lack of automated testing. If you'd like, this PR sets up CI on Github Actions and adds some linting rules, too. I think switching to Github Actions will make it easier for people to contribute and make sure they're not breaking anything, especially for older versions of golang. Hopefully it will make your life easier as a maintainer, too.

If you are not interested, no problem, please feel free to close the PR.

  • Adds a Makefile with rules for make lint, make test, and make build
  • Adds golangci-lint as a linter, with explicit configuration
  • Replaces the .travis.yml CI configuration with Github Actions
    • Runs go build and go test for golang version 1.13-1.20
    • Runs golangci-lint and go mod tidy and makes sure there were not any changes detected
    • Runs the integration tests for golang versions 1.13-1.20
  • Fixes building/installing on go < 1.17
  • Fixes all linter errors

golang.org/x/sys added `unsafe.Slice`, but it requires go1.17 or
greater. This pins the package to an earlier version and fixes the
build.
@peterldowns
Copy link
Copy Markdown
Contributor Author

peterldowns commented May 31, 2023

You can see an example run of the proposed workflows here, on this PR (same branch, just opened as a PR against my fork so that the workflow has permissions to run) peterldowns#1

https://github.com/peterldowns/sql-migrate/actions/runs/5136897251

image

@rubenv
Copy link
Copy Markdown
Owner

rubenv commented Jun 5, 2023

Oh thank you very much!

Once Travis died I never got round to properly adding CI again. This is great.

@rubenv rubenv merged commit 7084132 into rubenv:master Jun 5, 2023
@peterldowns
Copy link
Copy Markdown
Contributor Author

@rubenv you're welcome, I'm happy that I was able to contribute something useful :) If you run into any problems with it, please just tag me or send me an email and I can try to help out.

@peterldowns peterldowns deleted the ci-and-format branch June 5, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants