name: Rust Tests

on:
  push:
  pull_request:
  schedule:
    - cron: '0 0 * * *'  # Run daily at midnight UTC
  workflow_dispatch:  # Allow manual triggering

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

permissions: 
  actions: read
  packages: read
  contents: read

jobs:
  rust-tests:
    name: Cargo Tests
    runs-on: ubuntu-latest
    container:
      image: quay.io/389ds/ci-images:fedora
    
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        
      - name: Add GITHUB_WORKSPACE as a safe directory
        run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
      
      - name: Setup and build
        run: |
          autoreconf -fvi
          ./configure --enable-debug
          make V=0
        
      - name: Run Rust tests
        run: make check-local
