diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 24c9f69520..a4786117ca 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -254,20 +254,41 @@ jobs: repository: "${{ needs.configure.outputs.repo-name }}" persist-credentials: false - - name: Install Kubebuilder - run: | - version=2.3.1 # latest stable version - arch=amd64 - curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${version}_linux_${arch}.tar.gz" - tar -zxvf kubebuilder_${version}_linux_${arch}.tar.gz - mv kubebuilder_${version}_linux_${arch} kubebuilder && sudo mv kubebuilder /usr/local/ + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - - name: Get dependencies for Test execution - run: | - go get -u github.com/ory/go-acc + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-liqo-test-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-liqo-test-buildx- - - name: Launch Test - run: go-acc ./... --ignore liqo/test/e2e + - name: Build ${{ matrix.component }} image + uses: docker/build-push-action@v2 + with: + context: . + platforms: ${{ needs.configure.outputs.architectures }} + tags: | + liqo/liqo-test-${{ needs.configure.outputs.repo-suffix }}:latest + liqo/liqo-test-${{ needs.configure.outputs.repo-suffix }}:${{ needs.configure.outputs.commit_ref }} + push: false + file: build/${{ matrix.component }}/Dockerfile + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + + - name: Launch Test (Docker Container) + uses: addnab/docker-run-action@v3 + with: + options: | + --mount type=bind,src=$(shell pwd),dst=/go/src/liqotech/liqo -w /go/src/liqotech/liqo \ + -v {{ github_workspace }}:/opt + image: liqo/liqo-test-${{ needs.configure.outputs.repo-suffix }}:${{ needs.configure.outputs.commit_ref }} + run: | + cd /go/src/liqotech/liqo + go-acc ./... --ignore liqo/test/e2e + cp coverage.txt /opt/coverage.txt - name: Send coverage uses: shogo82148/actions-goveralls@v1.4.3 diff --git a/Makefile b/Makefile index 66e12bc97f..9cfcaccf02 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ ifeq (, $(shell docker image ls | grep liqo-test)) endif # Run unit tests -unit: test-container gen +unit: test-container docker run --mount type=bind,src=$(shell pwd),dst=/go/src/liqo -w /go/src/liqo --rm liqo-test # Run e2e tests diff --git a/build/liqo-test/Dockerfile b/build/liqo-test/Dockerfile index 7417adc582..5ce1342263 100644 --- a/build/liqo-test/Dockerfile +++ b/build/liqo-test/Dockerfile @@ -11,6 +11,6 @@ RUN curl -sL https://go.kubebuilder.io/dl/2.3.0/$(go env GOOS)/$(go env GOARCH) RUN mv /tmp/kubebuilder_2.3.0_$(go env GOOS)_$(go env GOARCH) /usr/local/kubebuilder # Install goimports -RUN GO111MODULE="on" go get golang.org/x/tools/cmd/goimports@v0.1.1 +RUN GO111MODULE="on" go get -u github.com/ory/go-acc -ENTRYPOINT go test -cover $(go list ./... | grep -v "e2e") +ENTRYPOINT go-acc ./... --ignore liqo/test/e2e