From 9377669fa22875bb9737486644b68f25bfb7fd51 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 22 Jan 2024 20:13:05 +0100 Subject: [PATCH 1/3] ci: wip Signed-off-by: Mark Sagi-Kazar --- .github/workflows/ci.yaml | 2 +- ci/build.go | 2 ++ ci/main.go | 8 +++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7b8c7aa..16899a7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: with: verb: call module: github.com/${{ github.repository }}/ci@${{ github.ref }} - args: --checkout ${{ github.ref }} ci + args: --checkout ${{ github.ref }} build binary cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} version: "0.9.7" diff --git a/ci/build.go b/ci/build.go index 51c3cc0..73ab064 100644 --- a/ci/build.go +++ b/ci/build.go @@ -84,6 +84,8 @@ func (m *Build) binary(platform Platform, version string) *File { return dag.Go(GoOpts{ Version: goVersion, }). + WithModuleCache(dag.CacheVolume("benthos-openmeter-go-mod")). + WithBuildCache(dag.CacheVolume("benthos-openmeter-go-build")). WithPlatform(string(platform)). WithCgoDisabled(). WithSource(m.Source). diff --git a/ci/main.go b/ci/main.go index 5a0b58f..69bb784 100644 --- a/ci/main.go +++ b/ci/main.go @@ -82,9 +82,9 @@ func (m *Ci) Ci(ctx context.Context) error { return err }) - group.Go(func() error { - return m.Lint().All(ctx) - }) + // group.Go(func() error { + // return m.Lint().All(ctx) + // }) // TODO: run trivy scan on container(s?) // TODO: version should be the commit hash (if any?)? @@ -128,6 +128,8 @@ func (m *Ci) Test() *Container { return dag.Go(GoOpts{ Version: goVersion, }). + WithModuleCache(dag.CacheVolume("benthos-openmeter-go-mod")). + WithBuildCache(dag.CacheVolume("benthos-openmeter-go-build")). WithSource(m.Source). Exec([]string{"go", "test", "-v", "./..."}) } From 67d0f0173586e6083378b69be19a1b192d4f89b6 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 22 Jan 2024 20:22:18 +0100 Subject: [PATCH 2/3] ci: wip Signed-off-by: Mark Sagi-Kazar --- ci/build.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ci/build.go b/ci/build.go index 73ab064..bf451d5 100644 --- a/ci/build.go +++ b/ci/build.go @@ -1,6 +1,7 @@ package main import ( + "context" "fmt" "strings" "time" @@ -69,11 +70,15 @@ func (m *Build) containerImage(platform Platform, version string) *Container { // Build a binary. func (m *Build) Binary( + ctx context.Context, + // Target platform in "[os]/[platform]/[version]" format (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64"). // +optional platform Platform, -) *File { - return m.binary(platform, "") +) error { + _, err := m.binary(platform, "").Sync(ctx) + + return err } func (m *Build) binary(platform Platform, version string) *File { From e05e33f4b05f40122c4aaacbc6b45d8b5d85dca7 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 22 Jan 2024 20:25:05 +0100 Subject: [PATCH 3/3] ci: wip Signed-off-by: Mark Sagi-Kazar --- .github/workflows/ci.yaml | 2 +- ci/build.go | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 16899a7..74f0339 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: with: verb: call module: github.com/${{ github.repository }}/ci@${{ github.ref }} - args: --checkout ${{ github.ref }} build binary + args: --checkout ${{ github.ref }} build binary size cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }} version: "0.9.7" diff --git a/ci/build.go b/ci/build.go index bf451d5..73ab064 100644 --- a/ci/build.go +++ b/ci/build.go @@ -1,7 +1,6 @@ package main import ( - "context" "fmt" "strings" "time" @@ -70,15 +69,11 @@ func (m *Build) containerImage(platform Platform, version string) *Container { // Build a binary. func (m *Build) Binary( - ctx context.Context, - // Target platform in "[os]/[platform]/[version]" format (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64"). // +optional platform Platform, -) error { - _, err := m.binary(platform, "").Sync(ctx) - - return err +) *File { + return m.binary(platform, "") } func (m *Build) binary(platform Platform, version string) *File {