name: rust regress tests

on:
  schedule:
  - cron: "0 0 * * *"

jobs:
  rust-openssl:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@main
    - name: Install apt dependencies
      run: |
        sudo apt-get update
        sudo apt-get install -y cargo
    - name: Build LibreSSL
      run: |
        ./autogen.sh
        ./configure
        make dist
        tar zxvf libressl-*.tar.gz
        rm libressl-*.tar.gz
        cd libressl-*
        ./configure --prefix="${HOME}/opt"
        make all install
    - name: run rust-openssl tests
      run: |
        git clone https://github.com/sfackler/rust-openssl.git
        cd rust-openssl
        export OPENSSL_DIR=${HOME}/opt
        export LD_LIBRARY_PATH=${HOME}/opt/lib
        patch -p1 < ../.github/rust-openssl.patch
        cargo test
