-
Notifications
You must be signed in to change notification settings - Fork 150
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
GHA Migration #103
GHA Migration #103
Changes from 2 commits
3666f5c
f389813
10a0ac4
e033ba8
daeb99e
07809e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: go-tests | ||
|
||
on: [push] | ||
|
||
env: | ||
TEST_RESULTS: /tmp/test-results | ||
|
||
jobs: | ||
|
||
go-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [1.19] | ||
|
||
steps: | ||
- name: Setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create test directory | ||
run: | | ||
mkdir -p ${{env.TEST_RESULTS}} | ||
|
||
- name: Download go modules | ||
run: go mod download | ||
|
||
- name: Cache / restore go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously we only cached There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah this makes total sense -- I was actually following the format that was suggested in the cache action repo here +1 to removing for now as it sounds like it would just bog things down, but can definitely revisit this in the future if its needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, interesting, thanks for the link to the docs... In the short term for a big project it might make things faster, but I doubt the impact will be very significant for this repo even in the short term when the cache size is small. |
||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
|
||
# Check go fmt output because it does not report non-zero when there are fmt changes | ||
- name: Run gofmt | ||
run: | | ||
go fmt ./... | ||
files=$(go fmt ./...) | ||
if [ -n "$files" ]; then | ||
echo "The following file(s) do not conform to go fmt:" | ||
echo "$files" | ||
exit 1 | ||
fi | ||
|
||
- name: Install gotestsum | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @samsalisbury could I get a re-review on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic looks good to me. I made a suggestion, but really do make your own mind up on whether you like it! I think your version might be more popular :) Thanks. |
||
run: go install gotest.tools/[email protected] | ||
|
||
- name: Run go tests | ||
run: | | ||
PACKAGE_NAMES=$(go list ./...) | ||
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES | ||
|
||
# Save coverage report parts | ||
- name: Upload and save artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Test Results | ||
path: ${{env.TEST_RESULTS}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks really good! Great job, Claire. One tiny stylistic ❓ , we typically add spaces between brackets where we evaluate env vars. Is that something we want to be consistent about in this file? E.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a plugin for VSCode that automates doing this @mdeggies? I wonder if we should advise everyone to use it if so, so this kind of thing doesn't come up as often? (Or are you using a different editor @claire-labry?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding spacing makes sense to me as it reads cleaner! I'll get that fixed in. @sam I use VSCode, yeah -- I can definitely look up if there's a plugin that'll automatically cleanup/space out between brackets, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I'm not too helpful here, I just do this manually and try to stay consistent in the file I'm working in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a library that previously targeted go1.15.3, I wonder if we should add that version to the matrix as well to ensure we're still maintaining compatibility? If we don't want that, maybe we should explicitly call out this update in the PR description for the benefit of people looking back in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 -- excellent point, I'll add 1.15.3 into the matrix and also add a note that it was left there just in case.