diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 05d1554..bb30a0b 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -8,8 +8,8 @@ env: GO_VERSION: 1.20.x jobs: - test-cfn-runtime: - name: CFN Runtime + test-pkg-lib: + name: Test pkg lib runs-on: ubuntu-latest steps: @@ -24,11 +24,11 @@ jobs: - name: Test run: | - cd runtimes/cloudformation + cd pkg go test -v ./... - test-kilt-lib: - name: Kilt Lib + test-cfn-runtime: + name: Test CloudFormation Runtime runs-on: ubuntu-latest steps: @@ -43,5 +43,23 @@ jobs: - name: Test run: | - cd pkg + cd runtimes/cloudformation go test -v ./... + + build-cfn-runtime: + name: Build CloudFormation runtime + runs-on: ubuntu-latest + + steps: + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + id: go + + - name: Check out code + uses: actions/checkout@v4 + + - name: Build agent-kilt handler + run: | + make -C runtimes/cloudformation clean cmd/handler/handler diff --git a/.github/workflows/release-runtimes.yml b/.github/workflows/release-runtimes.yml deleted file mode 100644 index 1932e38..0000000 --- a/.github/workflows/release-runtimes.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Release agent-kilt runtimes - -on: - push: - tags: - - 'v*' - -env: - GO_VERSION: 1.20.x - -jobs: - release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: ${{ env.GO_VERSION }} - id: go - - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5 - with: - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e8d1641 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release agent-kilt + +on: + push: + tags: + - 'v*' + +env: + GO_VERSION: 1.20.x + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + id: go + + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build agent-kilt handler + run: | + make -C runtimes/cloudformation clean cmd/handler/handler + + - name: Archive build + run: | + zip -j agent-kilt.zip runtimes/cloudformation/cmd/handler/handler + sha256sum agent-kilt.zip > checksums.txt + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: | + agent-kilt.zip + checksums.txt + tag_name: ${{ github.ref }} diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index 9637a39..0000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: 1 - -before: - hooks: - - make -C runtimes/cloudformation clean agent-kilt.zip - -builds: - - env: - - CGO_ENABLED=0 - goos: - - linux - goarch: - - amd64 - -archives: - - format: zip - name_template: "agent-kilt-{{ .Os }}-{{ .Arch }}" - -release: - extra_files: - - glob: ./runtimes/cloudformation/kilt.zip - -checksum: - name_template: 'checksums.txt' - -changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" diff --git a/runtimes/cloudformation/Makefile b/runtimes/cloudformation/Makefile index eebaf93..80eaf12 100644 --- a/runtimes/cloudformation/Makefile +++ b/runtimes/cloudformation/Makefile @@ -1,8 +1,11 @@ +GOOS?=linux +GOARCH?= amd64 + agent-kilt.zip: cmd/handler/handler cd cmd/handler/ && zip ../../agent-kilt.zip ./handler cmd/handler/handler: - cd cmd/handler && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build . + cd cmd/handler && CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build . clean: rm agent-kilt.zip || true