64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
name: Run bats tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- 'website/**'
|
|
- 'assets/**'
|
|
- 'backup/**'
|
|
- '*.md'
|
|
pull_request:
|
|
types: [opened, synchronize, ready_for_review, reopened]
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- 'website/**'
|
|
- 'assets/**'
|
|
- 'backup/**'
|
|
- '*.md'
|
|
|
|
jobs:
|
|
run-tests:
|
|
if: github.event.pull_request.draft == false
|
|
name: Run automated bats tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up env vars
|
|
run: |
|
|
echo "GO111MODULE=on" >> $GITHUB_ENV
|
|
echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
|
|
echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
|
|
echo "KIND_CLUSTER_NAME=$(sed -n 's/KIND_CLUSTER_NAME=//p' config.base.env | tr -d '\n' | tr -d '"')" >> $GITHUB_ENV
|
|
echo "GOPATH=/home/runner/go" >> $GITHUB_ENV
|
|
|
|
- name: Prepare go environment
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Ensure Golang runtime dependencies
|
|
run: make go-dependencies
|
|
|
|
- name: Setup Bats and libs
|
|
uses: bats-core/bats-action@1.5.5
|
|
with:
|
|
support-path: "${{ github.workspace }}/.bats/bats-support"
|
|
assert-path: "${{ github.workspace }}/.bats/bats-assert"
|
|
detik-path: "${{ github.workspace }}/.bats/bats-detik"
|
|
file-path: "${{ github.workspace }}/.bats/bats-file"
|
|
|
|
- name: Kind setup
|
|
uses: helm/kind-action@v1.9.0
|
|
with:
|
|
cluster_name: ${{env.KIND_CLUSTER_NAME}}
|
|
|
|
- name: Jenkins Operator - bats tests
|
|
env:
|
|
BATS_LIB_PATH: "${{ github.workspace }}/.bats"
|
|
run: make bats-tests
|