-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Manan Gupta <[email protected]>
- Loading branch information
1 parent
0cc5acd
commit 8692bdc
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: vtop_example | ||
on: [push, pull_request] | ||
concurrency: | ||
group: format('{0}-{1}', ${{ github.ref }}, 'vtop_example') | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: VTop Example | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Skip CI | ||
run: | | ||
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then | ||
echo "skipping CI due to the 'Skip CI' label" | ||
exit 1 | ||
fi | ||
- name: Check if workflow needs to be skipped | ||
id: skip-workflow | ||
run: | | ||
skip='false' | ||
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then | ||
skip='true' | ||
fi | ||
echo Skip ${skip} | ||
echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT | ||
PR_DATA=$(curl -s\ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}") | ||
draft=$(echo "$PR_DATA" | jq .draft -r) | ||
echo "is_draft=${draft}" >> $GITHUB_OUTPUT | ||
- name: Check out code | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check for changes in relevant files | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' | ||
uses: dorny/[email protected] | ||
id: changes | ||
with: | ||
token: '' | ||
filters: | | ||
examples: | ||
- 'go/**/*.go' | ||
- 'test.go' | ||
- 'Makefile' | ||
- 'build.env' | ||
- 'go.[sumod]' | ||
- 'proto/*.proto' | ||
- 'tools/**' | ||
- 'config/**' | ||
- 'bootstrap.sh' | ||
- 'examples/**' | ||
- name: Set up Go | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.3 | ||
|
||
- name: Tune the OS | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
run: | | ||
echo '1024 65535' | sudo tee -a /proc/sys/net/ipv4/ip_local_port_range | ||
- name: Get dependencies | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
run: | | ||
# Install everything we need, and configure | ||
sudo apt-get install -y make unzip g++ etcd curl git wget eatmydata | ||
go mod download | ||
- name: Run make minimaltools | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
run: | | ||
make minimaltools | ||
- name: Build | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
run: | | ||
make build | ||
- name: Install kubectl & kind | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
run: | | ||
make install_kubectl_kind | ||
- name: vtop_example | ||
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
timeout-minutes: 60 | ||
run: | | ||
source build.env | ||
eatmydata -- go run test.go -docker=false -skip-build -print-log -follow -retry=1 -timeout=60m vtop_example |
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