From 251b9d49f31bb7a9c4577560f5eee3af442e5f16 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 24 Jan 2023 00:29:03 +0100 Subject: [PATCH] test: set GITHUB_TOKEN secret Signed-off-by: CrazyMax --- .github/workflows/test.yml | 2 ++ dev.Dockerfile | 11 ++++++----- docker-bake.hcl | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef0e300..1e66744 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,8 @@ jobs: uses: docker/bake-action@v2 with: targets: test-coverage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - # name: Upload coverage # uses: codecov/codecov-action@v3 diff --git a/dev.Dockerfile b/dev.Dockerfile index c0595d5..2c724cd 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -55,11 +55,12 @@ FROM docker/buildx-bin:${BUILDX_VERSION} as buildx FROM deps AS test RUN --mount=type=bind,target=.,rw \ - --mount=type=cache,target=/src/node_modules \ - --mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \ - --mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \ - --mount=type=bind,from=buildx,source=/buildx,target=/usr/bin/buildx \ - yarn run test-coverage --coverageDirectory=/tmp/coverage + --mount=type=cache,target=/src/node_modules \ + --mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \ + --mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \ + --mount=type=bind,from=buildx,source=/buildx,target=/usr/bin/buildx \ + --mount=type=secret,id=GITHUB_TOKEN \ + GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) yarn run test-coverage --coverageDirectory=/tmp/coverage FROM scratch AS test-coverage COPY --from=test /tmp/coverage / diff --git a/docker-bake.hcl b/docker-bake.hcl index 85b9a61..6b5180e 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -44,10 +44,12 @@ target "test" { dockerfile = "dev.Dockerfile" target = "test" output = ["type=cacheonly"] + secret = ["id=GITHUB_TOKEN,env=GITHUB_TOKEN"] } target "test-coverage" { dockerfile = "dev.Dockerfile" target = "test-coverage" output = ["./coverage"] + secret = ["id=GITHUB_TOKEN,env=GITHUB_TOKEN"] }