2024-09-12 18:53:59 -07:00
|
|
|
name: G'Agent Scan, Build, and Test
|
2024-09-15 19:09:07 -07:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- releases/**
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
env:
|
2024-12-26 18:01:37 -08:00
|
|
|
SEMVAR: 0.0.13
|
2024-09-06 06:59:19 -07:00
|
|
|
jobs:
|
2024-09-12 18:53:59 -07:00
|
|
|
scan:
|
2024-09-06 06:59:19 -07:00
|
|
|
runs-on: docker
|
|
|
|
container:
|
|
|
|
image: dragonheim/golang:latest
|
|
|
|
steps:
|
2024-12-28 11:05:51 -08:00
|
|
|
- run: apk add --no-cache zeromq-dev nodejs npm
|
2024-09-12 18:53:59 -07:00
|
|
|
- uses: actions/checkout@v4
|
2024-09-15 19:09:07 -07:00
|
|
|
|
|
|
|
- uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: .cache/trivy
|
|
|
|
key: tmp.woDBBj4Baw
|
|
|
|
|
2024-12-28 11:05:51 -08:00
|
|
|
- run: trivy fs --no-progress --severity CRITICAL --cache-dir .cache/trivy --exit-code 1 .
|
|
|
|
- run: gosec -exclude=G114 -quiet ./...
|
2024-09-15 19:09:07 -07:00
|
|
|
|
|
|
|
build_simple:
|
2024-09-12 18:53:59 -07:00
|
|
|
needs: scan
|
|
|
|
runs-on: docker
|
|
|
|
container:
|
|
|
|
image: dragonheim/golang:latest
|
|
|
|
steps:
|
2024-09-15 19:09:07 -07:00
|
|
|
- run: apk add --no-cache zeromq-dev nodejs npm
|
2024-09-12 18:53:59 -07:00
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
2024-12-26 18:01:37 -08:00
|
|
|
- run: go build -o test_artifact -ldflags="-X main.Version=${{ env.SEMVAR }}" cmd/gagent/main.go
|
2024-09-15 19:09:07 -07:00
|
|
|
- run: ./test_artifact --version
|
2024-09-12 18:53:59 -07:00
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2024-09-15 19:09:07 -07:00
|
|
|
name: test_artifact
|
|
|
|
path: test_artifact
|
|
|
|
|
|
|
|
test_simple:
|
|
|
|
needs: build_simple
|
|
|
|
runs-on: docker
|
|
|
|
container:
|
|
|
|
image: dragonheim/golang:latest
|
|
|
|
steps:
|
2024-12-26 14:30:23 -08:00
|
|
|
- run: apk add --no-cache zeromq-dev nodejs npm
|
2024-09-15 19:09:07 -07:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: test_artifact
|
|
|
|
|
|
|
|
- run: chmod a+x test_artifact
|
|
|
|
- run: ./test_artifact --version
|
|
|
|
|
|
|
|
build_image:
|
|
|
|
needs: test_simple
|
|
|
|
runs-on: docker
|
|
|
|
container:
|
|
|
|
image: dragonheim/golang:latest
|
|
|
|
steps:
|
|
|
|
- run: apk add --no-cache zeromq-dev nodejs npm
|
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- run: echo "${{ secrets.DOCKER_LOGIN }}" | docker login -u dragonheim2024 --password-stdin
|
|
|
|
- run: docker buildx build --push -t dragonheim/gagent:test -f assets/docker/Dockerfile --build-arg SEMVER=${{ env.SEMVAR }} .
|