Bump the k8s group across 5 directories with 6 updates #68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: App Gateway | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/gateway.yaml" | |
- "components/central-application-gateway/**" | |
- "!components/central-application-gateway/**.md" | |
- "tests/**" | |
- "!tests/**.md" | |
- "!tests/Dockerfile.*" | |
- "tests/Dockerfile.gateway" | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
paths: | |
- ".github/workflows/gateway.yaml" | |
- "components/central-application-gateway/**" | |
- "!components/central-application-gateway/**.md" | |
- "tests/**" | |
- "!tests/**.md" | |
- "!tests/Dockerfile.*" | |
- "tests/Dockerfile.gateway" | |
permissions: | |
id-token: write # This is required for requesting the JWT token | |
contents: read # This is required for actions/checkout | |
jobs: | |
setup: | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
outputs: | |
gateway: ${{ steps.detect-files.outputs.gateway_any_changed || steps.fallback-values.outputs.gateway_any_changed }} | |
test: ${{ steps.detect-files.outputs.test_any_changed || steps.fallback-values.outputs.test_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 }} | |
- name: Detect files | |
id: detect-files | |
uses: tj-actions/changed-files@d6babd6899969df1a11d14c368283ea4436bca78 | |
with: | |
files_yaml: | | |
gateway: | |
- components/central-application-gateway/** | |
- .github/workflows/gateway.yaml | |
test: | |
- tests/** | |
- .github/workflows/gateway.yaml | |
- name: Fallback values | |
id: fallback-values | |
if: steps.detect-files.outcome != 'success' | |
run: | | |
echo "gateway_any_changed=true" >> $GITHUB_OUTPUT | |
echo "test_any_changed=true" >> $GITHUB_OUTPUT | |
unit-tests: | |
runs-on: ubuntu-latest | |
needs: setup | |
if: needs.setup.outputs.gateway == 'true' | |
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@v5 | |
with: | |
go-version-file: components/central-application-gateway/go.mod | |
cache-dependency-path: components/central-application-gateway/go.sum | |
- name: Run unit tests | |
working-directory: ./components/central-application-gateway | |
run: go test ./... | tee test.log | |
- name: Archive test results | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gateway-unit-test.log | |
path: ./components/central-application-gateway/test.log | |
- name: Unit test summary | |
if: success() || failure() | |
run: | | |
{ | |
echo '## Gateway Unit Tests' | |
echo "<details>" | |
echo "<summary>click to expand logs</summary>" | |
printf '\n```\n' | |
cat ./components/central-application-gateway/test.log | |
printf '\n```\n' | |
echo "</details>" | |
} >> $GITHUB_STEP_SUMMARY | |
integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: azure/setup-helm@v4.1.0 | |
id: install | |
- 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: | |
go-version: 1.23.1 | |
- name: Install k3d | |
env: | |
K3D_URL: https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | |
DEFAULT_K3D_VERSION: v5.6.0 | |
run: curl --silent --fail $K3D_URL | TAG=$DEFAULT_K3D_VERSION bash | |
- name: Run unit tests | |
run: make -C tests/hack/ci k3d-gateway-tests | |
- name: Archive test results | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-gateway-test-results | |
path: application-gateway-test.log | |
- name: Integration test summary | |
if: success() || failure() | |
run: | | |
{ | |
echo '## Gateway Integration Tests' | |
echo "<details>" | |
echo "<summary>click to expand logs</summary>" | |
printf '\n```\n' | |
cat application-gateway-test.log | |
printf '\n```\n' | |
echo "</details>" | |
} >> $GITHUB_STEP_SUMMARY | |
build-test-image: | |
needs: setup | |
if: needs.setup.outputs.test == 'true' | |
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main | |
with: | |
name: gateway-test | |
dockerfile: Dockerfile.gateway | |
context: tests | |
build-mock-app-image: | |
needs: setup | |
if: needs.setup.outputs.test == 'true' | |
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main | |
with: | |
name: mock-app | |
dockerfile: Dockerfile.mockapp | |
context: tests | |
build-image: | |
needs: setup | |
if: needs.setup.outputs.gateway == 'true' | |
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main | |
with: | |
name: central-application-gateway | |
dockerfile: Dockerfile | |
context: components/central-application-gateway | |
print-images: | |
runs-on: ubuntu-latest | |
# if any of the build jobs succeeded - run this job | |
needs: [build-image, build-test-image, build-mock-app-image] | |
if: always() && contains(needs.*.result, 'success') | |
steps: | |
- name: "Generate summary" | |
run: | | |
{ | |
echo '## Gateway Images' | |
printf '\n```json\n' | |
if [ "${{ needs.build-image.result }}" == "success" ]; then | |
echo '${{ needs.build-image.outputs.images }}' | jq | |
fi | |
if [ "${{ needs.build-test-image.result }}" == "success" ]; then | |
echo '${{ needs.build-test-image.outputs.images }}' | jq | |
fi | |
if [ "${{ needs.build-mock-app-image.result }}" == "success" ]; then | |
echo '${{ needs.build-mock-app-image.outputs.images }}' | jq | |
fi | |
printf '\n```\n' | |
} >> $GITHUB_STEP_SUMMARY |