Skip to content

Update Golang version to 1.23.1 #74

Update Golang version to 1.23.1

Update Golang version to 1.23.1 #74

Workflow file for this run

name: CRA
on:
push:
branches:
- main
paths:
- ".github/workflows/cra.yaml"
- "components/compass-runtime-agent/**"
- "!components/compass-runtime-agent/**.md"
- "!components/compass-runtime-agent/hack/boilerplate.go.txt"
- "tests/**"
- "!tests/**.md"
- "!tests/Dockerfile.*"
- "tests/Dockerfile.compass-runtime-agent"
pull_request_target:
types: [opened, synchronize, reopened]
paths:
- ".github/workflows/cra.yaml"
- "components/compass-runtime-agent/**"
- "!components/compass-runtime-agent/**.md"
- "!components/compass-runtime-agent/hack/boilerplate.go.txt"
- "tests/**"
- "!tests/**.md"
- "!tests/Dockerfile.*"
- "tests/Dockerfile.compass-runtime-agent"
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
pull-requests: read
runs-on: ubuntu-latest
outputs:
cra: ${{ steps.detect-files.outputs.cra_any_changed || steps.fallback-values.outputs.cra_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
continue-on-error: true
id: detect-files
uses: tj-actions/changed-files@d6babd6899969df1a11d14c368283ea4436bca78
with:
files_yaml: |
cra:
- components/compass-runtime-agent/**
- .github/workflows/cra.yaml
test:
- tests/**
- .github/workflows/cra.yaml
- name: Fallback values
id: fallback-values
if: steps.detect-files.outcome != 'success'
run: |
echo "cra_any_changed=true" >> $GITHUB_OUTPUT
echo "test_any_changed=true" >> $GITHUB_OUTPUT
unit-tests:
permissions:
contents: read
runs-on: ubuntu-latest
needs: setup
if: needs.setup.outputs.cra == '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/compass-runtime-agent/go.mod
cache-dependency-path: components/compass-runtime-agent/go.sum
- name: Run unit tests
working-directory: ./components/compass-runtime-agent
run: |
touch test.log
make test | tee -a test.log
- name: Archive test results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: cra-unit-test.log
path: ./components/compass-runtime-agent/test.log
- name: Unit test summary
if: success() || failure()
run: |
{
echo '## CRA Unit Tests'
echo "<details>"
echo "<summary>click to expand logs</summary>"
printf '\n```\n'
cat ./components/compass-runtime-agent/test.log
printf '\n```\n'
echo "</details>"
} >> $GITHUB_STEP_SUMMARY
k3d-integration:
# we're using reusable because we can't modify workflows as contributors
# it could cause the secret leakeages
uses: "./.github/workflows/reusable-k3d-agent-test.yml"
with:
k3d-version: v5.6.0
secrets:
compass-host: ${{ secrets.COMPASS_HOST }}
compass-client-id: ${{ secrets.COMPASS_CLIENT_ID }}
compass-client-secret: ${{ secrets.COMPASS_CLIENT_SECRET }}
build-test-image:
needs: setup
if: needs.setup.outputs.test == 'true'
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: compass-runtime-agent-test
dockerfile: Dockerfile.compass-runtime-agent
context: tests
build-image:
needs: setup
if: needs.setup.outputs.cra == 'true'
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: compass-runtime-agent
dockerfile: Dockerfile
context: components/compass-runtime-agent
print-images:
runs-on: ubuntu-latest
# if any of the build jobs succeeded - run this job
needs: [build-image, build-test-image]
if: always() && contains(needs.*.result, 'success')
steps:
- name: "Generate summary"
run: |
{
echo '## CRA 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
printf '\n```\n'
} >> $GITHUB_STEP_SUMMARY