Skip to content

Commit

Permalink
Move CI to testing in docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
palexster committed May 19, 2021
1 parent 2cbef45 commit 739701d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
45 changes: 33 additions & 12 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build/liqo-test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 739701d

Please sign in to comment.