name: Rust CI # Cancel previously started workflow runs # when the branch is updated. concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: pull_request: push: branches: - master env: RUSTFLAGS: -Dwarnings jobs: lint: name: Rustfmt and Clippy runs-on: ubuntu-latest env: RUSTUP_TOOLCHAIN: 1.68.0 steps: - uses: actions/checkout@v3 - name: Install rustfmt and clippy run: rustup toolchain install $RUSTUP_TOOLCHAIN --profile minimal --component rustfmt --component clippy - name: Cache rust cargo artifacts uses: swatinem/rust-cache@v2 - name: Run rustfmt run: cargo fmt --all -- --check - name: Run clippy run: scripts/clippy.sh cargo_deny: name: cargo deny runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: EmbarkStudios/cargo-deny-action@v1 with: arguments: --all-features --workspace command: check command-arguments: "-Dwarnings" provider_database: name: Check provider database runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Check provider database run: scripts/update-provider-database.sh docs: name: Rust doc comments runs-on: ubuntu-latest env: RUSTDOCFLAGS: -Dwarnings steps: - name: Checkout sources uses: actions/checkout@v3 - name: Cache rust cargo artifacts uses: swatinem/rust-cache@v2 - name: Rustdoc run: cargo doc --document-private-items --no-deps build_and_test: name: Build and test strategy: fail-fast: false matrix: include: # Currently used Rust version. - os: ubuntu-latest rust: 1.68.0 python: 3.9 - os: windows-latest rust: 1.68.0 python: false # Python bindings compilation on Windows is not supported. # Minimum Supported Rust Version = 1.63.0 # # Minimum Supported Python Version = 3.7 # This is the minimum version for which manylinux Python wheels are # built. - os: ubuntu-latest rust: 1.63.0 python: 3.7 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@master - name: Install Rust ${{ matrix.rust }} run: rustup toolchain install --profile minimal ${{ matrix.rust }} - run: rustup override set ${{ matrix.rust }} - name: Cache rust cargo artifacts uses: swatinem/rust-cache@v2 - name: Check run: cargo check --workspace --bins --examples --tests --benches - name: Tests run: cargo test --workspace - name: Test cargo vendor run: cargo vendor - name: Install python if: ${{ matrix.python }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - name: Install tox if: ${{ matrix.python }} run: pip install tox - name: Build C library if: ${{ matrix.python }} run: cargo build -p deltachat_ffi --features jsonrpc - name: Run python tests if: ${{ matrix.python }} env: DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }} DCC_RS_TARGET: debug DCC_RS_DEV: ${{ github.workspace }} working-directory: python run: tox -e lint,mypy,doc,py3 - name: Build deltachat-rpc-server if: ${{ matrix.python }} run: cargo build -p deltachat-rpc-server - name: Add deltachat-rpc-server to path if: ${{ matrix.python }} run: echo ${{ github.workspace }}/target/debug >> $GITHUB_PATH - name: Run deltachat-rpc-client tests if: ${{ matrix.python }} env: DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }} working-directory: deltachat-rpc-client run: tox -e py3,lint - name: Install pypy if: ${{ matrix.python }} uses: actions/setup-python@v4 with: python-version: "pypy${{ matrix.python }}" - name: Run pypy tests if: ${{ matrix.python }} env: DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }} DCC_RS_TARGET: debug DCC_RS_DEV: ${{ github.workspace }} working-directory: python run: tox -e pypy3