Use golang image to run tests step
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
This commit is contained in:
parent
e7acdabc79
commit
27420c0454
|
@ -0,0 +1,12 @@
|
||||||
|
FROM golang:1.15-alpine
|
||||||
|
|
||||||
|
# Add any build or testing essential system packages
|
||||||
|
RUN apk add --no-cache build-base git
|
||||||
|
|
||||||
|
# Use the GitHub Actions uid:gid combination for proper fs permissions
|
||||||
|
RUN addgroup -g 116 -S test && adduser -u 1001 -S -g test test
|
||||||
|
|
||||||
|
# Run as test user
|
||||||
|
USER test
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/sh", "-c"]
|
|
@ -0,0 +1,12 @@
|
||||||
|
name: 'Run tests'
|
||||||
|
description: 'Run tests in docker container'
|
||||||
|
inputs:
|
||||||
|
command:
|
||||||
|
description: 'Command to run inside the container'
|
||||||
|
required: true
|
||||||
|
default: 'make test'
|
||||||
|
runs:
|
||||||
|
using: 'docker'
|
||||||
|
image: 'Dockerfile'
|
||||||
|
args:
|
||||||
|
- ${{ inputs.command }}
|
|
@ -15,14 +15,10 @@ jobs:
|
||||||
- name: Restore Go cache
|
- name: Restore Go cache
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ~/go/pkg/mod
|
path: /home/runner/work/_temp/_github_home/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-go-
|
${{ runner.os }}-go-
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: 1.15.x
|
|
||||||
- name: Setup Kubernetes
|
- name: Setup Kubernetes
|
||||||
uses: engineerd/setup-kind@v0.5.0
|
uses: engineerd/setup-kind@v0.5.0
|
||||||
- name: Setup Kustomize
|
- name: Setup Kustomize
|
||||||
|
@ -32,8 +28,9 @@ jobs:
|
||||||
- name: Setup Helm
|
- name: Setup Helm
|
||||||
uses: fluxcd/pkg/actions/helm@main
|
uses: fluxcd/pkg/actions/helm@main
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: make test
|
uses: ./.github/actions/run-tests
|
||||||
env:
|
env:
|
||||||
|
GOPATH: /github/home/go
|
||||||
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
|
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
|
||||||
- name: Check if working tree is dirty
|
- name: Check if working tree is dirty
|
||||||
run: |
|
run: |
|
||||||
|
|
Loading…
Reference in New Issue