Skip to content

Commit

Permalink
ci: Initial workflow based on Nix Flake
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Salvador <[email protected]>
  • Loading branch information
otavio committed Jun 15, 2024
1 parent afe6427 commit 508290e
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
79 changes: 79 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: "Continuous Integration"

on:
pull_request:
merge_group:
push:
branches:
- "master"

concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: false

jobs:
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v12
- uses: DeterminateSystems/magic-nix-cache-action@v7
- id: set-matrix
name: Generate Nix Matrix
run: |
set -euo pipefail
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT"
nix-build:
needs: nix-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 10
matrix: ${{ fromJSON(needs.nix-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v12
- uses: DeterminateSystems/magic-nix-cache-action@v7
- run: nix build -L ".#${{ matrix.attr }}" --keep-going


- name: Twister Tests
uses: workflow/[email protected]
id: twister-tests
with:
flakes-from-devshell: true
script: |
west init -l .
west config --global update.narrow true
west update
./scripts/run-tests --clobber-output --inline-logs -v -N -M
- name: Merge Test Results
if: steps.twister-tests.conclusion == 'failure'
run: |
pip3 install junitparser junit2html
junitparser merge **/twister.xml junit.xml
junit2html junit.xml junit.html
- name: Upload Unit Test Results in HTML
if: steps.twister-tests.conclusion == 'failure'
uses: actions/upload-artifact@v4
with:
name: HTML Unit Test Results
if-no-files-found: ignore
path: |
junit.html
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: steps.twister-tests.conclusion == 'failure'
with:
check_name: Unit Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "**/twister.xml"

0 comments on commit 508290e

Please sign in to comment.