Skip to content

Commit

Permalink
Merge branch 'main' into youngp/remove-azlogin
Browse files Browse the repository at this point in the history
  • Loading branch information
youngbupark authored Apr 3, 2024
2 parents 5ecebe1 + c8fa814 commit e5743b3
Show file tree
Hide file tree
Showing 218 changed files with 1,816 additions and 925 deletions.
20 changes: 20 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "30...100"
status:
project:
default:
informational: true
target: auto
threshold: 0%

ignore:
- "**/mock_*.go" # ignore all mock files
- "pkg/armrpc/rpctest" # ignore all test helpers in rpctest
- "**/zz_generated*.go" # ignore autogenerated files from autorest
- "pkg/controller/api" # CRD related files
- "pkg/ucp/store/apiserverstore/api" # CRD related files
4 changes: 2 additions & 2 deletions .github/actions/download-pr-data-artifact/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
using: "composite"
steps:
- name: Download artifact
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
Expand All @@ -34,7 +34,7 @@ runs:
run: unzip pr_number.zip
- name: Set PR number
id: set-pr-number
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
let fs = require('fs');
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/process-test-results/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ runs:
files: |
${{ inputs.result_directory }}/processed/*.xml
- name: 'Upload ${{ inputs.test_group_name }} Results'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ inputs.artifact_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/save-pr-as-artifact/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
run: |
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr/
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/setup-rad-cli/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ runs:
using: "composite"
steps:
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
- name: Get Go Cache path
Expand All @@ -13,7 +13,7 @@ runs:
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
Expand All @@ -22,12 +22,12 @@ runs:
restore-keys: |
${{ runner.os }}-go-
- name: Setup kubectl
uses: azure/setup-kubectl@v2.0
uses: azure/setup-kubectl@v4
- name: Parse release version and set environment variables
shell: bash
run: python ./.github/scripts/get_release_version.py
- name: Download release artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: rad_cli_linux_amd64
path: dist
Expand Down
28 changes: 16 additions & 12 deletions .github/scripts/cleanup-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,26 @@ set -e
echo "cleaning up cluster"

# Delete all test resources in queuemessages.
echo "delete all resources in queuemessages.ucp.dev"
kubectl delete queuemessages.ucp.dev -n radius-system --all
if kubectl get crd queuemessages.ucp.dev > /dev/null 2>&1; then
echo "delete all resources in queuemessages.ucp.dev"
kubectl delete queuemessages.ucp.dev -n radius-system --all
fi

# Testing deletion of deployment.apps.

# Delete all test resources in resources without proxy resource.
echo "delete all resources in resources.ucp.dev"
resources=$(kubectl get resources.ucp.dev -n radius-system --no-headers -o custom-columns=":metadata.name")
for r in $resources; do
if [[ $r == scope.local.* || $r == scope.aws.* || -z "$r" ]]; then
echo "skip deletion: $r"
else
echo "delete resource: $r"
kubectl delete resources.ucp.dev $r -n radius-system --ignore-not-found=true
fi
done
if kubectl get crd resources.ucp.dev > /dev/null 2>&1; then
echo "delete all resources in resources.ucp.dev"
resources=$(kubectl get resources.ucp.dev -n radius-system --no-headers -o custom-columns=":metadata.name")
for r in $resources; do
if [[ $r == scope.local.* || $r == scope.aws.* || -z "$r" ]]; then
echo "skip deletion: $r"
else
echo "delete resource: $r"
kubectl delete resources.ucp.dev $r -n radius-system --ignore-not-found=true
fi
done
fi

# Delete all test namespaces.
echo "delete all test namespaces"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
if: github.repository == 'radius-project/radius'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Parse release version and set environment variables
run: python ./.github/scripts/get_release_version.py
# The install scripts are not versioned. They go to tools/rad/install.{sh,ps1}
Expand Down
149 changes: 31 additions & 118 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,12 @@ jobs:
target_arch: arm64
steps:
- name: Check out repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
cache-dependency-path: go.sum
- name: Restore the previous coverage
uses: actions/cache/restore@v3
with:
path: ./dist/cache
key: radius-coverage-
- name: Parse release version and set environment variables
run: python ./.github/scripts/get_release_version.py
- name: Make build
Expand All @@ -101,10 +96,20 @@ jobs:
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux'
env:
GOTESTSUM_OPTS: '--junitfile ./dist/unit_test/results.xml'
GOTEST_OPTS: '-race -coverprofile ./dist/ut_coverage_orig.out'
GOTEST_OPTS: '-race -coverprofile ./dist/unit_test/ut_coverage.out'
run: |
mkdir -p ./dist/unit_test
go install gotest.tools/gotestsum@v${{ env.GOTESTSUMVERSION }}
make test
- name: Upload coverage to Codecov
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
codecov_yml_path: ./.codecov.yml
file: ./dist/unit_test/ut_coverage.out
fail_ci_if_error: false
verbose: true
- name: Process Unit Test Results
uses: ./.github/actions/process-test-results
# Always is required here to make sure this target runs even when tests fail.
Expand All @@ -123,95 +128,18 @@ jobs:
run: |
mkdir ${{ env.RELEASE_PATH }}
cp ./dist/${{ matrix.target_os}}_${{ matrix.target_arch}}/release/rad.exe ${{ env.RELEASE_PATH }}/rad_${{ matrix.target_os}}_${{ matrix.target_arch}}.exe
- name: Upload Release binaries
uses: actions/upload-artifact@v3
with:
name: rad_cli_release
path: ${{ env.RELEASE_PATH }}
- name: Upload CLI binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: rad_cli_${{ matrix.target_os}}_${{ matrix.target_arch}}
path: |
./dist/${{ matrix.target_os}}_${{ matrix.target_arch}}/release/rad
./dist/${{ matrix.target_os}}_${{ matrix.target_arch}}/release/rad.exe
- name: Generate unit-test coverage files
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux'
run: |
# Remove mock, generated files, and datamodels from original coverage output.
cat ./dist/ut_coverage_orig.out | grep -v "mock" | grep -v "zz_" | grep -v "armrpc/rpctest" | grep -v '/datamodel/[A-za-z0-9_]*.go' > $COVERAGE_FILE
# Generate reports.
$GO_TOOL_COVER -func=$COVERAGE_FILE -o ./dist/ut_coverage.txt
$GO_TOOL_COVER -html=$COVERAGE_FILE -o ./dist/ut_coverage.html
# Parse total coverage rate from report.
UT_COVERAGE=`cat ./dist/ut_coverage.txt | grep total: | grep -Eo '[0-9]+\.[0-9]+'`
echo "Test coverage : $UT_COVERAGE"
echo "ut_coverage=$UT_COVERAGE" >> $GITHUB_ENV
mkdir -p ./dist/cache
MAIN_COVERAGE=0
if [ -f "./dist/cache/ut_coverage.txt" ]; then
MAIN_COVERAGE=$(cat ./dist/cache/ut_coverage.txt | grep total: | grep -Eo '[0-9]+\.[0-9]+')
fi
echo "main_coverage=$MAIN_COVERAGE" >> $GITHUB_ENV
if (( $(echo "$UT_COVERAGE < $MAIN_COVERAGE" | bc -l) )) ; then
COLOR=red
else
COLOR=green
fi
DIFF_RATE=$(echo "$UT_COVERAGE-$MAIN_COVERAGE" | bc -l)
echo "diff_coverage=$DIFF_RATE" >> $GITHUB_ENV
echo "coverage_img=https://img.shields.io/badge/coverage-$UT_COVERAGE%25-$COLOR" >> $GITHUB_ENV
# copy coverage to cache
cp ./dist/ut_coverage.txt ./dist/cache/
env:
COVERAGE_FILE: ./dist/ut_coverage.out
GO_TOOL_COVER: go tool cover
- name: Upload unit-test coverage artifact
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux'
uses: actions/upload-artifact@v3
with:
name: unit_test_coverage
path: |
./dist/coverage_orig.out
./dist/ut_coverage.out
./dist/ut_coverage.txt
./dist/ut_coverage.html
- name: Add coverage result comment
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' && github.event.pull_request && github.event.pull_request.head.repo.full_name == github.repository
uses: marocchino/sticky-pull-request-comment@v2
with:
header: testcov-${{ github.run_id }}
number: ${{ github.event.pull_request.number }}
hide: true
hide_classify: OUTDATED
message: |
![${{ env.ut_coverage }}](${{ env.coverage_img }})
For the detailed report, please go to `Checks tab`, click `Build and Test`, and then download `unit_test_coverage` artifact at the bottom of build page.
* Your PR branch coverage: ${{ env.ut_coverage }} %
* main branch coverage: ${{ env.main_coverage }} %
* diff coverage: ${{ env.diff_coverage }} %
> The coverage result does not include the functional test coverage.
- name: Save coverage (only main push)
uses: actions/cache/save@v3
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' && github.ref == 'refs/heads/main'
with:
path: ./dist/cache
key: radius-coverage-${{ github.sha }}-${{ github.run_number }}
path: ${{ env.RELEASE_PATH }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: oras-project/setup-oras@v1
- uses: oras-project/setup-oras@main
with:
version: ${{ env.ORAS_VERSION }}
- name: Push latest rad cli binary to GHCR (unix-like)
Expand All @@ -231,23 +159,23 @@ jobs:
if: github.repository == 'radius-project/radius'
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Parse release version and set environment variables
run: python ./.github/scripts/get_release_version.py
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Push container images (latest)
Expand Down Expand Up @@ -291,9 +219,9 @@ jobs:
OCI_REPOSITORY: 'radius-project/helm-chart'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install helm
uses: Azure/setup-helm@v3
uses: azure/setup-helm@v4
with:
version: 'v3.11.1'
- name: Parse release version and set environment variables
Expand Down Expand Up @@ -333,16 +261,19 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Parse release version and set environment variables
run: python ./.github/scripts/get_release_version.py
- name: Download release artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: rad_cli_release
pattern: rad_cli_*
merge-multiple: true
path: ${{ env.RELEASE_PATH }}
- name: generate checksum files
run: cd ${{ env.RELEASE_PATH }} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd -
run: |
cd ${{ env.RELEASE_PATH }} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd -
ls -l ${{ env.RELEASE_PATH }}
- name: Create GitHub RC Release (pre-release and auto-generate release notes)
if: ${{ contains(env.REL_VERSION, 'rc') }}
run: |
Expand All @@ -360,21 +291,3 @@ jobs:
--title "Radius v${{ env.REL_VERSION }}" \
--notes-file docs/release-notes/v${{ env.REL_VERSION }}.md \
--verify-tag
delete_artifacts:
name: Delete artifacts
needs: ['build-and-push-cli']
if: github.repository == 'radius-project/radius' && ${{ always() && !contains(needs.build-and-push-cli.result, 'failure') }}
runs-on: ubuntu-latest
steps:
- name: Delete release artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
rad_cli_windows_amd64
rad_cli_linux_amd64
rad_cli_darwin_amd64
rad_cli_linux_arm
rad_cli_darwin_arm64
rad_cli_linux_arm64
failOnError: false
2 changes: 1 addition & 1 deletion .github/workflows/close-stale-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
pull-requests: write

steps:
- uses: actions/stale@v5
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This pull request has been automatically marked as stale because it has been inactive for 90 days. Remove stale label or comment or this PR will be closed in 7 days.'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devcontainer-feature-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
pull-requests: write
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Publish Features"
uses: devcontainers/action@v1
Expand Down
Loading

0 comments on commit e5743b3

Please sign in to comment.