Skip to content

Commit

Permalink
Add Goreleaser GitHub Action flow
Browse files Browse the repository at this point in the history
  • Loading branch information
bdwyertech committed May 16, 2023
1 parent 47727e3 commit 4eacdc5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 130 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
open-pull-requests-limit: 10
schedule:
interval: monthly
time: '08:00'
timezone: America/New_York

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
time: '08:00'
timezone: America/New_York
170 changes: 40 additions & 130 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,138 +1,48 @@
---
name: CI

env:
VERSION_GO: '1.19.8'
VERSION_HELM: 'v3.11.3'

on:
pull_request:
push:
branches:
- master

name: Go
on: [push]
jobs:
build:
name: "Build & Test"
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.VERSION_GO }}

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: make bootstrap

- name: Run unit tests
run: make test

- name: Verify installation
run: |
mkdir -p helmhome
make install HELM_HOME=helmhome
helmhome/plugins/helm-diff/bin/diff version
helm-install:
name: helm install
if: "!contains(github.event.head_commit.message, '[ci skip]')"
needs: [build]
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
continue-on-error: ${{ matrix.experimental }}
test:
name: Build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
shell: [ default ]
experimental: [ false ]
include:
- os: windows-latest
shell: wsl
experimental: false
- os: windows-latest
shell: cygwin
experimental: false
- os: ubuntu-latest
container: alpine
shell: sh
experimental: false

steps:
- name: Disable autocrlf
if: "contains(matrix.os, 'windows-latest')"
run: |-
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2

- name: Setup Helm
uses: azure/setup-helm@v1.1
with:
version: ${{ env.VERSION_HELM }}

- name: Setup WSL
if: "contains(matrix.shell, 'wsl')"
uses: Vampire/setup-wsl@v1

- name: Setup Cygwin
if: "contains(matrix.shell, 'cygwin')"
uses: egor-tensin/setup-cygwin@v3
with:
platform: x64

- name: helm plugin install
run: helm plugin install .

integration-tests:
name: Integration Tests
if: "!contains(github.event.head_commit.message, '[ci skip]')"
needs: [build]
go: ['1.20']
runs-on: ubuntu-latest
container: golang:${{ matrix.go }}
steps:
- uses: engineerd/setup-kind@v0.5.0
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
version: "v0.11.1"

- uses: actions/checkout@v2

- name: Setup Helm
uses: azure/setup-helm@v1.1
with:
version: ${{ env.VERSION_HELM }}

- name: helm plugin install
run: helm plugin install .
fetch-depth: 0

- name: helm create helm-diff
run: helm create helm-diff

- name: helm diff upgrade --install helm-diff ./helm-diff
run: helm diff upgrade --install helm-diff ./helm-diff

- name: helm upgrade -i helm-diff ./helm-diff
run: helm upgrade -i helm-diff ./helm-diff

- name: helm diff upgrade -C 3 --set replicaCount=2 --install helm-diff ./helm-diff
run: helm diff upgrade -C 3 --set replicaCount=2 --install helm-diff ./helm-diff

shell-lint:
name: Lint install-binary.sh
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
continue-on-error: true
steps:
- uses: actions/checkout@v2.4.0
- uses: luizm/action-sh-checker@v0.3.0
- name: Git Info
id: git
run: |
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Test
env:
GOFLAGS: '-mod=vendor'
STATICCHECK_VERSION: '2023.1.3'
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
wget -qO- https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_linux_amd64.tar.gz | tar zxf - --directory /usr/local/bin --strip-components=1 staticcheck/staticcheck
go fmt $(go list ./... | grep -v /vendor/) | xargs -I {} -r /bin/sh -c "/bin/echo {} && exit 1"
go vet $(go list ./... | grep -v /vendor/)
staticcheck --version
staticcheck $(go list ./... | grep -v /vendor/)
go test -v -race $(go list ./... | grep -v /vendor/)
- name: Run GoReleaser
if: startsWith(github.ref, 'refs/tags/') && (matrix.go == 1.20)
uses: goreleaser/goreleaser-action@v4
with:
sh_checker_exclude: "scripts"
sh_checker_checkbashisms_enable: true
version: latest
args: release
# key: ${{ secrets.GPG_CODE_SIGN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE_NAME: ${{ steps.git.outputs.SOURCE_NAME }}
SOURCE_BRANCH: ${{ steps.git.outputs.SOURCE_BRANCH }}
SOURCE_TAG: ${{ steps.git.outputs.SOURCE_TAG }}

0 comments on commit 4eacdc5

Please sign in to comment.