Skip to content

Bump the k8s group across 1 directory with 2 updates #107

Bump the k8s group across 1 directory with 2 updates

Bump the k8s group across 1 directory with 2 updates #107

name: Compass Manager
on:
push:
branches:
- main
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-*"
paths-ignore:
- .reuse
- hack/
- LICENSES/
- LICENSE
- .gitignore
- "**.md"
pull_request_target:
types: [opened, synchronize, reopened]
paths-ignore:
- .reuse
- hack/
- LICENSES/
- LICENSE
- .gitignore
- "**.md"
permissions:
id-token: write # This is required for requesting the JWT token
contents: read # This is required for actions/checkout
env:
unit-test-log: unit-test.log
jobs:
setup:
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
code: ${{ steps.detect-files.outputs.code_any_changed || steps.fallback-values.outputs.code_any_changed}}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- id: tag
if: github.event_name == 'push' && github.ref_type == 'tag'
run: echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Detect files
id: detect-files
continue-on-error: true
uses: tj-actions/changed-files@d6babd6899969df1a11d14c368283ea4436bca78
with:
files_yaml: |
code:
- ./**.go
- ./go.mod
- ./go.sum
- name: Fallback values
id: fallback-values
if: steps.detect-files.outcome != 'success'
run: |
echo "code_any_changed=true" >> $GITHUB_OUTPUT
unit-tests:
permissions:
contents: read
needs: setup
if: needs.setup.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Set up go environment
uses: actions/setup-go@v4
with:
cache-dependency-path: go.sum
go-version-file: go.mod
- name: Run unit tests
run: make test | tee ${{ env.unit-test-log }}
- name: Upload test logs artifact
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: ${{ env.unit-test-log }}
path: ${{ env.unit-test-log }}
build-image:
needs: setup
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main # Usage: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: compass-manager
dockerfile: Dockerfile
context: .
tags: ${{ needs.setup.outputs.tag }}
summary:
runs-on: ubuntu-latest
needs: [build-image, unit-tests]
if: success() || failure()
steps:
- name: "Download test log"
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: ${{ env.unit-test-log }}
- name: "Generate summary"
run: |
{
echo '# Compass Manager'
# if test log exists
if [ -f ${{ env.unit-test-log }} ]; then
echo '## Unit Tests'
printf '\n<details>\n<summary>click to expand logs</summary>\n'
printf '\n```\n'
cat ${{ env.unit-test-log }}
printf '\n```\n</details>\n'
fi
# if build-image was successful
if [ "${{ needs.build-image.result }}" == "success" ]; then
printf '\n\n## Image\n'
printf '\n```json\n'
echo '${{ needs.build-image.outputs.images }}' | jq
printf '\n```\n'
fi
} >> $GITHUB_STEP_SUMMARY