celery-rs 0.6.2

Community-maintained Rust implementation of Celery (fork of rusty-celery)
Documentation
name: CI

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  # cancel-in-progress: true

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  # schedule:
  #   - cron: '0 10 * * *' # run at 10 AM UTC

jobs:
  changelog:
    name: CHANGELOG
    runs-on: ubuntu-latest
    # Only run this on pull requests.
    if: github.event_name == 'pull_request'

    steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0

    - name: Check if source files have changed
      run: |
        git diff --name-only $(git merge-base origin/main HEAD) | grep 'src/' && echo "source_files_changed=true" >> $GITHUB_ENV || echo "source_files_changed=false" >> $GITHUB_ENV

    - name: Check that CHANGELOG has been updated
      if: env.source_files_changed == 'true'
      run: |
        # If this step fails, this means you haven't updated the CHANGELOG.md
        # file with notes on your contribution.
        git diff --name-only $(git merge-base origin/main HEAD) | grep '^CHANGELOG.md$' && echo "Thanks for helping keep our CHANGELOG up-to-date!"

  build_checks:
    name: ${{ matrix.task.name }} (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    env:
      RUST_BACKTRACE: full
      RUSTV: ${{ matrix.rust }}
      AMQP_ADDR: amqp://127.0.0.1:5672//
      REDIS_ADDR: redis://127.0.0.1:6379/
    services: ${{ matrix.services }}
    strategy:
      fail-fast: false
      matrix:
        include:
          # Lint tasks (ubuntu + macos)
          - os: ubuntu-latest
            rust: stable
            services: {}
            task:
              name: Lint
              run: make check-clippy
              components: clippy

          - os: macos-latest
            rust: stable
            services: {}
            task:
              name: Lint
              run: make check-clippy
              components: clippy

          # Format task
          - os: ubuntu-latest
            rust: stable
            services: {}
            task:
              name: Format
              run: make check-fmt
              components: rustfmt

          - os: ubuntu-latest
            rust: nightly
            services: {}
            task:
              name: Build docs
              run: make build-docs
              components: ''

          - os: ubuntu-latest
            rust: stable
            services:
              rabbitmq:
                image: rabbitmq
                ports:
                  - 5672:5672
              redis:
                image: redis
                ports:
                  - 6379:6379
            task:
              name: Run tests
              run: make run-all-tests
              components: ''

          # Temporarily disabled due to regex-syntax 0.6.24 compatibility issue
          # See: https://github.com/rust-lang/regex/issues/878
          # - os: ubuntu-latest
          #   rust: nightly
          #   services: {}
          #   task:
          #     name: Check minimal versions
          #     run: make check-minimal-versions   

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust ${{ matrix.rust }}
        uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          components: ${{ matrix.task.components || '' }}

      - name: Install Musl Tools
        if: ${{ matrix.os == 'ubuntu-latest' }}
        run: |
          sudo apt install -y musl-tools
          sudo ln -s /usr/bin/musl-gcc /usr/local/bin/x86_64-linux-musl-gcc
          echo "TARGET_CC=musl-gcc" | tee -a $GITHUB_ENV
          rustup target add x86_64-unknown-linux-musl

      # Caching is now handled automatically by actions-rust-lang/setup-rust-toolchain

      - name: ${{ matrix.task.name }}
        run: ${{ matrix.task.run }}

  test_python_example:
    name: Check python example
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Setup Python
      uses: actions/setup-python@v5
      with:
        python-version: 3.9

    - name: Cache pip
      uses: actions/cache@v4
      with:
        path: ~/.cache/pip # This path is specific to Ubuntu
        key: pip ${{ runner.os }} ${{ env.pythonLocation }} ${{ hashFiles('requirements.txt') }} ${{ hashFiles('dev-requirements.txt') }}

    - name: Install requirements
      run: |
        pip install -r requirements.txt -r dev-requirements.txt

    - name: Check formatting
      if: always()
      run: |
        black --check examples/

    - name: Lint
      if: always()
      run: |
        flake8 examples/

    - name: Typecheck
      if: always()
      run: |
        mypy --ignore-missing-imports examples/