Skip to content

Commit

Permalink
test(examples): add taskfile to run Linux example locally
Browse files Browse the repository at this point in the history
Signed-off-by: AtomicFS <[email protected]>
  • Loading branch information
AtomicFS committed Nov 19, 2024
1 parent 3c33923 commit 630e8aa
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.coverage
.task
.example_runs
action/coverage.html
action/coverage.out
bin/
Expand Down
5 changes: 5 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ includes:
taskfile: ./.dagger-ci/Taskfile.yml
dir: ./.dagger-ci
optional: true
examples:
taskfile: ./tests/Taskfile.yml
optional: true
vars:
SEMVER: '{{.SEMVER}}'

tasks:
build-go-binary:
Expand Down
58 changes: 58 additions & 0 deletions tests/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
version: '3'
vars:
WORKDIR: '.example_runs'

tasks:
#=======
# LINUX
#=======
linux-fetch:
desc: Fetch Linux source code
internal: true
dir: '{{.WORKDIR}}'
vars:
LINUX_MAJOR_VERSION:
sh: echo '{{.LINUX_VERSION}}' | sed -E 's/\..*//g'
cmds:
# Download source files
- wget --quiet --continue "https://cdn.kernel.org/pub/linux/kernel/v{{.LINUX_MAJOR_VERSION}}.x/linux-{{.LINUX_VERSION}}.tar.xz"
- wget --quiet --continue "https://cdn.kernel.org/pub/linux/kernel/v{{.LINUX_MAJOR_VERSION}}.x/linux-{{.LINUX_VERSION}}.tar.sign"
- unxz --keep "linux-{{.LINUX_VERSION}}.tar.xz" >/dev/null
# Verify GPG signature
- gpg2 --locate-keys [email protected] [email protected]
- gpg2 --verify "linux-{{.LINUX_VERSION}}.tar.sign"
# Extract
- tar -xvf "linux-{{.LINUX_VERSION}}.tar"
requires:
vars: [LINUX_VERSION]
status:
- test -d 'linux-{{.LINUX_VERSION}}'

linux-run:
desc: Run firmware-action
dir: '{{.WORKDIR}}'
internal: true
cmds:
- cp -f "../tests/linux_{{.LINUX_VERSION}}/linux.defconfig" "ci_defconfig"
- ../bin/firmware-action-linux-amd64-{{.SEMVER}} build --config="../tests/example_config__linux.json" --target=linux-example
env:
LINUX_VERSION: '{{.LINUX_VERSION}}'
SYSTEM_ARCH: 'amd64'
requires:
vars: [LINUX_VERSION]

linux-*:
desc: Run example
deps:
- task: :build-go-binary
vars:
VARIANT: '{{index .MATCH 0}}'
cmds:
- mkdir -p '{{.WORKDIR}}'
- task: linux-fetch
vars:
LINUX_VERSION: '{{.VARIANT}}'
- task: linux-run
vars:
LINUX_VERSION: '{{.VARIANT}}'

0 comments on commit 630e8aa

Please sign in to comment.