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

feat(ci): add release build and test stage for PRs #79

Merged
merged 5 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 16 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- '*'
pull_request:

permissions:
contents: write
Expand All @@ -23,12 +24,24 @@ jobs:
with:
go-version: "1.21"

-
# if tag release
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/v')
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# if no tag test release build
Copy link
Contributor

Choose a reason for hiding this comment

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

🙌

-
name: Run GoReleaser skip publishing
uses: goreleaser/goreleaser-action@v5
if: "!startsWith(github.ref, 'refs/tags/v')"
with:
version: latest
args: release --skip=publish --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test and coverage

on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false

- name: go get
run: go get ./...

- name: Run tests
run: go test -v ./...
12 changes: 7 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ builds:
-
id: plugin-check
mod_timestamp: '{{ .CommitTimestamp }}'
hooks:
# This will check plugin compatibility against latest version of Packer
post:
- go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this section being removed?

- bash -ec 'cd "{{ dir .Path}}" && packer-sdc plugin-check {{ .Name }}'
flags:
- -trimpath
ldflags:
Expand All @@ -39,6 +34,13 @@ builds:
- '386'
- arm
- arm64
ignore:
- goos: windows
goarch: arm64
- goos: darwin
goarch: '386'
- goos: linux
goarch: amd64
archives:
-
builds:
Expand Down