Skip to content

feat: prevent Tasks in terminal state from leaking PVCs #183

feat: prevent Tasks in terminal state from leaking PVCs

feat: prevent Tasks in terminal state from leaking PVCs #183

#
# Copyright (c) 2023 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/carbynestack/klyshko.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Build and test Operator
on:
workflow_dispatch:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
env:
WORKING_DIRECTORY: klyshko-operator
jobs:
changes:
runs-on: ubuntu-22.04
permissions:
pull-requests: read
outputs:
operator: ${{ steps.filter.outputs.operator }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check whether Operator codebase (w/o chart) is affected
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
operator:
- '${{ env.WORKING_DIRECTORY }}/!(charts/**)/**'
operator-test:
runs-on: ubuntu-22.04
needs: changes
if: ${{ needs.changes.outputs.operator == 'true' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: ${{ env.WORKING_DIRECTORY }}/go.mod
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/go.sum
- name: Build and Test
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
make test
- name: Publishing Coverage
uses: codecov/codecov-action@v3
with:
files: ${{ env.WORKING_DIRECTORY }}/cover.out
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov
# This is required to allow for setting the test job as required in scenarios
# where the tests are not actually run, e.g., when there are no changes to
# the relevant codebase
operator-test-status:
runs-on: ubuntu-22.04
needs: operator-test
if: '!cancelled()' # Makes the job run regardless whether 'operator-test' succeeds or not but allows for cancellation
steps:
- name: Tests successful
if: ${{ !(contains(needs.operator-test.result, 'failure')) }}
run: exit 0
- name: Tests failed
if: ${{ contains(needs.operator-test.result, 'failure') }}
run: exit 1