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

Basic CI for Go CF Driver #71

Merged
merged 18 commits into from
Dec 18, 2024
Merged
Changes from 15 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
37 changes: 37 additions & 0 deletions .github/workflows/cf-driver-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: "CF Driver: Go Build & Test"

on: [pull_request]

defaults:
run:
working-directory: runner/cf-driver-go

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] can we start out with v5 of the action?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably? I didn't realized I'd picked an old one, can you tell me how this came up for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the action readme to see if we could avoid passing go-version (seems like no? but if we can just have it inherit from go.mod that'd be ideal) and saw that v5 was out

Copy link
Contributor Author

@zjrgov zjrgov Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was hoping some automated thing had surfaced it :-/

But yeah, that's what I had initially planned to do, but then something I read in documentation made me think specifying a version would result in GitHub being more likely to pull a cached version of Go--and that seemed like a nice enough upside to me. I meant to verify it actually made a difference, though, and I forgot to do that.

Copy link
Contributor Author

@zjrgov zjrgov Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, it does make a difference, but not a particularly large difference. Specifying a 1.23.x version for the action takes < 1s, using the go.mod takes ~8s—after the initial run which was an extra ~22s, but I'm thinking this probably wouldn't happen often.

I think for 8s it probably isn't worth it, and it might be faster if I don't specify a patch version in go.mod, which we have no reason to do.

Edit: indeed dropping the patch version takes it back to pulling whatever GitHub already had on hand and was a nice ~2s.

with:
go-version: "1.23.x"
cache-dependency-path: runner/cf-driver-go/go.sum

- name: Install dependencies
run: go get .

- name: Check formatting
run: test -z "$(gofmt -l .)"

- name: Vet
run: go vet ./...

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
Loading