1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/.github/workflows/cli.yaml
Charles-Edouard Brétéché fc79ca96a2
refactor: clearly separate makefile ko targets for build and publish (#4450)
* refactor: clearly separate makefile ko targets for build and publish

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fixes

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-08-30 17:30:28 +02:00

58 lines
1.6 KiB
YAML

name: cli
on:
push:
branches:
- 'main'
- 'release*'
paths-ignore:
- 'README.md'
- 'docs/**'
- '.github/config.yml'
pull_request:
branches:
- 'main'
- 'release*'
paths-ignore:
- 'README.md'
- 'docs/**'
- '.github/config.yml'
permissions: read-all
jobs:
cli-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4 # v2.1.5
with:
go-version: 1.18
- name: Cache Go modules
uses: actions/cache@d9747005de0f7240e5d35a68dca96b3f41b8b340 # v1.2.0
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test Policy
run: |
if [[ ${{ github.event_name }} == "push" ]]
then
export TEST_GIT_BRANCH=${GITHUB_REF##*/}
elif [[ ${{ github.event_name }} == "pull_request" ]]
then
export TEST_GIT_BRANCH=${{ github.event.pull_request.base.ref }}
fi
make -j4 test-cli
CLI_PATH=$PWD/cmd/cli/kubectl-kyverno/kubectl-kyverno
$CLI_PATH test ./test/cli/test-fail/missing-policy && exit 1 || exit 0
$CLI_PATH test ./test/cli/test-fail/missing-rule && exit 1 || exit 0
$CLI_PATH test ./test/cli/test-fail/missing-resource && exit 1 || exit 0