From b7d8fe2501d2198c6b2d3d0eb43c7a2db2cc11a6 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Thu, 19 Aug 2021 12:25:09 -0400 Subject: [PATCH 01/14] chore: add github actions for ci --- .github/workflows/ci.yaml | 25 ++++++++ manifests/base/install.yaml | 97 +++++++++++++++++++++++++++++++ manifests/base/kustomization.yaml | 2 + manifests/ci/ds.yaml | 11 ++++ manifests/ci/kustomization.yaml | 10 ++++ 5 files changed, 145 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 manifests/base/install.yaml create mode 100644 manifests/base/kustomization.yaml create mode 100644 manifests/ci/ds.yaml create mode 100644 manifests/ci/kustomization.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..9269d16 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,25 @@ +name: CI +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: {} + +jobs: + e2e: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: nolar/setup-k3d-k3s@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + - run: kubectl create ns argo + - run: kubectl apply -n argo -f https://raw.githubusercontent.com/argoproj/argo-workflows/stable/manifests/quick-start-minimal.yaml + - run: docker build -f Dockerfile -t image-cache-daemon:ci . + - run: docker build -f Dockerfile.warden -t warden:ci . + - run: k3d image import image-cache-daemon:ci + - run: k3d image import warden:ci + - run: kubectl apply -k manifests/ci \ No newline at end of file diff --git a/manifests/base/install.yaml b/manifests/base/install.yaml new file mode 100644 index 0000000..368844e --- /dev/null +++ b/manifests/base/install.yaml @@ -0,0 +1,97 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: image-cache-daemon +spec: + selector: + matchLabels: + app: image-cache-daemon + template: + metadata: + labels: + app: image-cache-daemon + spec: + serviceAccountName: image-cache-daemon + containers: + - name: image-cache-daemon + image: exiges/image-cache-daemon:latest + imagePullPolicy: Always + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_UID + valueFrom: + fieldRef: + fieldPath: metadata.uid +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: image-cache-daemon +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: image-cache-daemon-cluster-role +rules: + - apiGroups: + - argoproj.io + resources: + - workflowtemplates + - cronworkflows + - clusterworkflowtemplates + verbs: + - get + - list + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: image-cache-daemon-cluster-role-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: image-cache-daemon-cluster-role +subjects: + - kind: ServiceAccount + name: image-cache-daemon + namespace: image-cache-daemon +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: image-cache-daemon-role +rules: + - apiGroups: + - "" + resources: + - pods + verbs: + - get + - list + - watch + - delete + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: image-cache-daemon-role-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: image-cache-daemon-role +subjects: +- kind: ServiceAccount + name: image-cache-daemon \ No newline at end of file diff --git a/manifests/base/kustomization.yaml b/manifests/base/kustomization.yaml new file mode 100644 index 0000000..4283b92 --- /dev/null +++ b/manifests/base/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - install.yaml \ No newline at end of file diff --git a/manifests/ci/ds.yaml b/manifests/ci/ds.yaml new file mode 100644 index 0000000..3a14ce5 --- /dev/null +++ b/manifests/ci/ds.yaml @@ -0,0 +1,11 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: image-cache-daemon +spec: + template: + spec: + containers: + - name: image-cache-daemon + args: + - --warden-image=warden:ci \ No newline at end of file diff --git a/manifests/ci/kustomization.yaml b/manifests/ci/kustomization.yaml new file mode 100644 index 0000000..36e4ae9 --- /dev/null +++ b/manifests/ci/kustomization.yaml @@ -0,0 +1,10 @@ +images: + - name: exiges/image-cache-daemon + newName: image-cache-daemon + newTag: ci + +resources: + - ../base + +patchesStrategicMerge: + - ds.yaml \ No newline at end of file From 79e8b69f881f912154822f009b42f8f08606e265 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Sun, 29 Aug 2021 19:21:28 -0400 Subject: [PATCH 02/14] wip --- test/e2e/node_test.go | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 test/e2e/node_test.go diff --git a/test/e2e/node_test.go b/test/e2e/node_test.go new file mode 100644 index 0000000..24011d1 --- /dev/null +++ b/test/e2e/node_test.go @@ -0,0 +1,44 @@ +package main + +import ( + "os" + + "os/exec" + "testing" + + "github.com/stretchr/testify/assert" +) + +func runCommandWithOutput(command string, args ...string) error { + cmd := exec.Command(command, args...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + + return cmd.Run() +} + +func runK3dCommand() error { + cmd := exec.Command("k3d") + + return cmd.Run() +} + +func TestImageCaching(t *testing.T) { + err := runCommandWithOutput("k3d", "cluster", "create", "foobar", "--no-lb") + + if !assert.NoError(t, err) { + return + } + + t.Cleanup(func() { + if err := runCommandWithOutput("k3d", "cluster", "delete", "foobar"); err != nil { + t.Errorf("failed to cleanup test cluster: %v", err) + } + }) + + err = runCommandWithOutput("docker", "build", "-f", "Dockerfile.warden", "-t", "warden:ci", ".") + + if !assert.NoError(t, err) { + return + } +} From ba51d7befcb0045d70f2c437bd3616f552eed0a2 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 00:21:04 -0400 Subject: [PATCH 03/14] wip --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e959567..2f6d721 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [ master ] jobs: - build: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -16,21 +16,43 @@ jobs: path: | ~/.cache/go-build ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + key: ${{ runner.os }}-go-test-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-go- + ${{ runner.os }}-go-test- - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.17 - - - name: Build - run: | - make bin/image-cache-daemon bin/warden - - name: Test run: go test -v ./... - + + e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Build Warden Image + uses: docker/build-push-action@v2 + with: + file: Dockerfile.warden + load: true + tags: | + ghcr.io/dcherman/image-cache-daemon-warden:latest + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Build Image Cache Daemon Image + uses: docker/build-push-action@v2 + with: + file: Dockerfile + load: true + tags: | + ghcr.io/dcherman/image-cache-daemon:latest + cache-from: type=gha + cache-to: type=gha,mode=max + lint: runs-on: ubuntu-latest steps: From 3629e7993f136edc86281f358a4807ba7803d1c1 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 00:21:23 -0400 Subject: [PATCH 04/14] wip --- .github/workflows/ci.yaml | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 9269d16..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: CI -on: - push: - branches: - - master - pull_request: - branches: - - master - workflow_dispatch: {} - -jobs: - e2e: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: nolar/setup-k3d-k3s@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - run: kubectl create ns argo - - run: kubectl apply -n argo -f https://raw.githubusercontent.com/argoproj/argo-workflows/stable/manifests/quick-start-minimal.yaml - - run: docker build -f Dockerfile -t image-cache-daemon:ci . - - run: docker build -f Dockerfile.warden -t warden:ci . - - run: k3d image import image-cache-daemon:ci - - run: k3d image import warden:ci - - run: kubectl apply -k manifests/ci \ No newline at end of file From d04e37f0d0c6cb8696b82cedac4d4440d3163cff Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 00:32:01 -0400 Subject: [PATCH 05/14] wip --- .github/workflows/ci.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f6d721..feffb78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,14 +26,48 @@ jobs: - name: Test run: go test -v ./... - e2e: + # Always build images just to ensure that they're buildable, + # but only push them to the registry if this is a push to master + build-images: runs-on: ubuntu-latest + needs: + - test + - lint + - e2e steps: - uses: actions/checkout@v2 - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Build Warden Image + uses: docker/build-push-action@v2 + with: + file: Dockerfile.warden + push: ${{ github.event_name == 'push'}} + platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 + tags: | + ghcr.io/dcherman/image-cache-daemon-warden:latest + ghcr.io/dcherman/image-cache-daemon-warden:{{ .Env.GITHUB_SHA }} + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Build Image Cache Daemon Image + uses: docker/build-push-action@v2 + with: + file: Dockerfile + push: ${{ github.event_name == 'push'}} + platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 + tags: | + ghcr.io/dcherman/image-cache-daemon:latest + ghcr.io/dcherman/image-cache-daemon:{{ .Env.GITHUB_SHA }} + cache-from: type=gha + cache-to: type=gha,mode=max + + + e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 - name: Build Warden Image uses: docker/build-push-action@v2 with: From ff474059aa984a31a9ca41ee2e305bb54b1a0370 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 00:34:44 -0400 Subject: [PATCH 06/14] wip --- .github/workflows/ci.yml | 2 ++ test/e2e/node_test.go | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feffb78..2bbdd6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - name: Build Warden Image uses: docker/build-push-action@v2 with: diff --git a/test/e2e/node_test.go b/test/e2e/node_test.go index 24011d1..3d76f4d 100644 --- a/test/e2e/node_test.go +++ b/test/e2e/node_test.go @@ -17,13 +17,9 @@ func runCommandWithOutput(command string, args ...string) error { return cmd.Run() } -func runK3dCommand() error { - cmd := exec.Command("k3d") - - return cmd.Run() -} - func TestImageCaching(t *testing.T) { + t.SkipNow() + err := runCommandWithOutput("k3d", "cluster", "create", "foobar", "--no-lb") if !assert.NoError(t, err) { From 6eed144e68fb21ca34e0973b35ca844af31f258f Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 00:49:40 -0400 Subject: [PATCH 07/14] wip --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bbdd6d..f86b62d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 tags: | ghcr.io/dcherman/image-cache-daemon-warden:latest - ghcr.io/dcherman/image-cache-daemon-warden:{{ .Env.GITHUB_SHA }} + ghcr.io/dcherman/image-cache-daemon-warden:{{ env.GITHUB_SHA }} cache-from: type=gha cache-to: type=gha,mode=max - name: Build Image Cache Daemon Image @@ -59,7 +59,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 tags: | ghcr.io/dcherman/image-cache-daemon:latest - ghcr.io/dcherman/image-cache-daemon:{{ .Env.GITHUB_SHA }} + ghcr.io/dcherman/image-cache-daemon:{{ env.GITHUB_SHA }} cache-from: type=gha cache-to: type=gha,mode=max From 970fc454efa9bbf62c2a0800c96ad3c2246d0bc8 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 00:58:48 -0400 Subject: [PATCH 08/14] wip --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f86b62d..bcbeb57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 tags: | ghcr.io/dcherman/image-cache-daemon-warden:latest - ghcr.io/dcherman/image-cache-daemon-warden:{{ env.GITHUB_SHA }} + ghcr.io/dcherman/image-cache-daemon-warden:${{ env.GITHUB_SHA }} cache-from: type=gha cache-to: type=gha,mode=max - name: Build Image Cache Daemon Image @@ -59,7 +59,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 tags: | ghcr.io/dcherman/image-cache-daemon:latest - ghcr.io/dcherman/image-cache-daemon:{{ env.GITHUB_SHA }} + ghcr.io/dcherman/image-cache-daemon:${{ env.GITHUB_SHA }} cache-from: type=gha cache-to: type=gha,mode=max @@ -70,6 +70,9 @@ jobs: - uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - uses: nolar/setup-k3d-k3s@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Build Warden Image uses: docker/build-push-action@v2 with: From 28d934b728c767bab64a29c48b329044a303310b Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 01:11:41 -0400 Subject: [PATCH 09/14] wip --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcbeb57..5117750 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 tags: | ghcr.io/dcherman/image-cache-daemon-warden:latest - ghcr.io/dcherman/image-cache-daemon-warden:${{ env.GITHUB_SHA }} + ghcr.io/dcherman/image-cache-daemon-warden:${{env.GITHUB_SHA}} cache-from: type=gha cache-to: type=gha,mode=max - name: Build Image Cache Daemon Image @@ -59,7 +59,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 tags: | ghcr.io/dcherman/image-cache-daemon:latest - ghcr.io/dcherman/image-cache-daemon:${{ env.GITHUB_SHA }} + ghcr.io/dcherman/image-cache-daemon:${{env.GITHUB_SHA}} cache-from: type=gha cache-to: type=gha,mode=max @@ -73,6 +73,7 @@ jobs: - uses: nolar/setup-k3d-k3s@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build Warden Image uses: docker/build-push-action@v2 with: @@ -82,6 +83,7 @@ jobs: ghcr.io/dcherman/image-cache-daemon-warden:latest cache-from: type=gha cache-to: type=gha,mode=max + - name: Build Image Cache Daemon Image uses: docker/build-push-action@v2 with: @@ -92,6 +94,9 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max + - run: k3d image import ghcr.io/dcherman/image-cache-daemon:latest + - run: k3d image import ghcr.io/dcherman/image-cache-daemon-warden:latest + lint: runs-on: ubuntu-latest steps: From 16713324a148088af2be46f0fd29a8bc7e889ba2 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 01:26:08 -0400 Subject: [PATCH 10/14] wip --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5117750..96ec488 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,14 @@ jobs: uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - run: env + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build Warden Image uses: docker/build-push-action@v2 with: From 51b9e42cc84ab04c1734ced5f111e75cc6a217a1 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 01:26:31 -0400 Subject: [PATCH 11/14] wip --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96ec488..23a532c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,10 +30,10 @@ jobs: # but only push them to the registry if this is a push to master build-images: runs-on: ubuntu-latest - needs: - - test - - lint - - e2e +# needs: +# - test +# - lint +# - e2e steps: - uses: actions/checkout@v2 - name: Set up QEMU From 8743dcc575440b20f12528f4c84e5772c761b849 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 01:29:31 -0400 Subject: [PATCH 12/14] wip --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23a532c..9623272 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 tags: | ghcr.io/dcherman/image-cache-daemon-warden:latest - ghcr.io/dcherman/image-cache-daemon-warden:${{env.GITHUB_SHA}} + ghcr.io/dcherman/image-cache-daemon-warden:${{ github.sha }} cache-from: type=gha cache-to: type=gha,mode=max - name: Build Image Cache Daemon Image @@ -67,7 +67,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 tags: | ghcr.io/dcherman/image-cache-daemon:latest - ghcr.io/dcherman/image-cache-daemon:${{env.GITHUB_SHA}} + ghcr.io/dcherman/image-cache-daemon:${{ github.sha }} cache-from: type=gha cache-to: type=gha,mode=max From 4f5d3984b8adca5885793c0328fc039b1eea6656 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 01:34:29 -0400 Subject: [PATCH 13/14] less arch for distroless support --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9623272..b8f12cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: with: file: Dockerfile.warden push: ${{ github.event_name == 'push'}} - platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 + platforms: linux/amd64,linux/arm64,linux/arm/v7 tags: | ghcr.io/dcherman/image-cache-daemon-warden:latest ghcr.io/dcherman/image-cache-daemon-warden:${{ github.sha }} @@ -64,7 +64,7 @@ jobs: with: file: Dockerfile push: ${{ github.event_name == 'push'}} - platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 + platforms: linux/amd64,linux/arm64,linux/arm/v7 tags: | ghcr.io/dcherman/image-cache-daemon:latest ghcr.io/dcherman/image-cache-daemon:${{ github.sha }} From ef412afcb01ed08104238449e74c45e9ec494a16 Mon Sep 17 00:00:00 2001 From: Daniel Herman Date: Mon, 18 Oct 2021 01:47:13 -0400 Subject: [PATCH 14/14] wip --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8f12cf..02b6168 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,32 @@ on: branches: [ master ] jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - run: GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/image-cache-daemon-amd64 main.go + - run: GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/image-cache-daemon-arm64 main.go + - run: GOARCH=arm CGO_ENABLED=0 go build -ldflags="-w -s" -o bin/image-cache-daemon-arm main.go + + - uses: actions/upload-artifact@v2 + with: + name: builds + path: bin/ + test: runs-on: ubuntu-latest steps: