Skip to content

Commit 27420c0

Browse files
committed
Use golang image to run tests step
Signed-off-by: Aurel Canciu <[email protected]>
1 parent e7acdab commit 27420c0

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM golang:1.15-alpine
2+
3+
# Add any build or testing essential system packages
4+
RUN apk add --no-cache build-base git
5+
6+
# Use the GitHub Actions uid:gid combination for proper fs permissions
7+
RUN addgroup -g 116 -S test && adduser -u 1001 -S -g test test
8+
9+
# Run as test user
10+
USER test
11+
12+
ENTRYPOINT ["/bin/sh", "-c"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: 'Run tests'
2+
description: 'Run tests in docker container'
3+
inputs:
4+
command:
5+
description: 'Command to run inside the container'
6+
required: true
7+
default: 'make test'
8+
runs:
9+
using: 'docker'
10+
image: 'Dockerfile'
11+
args:
12+
- ${{ inputs.command }}

.github/workflows/e2e.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@ jobs:
1515
- name: Restore Go cache
1616
uses: actions/cache@v1
1717
with:
18-
path: ~/go/pkg/mod
18+
path: /home/runner/work/_temp/_github_home/go/pkg/mod
1919
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
2020
restore-keys: |
2121
${{ runner.os }}-go-
22-
- name: Setup Go
23-
uses: actions/setup-go@v2
24-
with:
25-
go-version: 1.15.x
2622
- name: Setup Kubernetes
2723
uses: engineerd/[email protected]
2824
- name: Setup Kustomize
@@ -32,8 +28,9 @@ jobs:
3228
- name: Setup Helm
3329
uses: fluxcd/pkg/actions/helm@main
3430
- name: Run tests
35-
run: make test
31+
uses: ./.github/actions/run-tests
3632
env:
33+
GOPATH: /github/home/go
3734
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
3835
- name: Check if working tree is dirty
3936
run: |

0 commit comments

Comments
 (0)