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

update CI and .manifest #164

Merged
merged 5 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
/.vscode
/.dev
/.ext
188 changes: 117 additions & 71 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,128 +18,170 @@ on:
- release-*
env:
PRE_RELEASE: ${{ github.ref == 'refs/heads/main' && 'development' || '' }}
GO_VERSION: "1.19"
GO_VERSION: "1.22"
GO_RELEASER_VERSION: "v1.24.0"
GO_LANGCI_LINT_VERSION: "v1.56.2"
GO_TESTSUM_VERSION: "1.11.0"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
-
uses: actions/checkout@v4
-
name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup caching
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Lint and test
-
name: Build
uses: goreleaser/goreleaser-action@v5
env:
VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
distribution: goreleaser
version: ${{ env.GO_RELEASER_VERSION }}
args: build --clean --snapshot --single-target
-
name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: ${{ env.GO_LANGCI_LINT_VERSION }}
args: --timeout=30m
-
name: Test Setup
uses: autero1/action-gotestsum@v2.0.0
with:
gotestsum_version: ${{ env.GO_TESTSUM_VERSION }}
-
name: Test
run: |
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global user.email "github-bot@aserto.com"
git config --global user.name "Aserto Bot"

go run mage.go deps lint test
#- name: Upload code coverage
# uses: shogo82148/actions-goveralls@v1
# with:
# path-to-profile: cover.out

gotestsum --format short-verbose -- -count=1 -parallel=1 -v -timeout=240s -coverprofile=cover.out -coverpkg=./... ./...
-
name: Upload code coverage
uses: shogo82148/actions-goveralls@v1
continue-on-error: true
with:
path-to-profile: cover.out

push:
needs: test
runs-on: ubuntu-latest
# when on a branch only push if the branch is main
# always push when ref is a tag
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') )
steps:
- uses: actions/checkout@v3
-
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3
-
name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup caching
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v2
-
name: Setup QEMU
uses: docker/setup-qemu-action@v3
-
name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push image
-
name: Docker SSH Setup
run: |
mkdir -p $HOME/.ssh
umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
ssh-keyscan github.com >> $HOME/.ssh/known_hosts
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global user.email "github-bot@aserto.com"
git config --global user.name "Aserto Bot"

eval `ssh-agent`

go run mage.go deps dockerImage
go run mage.go dockerPush ghcr.io "opcr-io"
ssh-add $HOME/.ssh/id_rsa
-
name: Push image to GitHub Container Registry
uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
distribution: goreleaser
version: ${{ env.GO_RELEASER_VERSION }}
args: release --clean --snapshot

release:
needs: push
needs: [test, push]
runs-on: ubuntu-latest
# Only release when ref is a tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
-
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3
-
name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup caching
uses: actions/cache@v3
-
name: Setup QEMU
uses: docker/setup-qemu-action@v3
-
name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Pre-release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-rc')
env:
GITHUB_TOKEN: ${{ secrets.GH_ROOT_TOKEN }}
ASERTO_TAP: ${{ secrets.GH_ASERTO_TAP_TOKEN }}
registry: https://ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Docker SSH Setup
run: |
mkdir -p $HOME/.ssh
umask 0077 && echo -e "${SSH_PRIVATE_KEY}" > $HOME/.ssh/id_rsa
ssh-keyscan github.com >> $HOME/.ssh/known_hosts
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global user.email "github-bot@aserto.com"
git config --global user.name "Aserto Bot"

go run mage.go deps release $PWD/.goreleaser-pre.yml
- name: Release
eval `ssh-agent`
ssh-add $HOME/.ssh/id_rsa
-
name: Pre-release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-rc')
uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GH_ROOT_TOKEN }}
ASERTO_TAP: ${{ secrets.GH_ASERTO_TAP_TOKEN }}
with:
distribution: goreleaser
version: ${{ env.GO_RELEASER_VERSION }}
args: release --clean --config $PWD/.goreleaser-pre.yml
-
name: Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc')
uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GH_ROOT_TOKEN }}
ASERTO_TAP: ${{ secrets.GH_ASERTO_TAP_TOKEN }}
run: |
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global user.email "github-bot@aserto.com"
git config --global user.name "Aserto Bot"

go run mage.go deps release ""
with:
distribution: goreleaser
version: ${{ env.GO_RELEASER_VERSION }}
args: release --clean

msi:
needs: release
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download exe
-
name: Download exe
id: download_exe
shell: bash
run: |
Expand All @@ -148,14 +190,17 @@ jobs:
unzip -o *.zip && rm -v *.zip
env:
GITHUB_TOKEN: ${{ secrets.GH_ROOT_TOKEN }}
- name: Install go-msi
-
name: Install go-msi
run: choco install -y "go-msi"
- name: Prepare PATH
-
name: Prepare PATH
shell: bash
run: |
echo "$WIX\\bin" >> $GITHUB_PATH
echo "C:\\Program Files\\go-msi" >> $GITHUB_PATH
- name: Build MSI
-
name: Build MSI
id: buildmsi
shell: bash
env:
Expand All @@ -165,7 +210,8 @@ jobs:
msi="$(basename "$ZIP_FILE" ".zip").msi"
printf "msi=${msi}" >> $GITHUB_OUTPUT
go-msi make --arch amd64 --msi "$PWD/$msi" --out "$PWD/build" --version "${GITHUB_REF#refs/tags/}"
- name: Upload MSI
-
name: Upload MSI
shell: bash
run: |
tag_name="${GITHUB_REF#refs/tags/}"
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/gitleaks-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
-
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: gitleaks-check
-
name: gitleaks-check
uses: aserto-dev/gitleaks-action@master
Loading
Loading