Skip to content

Commit

Permalink
Introduce repository variables to control ODT execution.
Browse files Browse the repository at this point in the history
  • Loading branch information
isarkis committed Apr 21, 2023
1 parent 861344d commit 3a5b942
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/config/android-arm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"docker_service": "build-android",
"on_device_test": {
"enabled": true,
"enabled": false,
"tests": [
"0",
"1",
Expand Down
2 changes: 1 addition & 1 deletion .github/config/android-arm64.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"docker_service": "build-android",
"on_device_test": {
"enabled": true,
"enabled": false,
"tests": [
"0",
"1",
Expand Down
2 changes: 1 addition & 1 deletion .github/config/android-x86.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"docker_service": "build-android",
"on_device_test": {
"enabled": true,
"enabled": false,
"tests": [
"0",
"1",
Expand Down
7 changes: 1 addition & 6 deletions .github/config/raspi-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
"on_device_test": {
"enabled": true,
"tests": [
"0",
"1",
"2",
"3",
"4",
"5"
"0"
]
},
"platforms": [
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,14 @@ jobs:
# Runs on-host integration and unit tests.
on-device-test:
needs: [initialize, build]
if: | # Always run if not a PR or if the PR has on_device label
fromJSON(needs.initialize.outputs.on_device_test).enabled == true && (
github.event_name != 'pull_request' ||
contains(github.event.pull_request.labels.*.name, 'on_device')
)
# Run if PR has on_device label, and on postsubmit and nightlies if
# repositories variables permit.
if: |
fromJSON(needs.initialize.outputs.on_device_test).enabled == true && ((
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'on_device') )
|| ${{ inputs.nightly == 'true' && vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False' }} ||
${{ github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False' }} )
runs-on: [self-hosted, linux, X64]
name: ${{ matrix.name }}_on_device_${{ matrix.shard }}
container: ${{ needs.docker-unittest-image.outputs.docker_unittest_tag }}
Expand All @@ -249,6 +252,13 @@ jobs:
env:
COBALT_BOOTLOADER: ${{needs.initialize.outputs.bootloader}}
steps:
- name: Print vars
run: |
echo "${{ vars.RUN_ODT_TESTS_ON_NIGHTLY }}"
echo "${{ vars.RUN_ODT_TESTS_ON_POSTSUBMIT }}"
echo 'NEXT'
echo "${{ env.RUN_ODT_TESTS_ON_NIGHTLY }}"
echo "${{ env.RUN_ODT_TESTS_ON_POSTSUBMIT }}"
- name: Checkout
uses: actions/checkout@v3
- name: Run Tests (${{ matrix.shard }})
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/stub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,22 @@ on:
required: true
type: boolean
default: false
env:
RUN_ODT_TESTS_ON_NIGHTLY: ${{ vars.RUN_ODT_TESTS_ON_NIGHTLY }}
RUN_ODT_TESTS_ON_POSTSUBMIT: ${{ vars.RUN_ODT_TESTS_ON_POSTSUBMIT }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
echo "${{ vars.RUN_ODT_TESTS_ON_NIGHTLY }}"
echo "${{ vars.RUN_ODT_TESTS_ON_POSTSUBMIT }}"
echo "${{ env.RUN_ODT_TESTS_ON_NIGHTLY }}"
echo "${{ env.RUN_ODT_TESTS_ON_POSTSUBMIT }}"
stub:
uses: ./.github/workflows/main.yaml
permissions:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: repo_vars

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
RUN_ODT_TESTS_ON_NIGHTLY: ${{ vars.RUN_ODT_TESTS_ON_NIGHTLY }}
RUN_ODT_TESTS_ON_POSTSUBMIT: ${{ vars.RUN_ODT_TESTS_ON_POSTSUBMIT }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
echo "${{ vars.RUN_ODT_TESTS_ON_NIGHTLY }}"
echo "${{ vars.RUN_ODT_TESTS_ON_POSTSUBMIT }}"
echo "${{ env.RUN_ODT_TESTS_ON_NIGHTLY }}"
echo "${{ env.RUN_ODT_TESTS_ON_POSTSUBMIT }}"

0 comments on commit 3a5b942

Please sign in to comment.