mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-11 08:55:27 +03:00
Feature - Include e2e tests for docker
Included e2e tests for docker. Included .Dockerignore to ignore files. Included Docker build in the Makefile.
This commit is contained in:
parent
cab29a2747
commit
a7174d8ad7
12
.Dockerignore
Normal file
12
.Dockerignore
Normal file
@ -0,0 +1,12 @@
|
||||
# Ignore everything
|
||||
**
|
||||
|
||||
# Allow files and directories
|
||||
!go.mod
|
||||
!go.sum
|
||||
!main.go
|
||||
!/pkg/**
|
||||
!/roundtripper/**
|
||||
!/cmd/**
|
||||
!/checks/**
|
||||
!/checker/**
|
24
.github/workflows/integration.yml
vendored
24
.github/workflows/integration.yml
vendored
@ -5,7 +5,8 @@ on:
|
||||
types: [ok-to-test-command]
|
||||
|
||||
name: Integration tests
|
||||
|
||||
env:
|
||||
IMAGE_NAME: scorecard
|
||||
jobs:
|
||||
integration-trusted:
|
||||
runs-on: ubuntu-latest
|
||||
@ -92,6 +93,27 @@ jobs:
|
||||
ginkgo --focus="E2E TEST:executable|E2E TEST:blob" ./...
|
||||
fi
|
||||
|
||||
- name: Build docker image
|
||||
run: docker build . --file Dockerfile --tag $IMAGE_NAME
|
||||
|
||||
- name: Test docker image
|
||||
env:
|
||||
GITHUB_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
|
||||
run: |
|
||||
if [[ ! -v GITHUB_AUTH_TOKEN ]]; then
|
||||
echo "GITHUB_AUTH_TOKEN is not set, skip test"
|
||||
exit 1
|
||||
elif [[ -z "$GITHUB_AUTH_TOKEN" ]]; then
|
||||
echo "GITHUB_AUTH_TOKEN is set to the empty string, skip test"
|
||||
exit 1
|
||||
else
|
||||
go get github.com/onsi/ginkgo/ginkgo@v1.14.2
|
||||
go mod download
|
||||
mkdir -p bin
|
||||
docker run -e GITHUB_AUTH_TOKEN=$GITHUB_AUTH_TOKEN $IMAGE_NAME --show-details --repo=https://github.com/ossf/scorecard --metadata=openssf --format json > ./bin/results.json
|
||||
ginkgo -p -v --focus="E2E TEST:executable" ./...
|
||||
fi
|
||||
|
||||
- name: find comment
|
||||
if: ${{ always() }}
|
||||
uses: peter-evans/find-comment@v1
|
||||
|
6
Makefile
6
Makefile
@ -1,6 +1,7 @@
|
||||
SHELL := /bin/bash
|
||||
GOBIN ?= $(GOPATH)/bin
|
||||
GINKGO ?= $(GOBIN)/ginkgo
|
||||
IMAGE_NAME = scorecard
|
||||
|
||||
.PHONY: help
|
||||
help: ## Display this help
|
||||
@ -77,3 +78,8 @@ verify-go-mod: ## Verify the go modules
|
||||
go mod tidy && \
|
||||
go mod verify
|
||||
./hack/tree-status
|
||||
|
||||
.PHONY: dockerbuild
|
||||
dockerbuild: ## Runs docker build
|
||||
$(call ndef, GITHUB_AUTH_TOKEN)
|
||||
docker build . --file Dockerfile --tag $(IMAGE_NAME)
|
||||
|
Loading…
Reference in New Issue
Block a user