Skip to content

Commit

Permalink
Use workflow_dispatch to avoid custom token
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelroquetto committed Feb 12, 2025
1 parent fd2b06e commit 1915d14
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 80 deletions.
111 changes: 31 additions & 80 deletions .github/workflows/beyla_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@ name: Beyla Build

on:
push:
branches: [ 'main' ]
branches: [ 'main', 'release-*' ]
pull_request:
branches: [ 'main' ]
branches: [ 'main', 'release-*' ]

jobs:
build-ebpf:
name: Build eBPF objects and run tests
runs-on: ubuntu-latest
outputs:
should_test: ${{ steps.commit.outputs.should_test }}
permissions:
contents: write # Allow commits back to the repo
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.BEYLA_WORKFLOW_TOKEN }}

- name: commit-check
id: commit-check
Expand All @@ -33,84 +30,38 @@ jobs:
echo "should_build=true" >> $GITHUB_OUTPUT
fi
- name: Compile eBPF Programs
if: ${{ steps.commit-check.outputs.should_build == 'true' }}
run: |
make docker-generate
#- name: Compile eBPF Programs
# if: ${{ steps.commit-check.outputs.should_build == 'true' }}
# run: |
# make docker-generate

# NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com.
# See users API: https://api.github.com/users/github-actions%5Bbot%5D
- name: Commit Compiled eBPF Programs
id: commit
if: ${{ steps.commit-check.outputs.should_build == 'true' }}
#- name: Commit Compiled eBPF Programs
# id: commit
# if: ${{ steps.commit-check.outputs.should_build == 'true' }}
# run: |
# git config user.name "github-actions[bot]"
# git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# git add -u
# git commit -m "CI: Auto-build eBPF binaries[do-not-rebuild]" || exit 0
# git push

- name: Trigger Tests
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.BEYLA_WORKFLOW_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -u
git commit -m "CI: Auto-build eBPF binaries[do-not-rebuild]" || exit 0
git push
echo "should_test=false" >> $GITHUB_OUTPUT
run-integration-tests:
name: Pull request integration tests
uses: ./.github/workflows/pull_request_integration_tests.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

run-integration-tests-arm:
name: Pull request integration tests ARM
uses: ./.github/workflows/pull_request_integration_tests_arm.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

run-integration-tests-vm-5-15-x86-64:
name: Pull request integration tests on VM 5.15 x86_64
uses: ./.github/workflows/pull_request_integration_tests_vm_5.15_x86_64.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

run-integration-tests-vm-6-10-x86-64:
name: Pull request integration tests on VM 6.10 x86_64
uses: ./.github/workflows/pull_request_integration_tests_vm_6.10_x86_64.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

run-integration-tests-k8s:
name: Pull request K8s integration tests
uses: ./.github/workflows/pull_request_k8s_integration_tests.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

run-oats-tests:
name: PR OATS test
uses: ./.github/workflows/pull_request_oats_test.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

run-pr-checks:
name: Pull request checks
uses: ./.github/workflows/pull_request.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

clang-format-check:
name: Clang Format Check
uses: ./.github/workflows/clang-format-check.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

clang-tidy-check:
name: Clang Tidy Check
uses: ./.github/workflows/clang-tidy-check.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

git-lfs-check:
name: Check git-lfs files
uses: ./.github/workflows/git-lfs-check.yml
needs: build-ebpf
if: needs.build-ebpf.outputs.should_test != 'false'

with:
script: |
try {
const result = await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'tests.yml',
ref: '${{ github.head_ref }}',
})
console.log(result)
} catch(error) {
console.log(error)
}
48 changes: 48 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Trigger tests

on:
workflow_dispatch:
pull_request:
branches: [ 'main', 'release-*' ]

jobs:
run-integration-tests:
name: Pull request integration tests
uses: ./.github/workflows/pull_request_integration_tests.yml

run-integration-tests-arm:
name: Pull request integration tests ARM
uses: ./.github/workflows/pull_request_integration_tests_arm.yml

run-integration-tests-vm-5-15-x86-64:
name: Pull request integration tests on VM 5.15 x86_64
uses: ./.github/workflows/pull_request_integration_tests_vm_5.15_x86_64.yml

run-integration-tests-vm-6-10-x86-64:
name: Pull request integration tests on VM 6.10 x86_64
uses: ./.github/workflows/pull_request_integration_tests_vm_6.10_x86_64.yml

run-integration-tests-k8s:
name: Pull request K8s integration tests
uses: ./.github/workflows/pull_request_k8s_integration_tests.yml

run-oats-tests:
name: PR OATS test
uses: ./.github/workflows/pull_request_oats_test.yml

run-pr-checks:
name: Pull request checks
uses: ./.github/workflows/pull_request.yml

clang-format-check:
name: Clang Format Check
uses: ./.github/workflows/clang-format-check.yml

clang-tidy-check:
name: Clang Tidy Check
uses: ./.github/workflows/clang-tidy-check.yml

git-lfs-check:
name: Check git-lfs files
uses: ./.github/workflows/git-lfs-check.yml

0 comments on commit 1915d14

Please sign in to comment.