Skip to content

Commit

Permalink
Refactor our CI yamls (#319)
Browse files Browse the repository at this point in the history
### Issue
No current issue, related to already closed #45 

### Description
As we're using CI for some time, I found that it actually brings
unnecessary complications to have a layer of yamls just designating what
is done on pr, optionally on pr, and on push. This can be directly added
to each of the jobs.

Another effect is that in the "Actions" tab, we won't have On PR,
Optional On PR, and On Push where each includes several different jobs.
We will now have Build device, build and run tests, and pre-commit ,
which will run both on PR branches and main.

### List of the changes
- Created a build-and-run-all-tests.yml which wraps build-tests and
run-tests for all archs. This just nicely corresponds exactly to
previous on-pr-opt.
- Deleted on-pr, on-pr-opt and on-push ymls
- Added to all referenced .ymls the config to run on pr and/or on push,
so that same jobs are called on same triggers.
- Added timeout parameter to a couple of jobs.
- I will change in settings which jobs are mandatory, if they are now
named slightly different.

### Testing
CI passes on this PR

### API Changes
There are no API changes in this PR.
  • Loading branch information
broskoTT authored Nov 21, 2024
1 parent 6cf3bb0 commit 5e4f52a
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Optional PR checks
name: On PR - Optional
# Build and then run all tests, on all supported archs.
name: Build and run all tests

on:
workflow_dispatch:
pull_request:
branches: ["main"]
push:
branches: ["main"]

jobs:
build-tests:
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/build-device.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Builds device.
# Build is performed on all supported OS versions.
name: Build Target
name: Build Device

on:
workflow_call:
inputs:
timeout:
required: true
type: number
workflow_dispatch:
inputs:
timeout:
required: true
description: 'The timeout for the build job in minutes'
description: 'The timeout for the job in minutes'
type: number
default: 15
pull_request:
branches: ["main"]
push:
branches: ["main"]

env:
BUILD_TARGET: device
Expand All @@ -25,7 +25,9 @@ env:

jobs:
build:
timeout-minutes: ${{ inputs.timeout }}
# Due to parsing bug, fromJSON is used to convert string to number.
# In pull_request or push events, the input context is not available, stating the default again here.
timeout-minutes: ${{ fromJSON(inputs.timeout || '15') }}
strategy:
fail-fast: false
matrix:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ name: Build and Publish Docker Image

on:
workflow_dispatch:
workflow_call:
inputs:
timeout:
required: true
description: 'The timeout for the job in minutes'
type: number
default: 15

jobs:
build:
timeout-minutes: 15
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ env:

jobs:
build:
timeout-minutes: ${{ inputs.timeout }}
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/on-pr.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/on-push.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
name: Run Pre-commit Hooks

on:
workflow_call:
workflow_dispatch:
pull_request:
branches: ["main"]
push:
branches: ["main"]

jobs:
pre-commit:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ env:

jobs:
test:
timeout-minutes: ${{ inputs.timeout }}
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ name: Check runner

on:
workflow_dispatch:
inputs:
timeout:
required: true
description: 'The timeout for the job in minutes'
type: number
default: 10

jobs:
check-runners-host:
timeout-minutes: 10
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -52,7 +59,8 @@ jobs:
du -h --max-depth=1 | sort -rh
check-runners-docker:
timeout-minutes: 10
# Due to parsing bug, fromJSON is used to convert string to number
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
strategy:
fail-fast: false
matrix:
Expand Down

0 comments on commit 5e4f52a

Please sign in to comment.