54 lines (48 loc) · 1.32 KB
/
run-unit-tests-reusable.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Call this workflow from other jobs to execute unit tests in the current context
name: Run unit tests (reusable)
on:
workflow_call:
inputs:
release:
description: 'Determines if the workflow is called from release'
default: "true"
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get changed files
id: changed-files-specific
uses: tj-actions/changed-files@90a06d6ba9543371ab4df8eeca0be07ca6054959
with:
files: |
.github/**
api/**
cmd/**
config/**
controllers/**
deployments/**
examples/**
hack/**
internal/**
module-chart/**
module-resources/**
scripts/**
config.yaml
Dockerfile
go.mod
go.sum
main.go
Makefile
**/*.go
**/*.sh
- name: Set up go environment
if: ${{ steps.changed-files-specific.outputs.any_modified == 'true' || inputs.release == 'true' }}
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Run make test
if: ${{ steps.changed-files-specific.outputs.any_modified == 'true' || inputs.release == 'true' }}
run: make test