test: set GITHUB_TOKEN secret

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2023-01-24 00:29:03 +01:00
parent fe75972f55
commit 251b9d49f3
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
3 changed files with 10 additions and 5 deletions

View File

@ -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

View File

@ -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 /

View File

@ -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"]
}