tracexec 1.0.0

Tracer for execve{,at} and pre-exec behavior, launcher for debuggers.
name: UKCI

permissions:
  contents: read

on:
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
  schedule:
    - cron: '0 3 * * 0'
  push:
    branches:
      - main
      - ci
    paths: &trigger_paths
      - '.cargo/**'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - 'deny.toml'
      - 'rustfmt.toml'
      - 'fixtures/**'
      - 'crates/**'
      - 'src/**'
      - '.github/workflows/nix.yml'
      - 'nix/**'
      - 'flake.nix'
      - 'flake.lock'
  pull_request:
    types: [opened, synchronize, reopened, labeled, unlabeled]
    paths: *trigger_paths
  merge_group:

# ensure that the workflow is only triggered once per PR,  subsequent pushes to the PR will cancel
# and restart the workflow. See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  nix:
    strategy:
      matrix:
        os: [ubuntu-latest, ubuntu-24.04-arm]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6

      - &install-nix
        uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31
        with:
          extra_nix_config: |
            keep-env-derivations = true
            keep-outputs = true
            http2 = false

      - &attic-writable
        name: Setup Attic cache (Writable)
        uses: ryanccn/attic-action@5635a15ef0c5462194ffbd05d1daeddc74625c3a # v0.5.0
        if: github.event.pull_request.head.repo.fork != true
        with:
          endpoint: https://nix.kxxt.dev
          cache: tracexec
          token: ${{ secrets.NIX_CACHE_JWT }}

      - &attic-rdonly
        name: Setup Attic cache (ReadOnly)
        uses: ryanccn/attic-action@5635a15ef0c5462194ffbd05d1daeddc74625c3a # v0.5.0
        if: github.event.pull_request.head.repo.fork == true
        with:
          endpoint: https://nix.kxxt.dev
          cache: tracexec
          skip-push: true

      - name: Select UKCI package
        env:
          FULL_UKCI: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-ci')) }}
        run: |
          if [ "$FULL_UKCI" = "true" ]; then
            echo "UKCI_PACKAGE=ukci" >> "$GITHUB_ENV"
          else
            echo "UKCI_PACKAGE=ukci-latest-llvm" >> "$GITHUB_ENV"
          fi

      # Run Userspace<->Kernel CI
      - name: Run UKCI
        env:
          UKCI_SUMMARY_TITLE: UKCI (${{ matrix.os }})
        run: nix run ".#$UKCI_PACKAGE"
      - name: Add gc root for UKCI
        run: sudo ln -s "$(nix eval --raw ".#$UKCI_PACKAGE")" /nix/var/nix/gcroots/ukci

  nix-cross:
    strategy:
      matrix:
        arch: [riscv64]
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v6

      - *install-nix

      - *attic-writable

      - *attic-rdonly

      - name: Select UKCI package
        env:
          FULL_UKCI: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-ci')) }}
        run: |
          if [ "$FULL_UKCI" = "true" ]; then
            echo "UKCI_PACKAGE=ukci-${{ matrix.arch }}" >> "$GITHUB_ENV"
          else
            echo "UKCI_PACKAGE=ukci-${{ matrix.arch }}-latest-llvm" >> "$GITHUB_ENV"
          fi

      # Run Userspace<->Kernel CI
      - name: Run UKCI
        env:
          UKCI_SUMMARY_TITLE: UKCI (cross ${{ matrix.arch }})
        run: nix run ".#$UKCI_PACKAGE"
      - name: Add gc root for UKCI
        run: sudo ln -s "$(nix eval --raw ".#$UKCI_PACKAGE")" /nix/var/nix/gcroots/ukci