-
Notifications
You must be signed in to change notification settings - Fork 213
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
ci: Rewrite GitHub Action workflows #346
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Tell Git to use LF for line endings on all platforms. | ||
# Required to have correct test data on Windows. | ||
# https://github.com/mvdan/github-actions-golang#caveats | ||
# https://github.com/actions/checkout/issues/135#issuecomment-613361104 | ||
* text eol=lf |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Lint | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release/** | ||
pull_request: | ||
permissions: | ||
contents: read | ||
defaults: | ||
run: | ||
shell: bash | ||
concurrency: | ||
group: lint-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
golangci-lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.40.1 | ||
only-new-issues: true | ||
timeout-minutes: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release/** | ||
pull_request: | ||
permissions: | ||
contents: read | ||
defaults: | ||
run: | ||
shell: bash | ||
concurrency: | ||
group: test-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
test: | ||
name: Module Mode | ||
runs-on: ${{ matrix.os }}-latest | ||
env: | ||
GO111MODULE: "on" | ||
GOFLAGS: "-mod=readonly" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
# In order: | ||
# * Module download cache | ||
# * Build cache (Linux) | ||
# * Build cache (Mac) | ||
# * Build cache (Windows) | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
~/Library/Caches/go-build | ||
%LocalAppData%\go-build | ||
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ matrix.go }}- | ||
${{ runner.os }}-go- | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- name: Build | ||
run: go build ./... | ||
- name: Vet | ||
run: go vet ./... | ||
- name: Test | ||
run: go test ./... | ||
- name: Test (race) | ||
run: go test -race ./... | ||
timeout-minutes: 10 | ||
strategy: | ||
matrix: | ||
go: ["1.16", "1.15", "1.14"] | ||
os: [ubuntu, windows, macos] | ||
fail-fast: false | ||
test-gopath: | ||
name: GOPATH Mode | ||
runs-on: ubuntu-latest | ||
env: | ||
# We use two paths in GOPATH. | ||
# The first one is where 'go get' will download dependencies, and | ||
# the second is where sentry-go itself will be checked out. | ||
GOPATH: ${{ github.workspace }}/deps:${{ github.workspace }}/main | ||
GO111MODULE: "off" | ||
WORKDIR: ${{ github.workspace }}/main/src/github.com/getsentry/sentry-go | ||
defaults: | ||
run: | ||
working-directory: ${{ env.WORKDIR }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
path: ${{ env.WORKDIR }} | ||
# TODO: cache dependencies | ||
# - uses: actions/cache@v2 | ||
# with: | ||
# # In order: | ||
# # * GOPATH with dependencies (but without sentry-go) | ||
# # * GOPATH with sentry-go installed package objects (*.a files) | ||
# # * Build cache (Linux) | ||
# path: | | ||
# ${{ github.workspace }}/deps | ||
# ${{ github.workspace }}/main/pkg | ||
# ~/.cache/go-build | ||
# key: gopath-${{ github.ref }} | ||
# restore-keys: | | ||
# gopath- | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1" | ||
- name: Remove Unsupported Code | ||
run: | | ||
# Iris requires Module mode, therefore we delete the relevant code to | ||
# skip testing it in GOPATH mode. | ||
rm -vrf ./iris/ ./example/iris/ | ||
- name: Download Dependencies | ||
run: go get -d -t -v ./... | ||
- name: Build | ||
run: go build ./... | ||
- name: Vet | ||
run: go vet ./... | ||
- name: Test | ||
run: go test ./... | ||
- name: Test (race) | ||
run: go test -race ./... | ||
timeout-minutes: 10 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Didn't enable this step for now because it requires a bit more thought on the cache key or how to update dependencies.
In GOPATH Mode we download all dependencies in their latest commits. With too aggressive caching or missing an update step (a la
go get -u
) we'd be testing against stale dependencies.We can't use
go get -d -t -u -v ./...
because that would also try to update sentry-go itself. The solution probably requires resorting togo list
and would need to work no matter if we got a cache hit or miss. Deferring that for later.This job is obviously prone to breakage (dependencies are changing out of our control) and not going to be required to merge changes.