Skip to content

Commit 1f5b085

Browse files
committed
.github: Reusable workflows
1 parent 4a72eac commit 1f5b085

File tree

4 files changed

+104
-1
lines changed

4 files changed

+104
-1
lines changed

Diff for: .github/workflows/OnPRRecheck.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: PRReCheck
2+
run-name: "PR ${{ github.event.number }} Recheck"
3+
on:
4+
pull_request_target:
5+
types: [ labeled ]
6+
7+
concurrency:
8+
group: check-${{ github.event.number }}
9+
cancel-in-progress: true
10+
11+
env:
12+
PR_NUMBER: ${{ github.event.number }}
13+
14+
jobs:
15+
Setup:
16+
if: ${{ github.event.label.name == vars.RECHECKPR_LABEL }}
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Set Label
20+
id: setlabel
21+
env:
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
gh pr edit --repo ${{ github.repository }} \
25+
--remove-label ${{ vars.RECHECKPR_LABEL }} \
26+
--remove-label ${{ vars.PR_SUBMIT_TESTS_PASSED }} \
27+
--remove-label ${{ vars.PR_SUBMIT_TESTS_FAILED }} \
28+
--add-label ${{ vars.PR_SUBMIT_TESTING_IN_PROGRESS }} \
29+
$PR_NUMBER || :
30+
31+
Check:
32+
name: Check
33+
needs: Setup
34+
uses: asterisk/asterisk-ci-actions/.github/workflows/RunTestsuiteUnitTest.yml@main
35+
with:
36+
pr_number: ${{ github.event.number }}
37+
base_branch: ${{ github.event.pull_request.base.ref }}
38+
unittest_command: ${{ fromJSON(needs.Setup.outputs.vars).UNITTEST_COMMAND }}
39+
secrets:
40+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+

Diff for: .github/workflows/OnPRStateChanged.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Workflows, like this one, that are triggered by PRs submitted
3+
# from forked repositories are severly limited in what they can do
4+
# for security reasons. For instance, they can't add or remove
5+
# labels or comments even on the PR that triggered them. Since
6+
# we need to both of those things, GitHub recommends creating a
7+
# separate workflow that does those tasks that's triggered when
8+
# this PR workflow starts or finishes. Since that workflow isn't
9+
# being run in the context of a forked repo, it has all the
10+
# privileges needed to add and remove labels and comments. The
11+
# accompanying OnPRStateChangedPriv workflow does just that.
12+
13+
name: PRChanged
14+
run-name: "PR ${{ github.event.number }} ${{ github.event.action }} by ${{ github.actor }}"
15+
on:
16+
pull_request:
17+
types: [opened, reopened, synchronize]
18+
19+
concurrency:
20+
group: check-${{ github.event.number }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
#
25+
# Pull requests created from forked respositories don't have access
26+
# to the "Action Variables" ('vars' context) so we need to retrieve
27+
# control data from an action that's located in asterisk-ci-actions.
28+
#
29+
Setup:
30+
runs-on: ubuntu-latest
31+
outputs:
32+
vars: ${{ steps.setvars.outputs.control_data }}
33+
steps:
34+
- id: setvars
35+
uses: asterisk/asterisk-ci-actions/GetRepoControlData@main
36+
with:
37+
repo: ${{ github.event.repository.name }}
38+
39+
Check:
40+
name: Check
41+
needs: Setup
42+
uses: asterisk/asterisk-ci-actions/.github/workflows/RunTestsuiteUnitTest.yml@main
43+
with:
44+
pr_number: ${{ github.event.number }}
45+
base_branch: ${{ github.event.pull_request.base.ref }}
46+
unittest_command: ${{ fromJSON(needs.Setup.outputs.vars).UNITTEST_COMMAND }}
47+
secrets:
48+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+

Diff for: lib/python/asterisk/self_test/buildopts.h

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* buildopts.h
3+
* Automatically generated
4+
*/
5+
6+
#define AST_DEVMODE 1
7+
#define DONT_OPTIMIZE 1
8+
#define OPTIONAL_API 1
9+
#define DO_CRASH 1
10+
#define TEST_FRAMEWORK 1
11+
#define AST_BUILDOPT_SUM "c1ede5e75208a56856a96370ccdead31"
12+
#define AST_BUILDOPTS "OPTIONAL_API, DO_CRASH, TEST_FRAMEWORK"
13+
#define AST_BUILDOPTS_ALL "DONT_OPTIMIZE, OPTIONAL_API, DO_CRASH, TEST_FRAMEWORK"

Diff for: lib/python/asterisk/self_test/test_buildoptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AsteriskBuildOptionsTests(unittest.TestCase):
1818

1919
def test_1(self):
2020
"""Test the defaults paths"""
21-
build_options = AsteriskBuildOptions()
21+
build_options = AsteriskBuildOptions("./lib/python/asterisk/self_test/buildopts.h")
2222
self.assertTrue(build_options)
2323

2424

0 commit comments

Comments
 (0)