name: "Aries-Askar" "on": push: branches: "**" pull_request: branches: [main] release: types: [created] workflow_dispatch: inputs: publish: description: "Publish packages" required: true default: "false" jobs: # leak_test: # runs-on: macos-11 # name: Leak Test # steps: # - name: Checkout # uses: actions/checkout@v2 # - name: Install Rust toolchain # uses: actions-rs/toolchain@v1 # with: # # profile: minimal # toolchain: nightly # override: true # components: rust-src # - name: Test # uses: actions-rs/cargo@v1 # with: # command: test # args: -Zbuild-std --target x86_64-apple-darwin -- --nocapture --test-threads 1 # env: # RUST_BACKTRACE: full # RUSTFLAGS: -Zsanitizer=address # RUSTDOCFLAGS: -Zsanitizer=address # - if: ${{ failure() }} # uses: luchihoratiu/debug-via-ssh@main # with: # NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} # SSH_PASS: ${{ secrets.SSH_PASS }} check: needs: [leak_test] name: Run Build strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-11, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v2 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: 1.56 override: true components: clippy, rustfmt - name: Cache cargo resources uses: Swatinem/rust-cache@v1 with: shared-key: check cache-on-failure: true - name: Cargo fmt uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check - name: Cargo check uses: actions-rs/cargo@v1 with: command: check args: --workspace - name: Debug build uses: actions-rs/cargo@v1 with: command: build args: --all-targets - if: "runner.os == 'Linux'" name: Start postgres (Linux) run: | sudo systemctl start postgresql.service pg_isready sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres'" - if: "runner.os == 'Linux'" name: Test with postgres uses: actions-rs/cargo@v1 with: command: test args: --workspace --features pg_test -- --nocapture --test-threads 1 env: POSTGRES_URL: postgres://postgres:postgres@localhost:5432/test-db RUST_BACKTRACE: full # RUST_LOG: debug - if: "runner.os != 'Linux'" name: Test without postgres uses: actions-rs/cargo@v1 with: command: test args: --workspace -- --nocapture --test-threads 1 env: RUST_BACKTRACE: full # RUST_LOG: debug - if: ${{ failure() }} uses: luchihoratiu/debug-via-ssh@main with: NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} SSH_PASS: ${{ secrets.SSH_PASS }} - name: Test askar-crypto no_std uses: actions-rs/cargo@v1 with: command: test args: --manifest-path ./askar-crypto/Cargo.toml --no-default-features - name: Test askar-bbs no_std uses: actions-rs/cargo@v1 with: command: test args: --manifest-path ./askar-bbs/Cargo.toml --no-default-features # build-std: # name: Build (Native) # strategy: # fail-fast: false # matrix: # include: # - name: macos-aarch64 # os: macos-11 # lib: libaries_askar.dylib # toolchain: beta # target: aarch64-apple-darwin # test: false # - name: macos-x86_64 # os: macos-11 # lib: libaries_askar.dylib # toolchain: 1.56 # target: x86_64-apple-darwin # test: true # - name: windows-aarch64 # os: windows-latest # lib: aries_askar.dll # toolchain: beta # target: aarch64-pc-windows-msvc # test: false # - name: windows-x86_64 # os: windows-latest # lib: aries_askar.dll # toolchain: 1.56 # target: x86_64-pc-windows-msvc # test: true # runs-on: ${{ matrix.os }} # steps: # - name: Checkout # uses: actions/checkout@v2 # - name: Install Rust toolchain # uses: actions-rs/toolchain@v1 # with: # profile: minimal # toolchain: ${{ matrix.toolchain }} # target: ${{ matrix.target }} # override: true # components: clippy, rustfmt # - name: Cache cargo resources # uses: Swatinem/rust-cache@v1 # with: # shared_key: check # cache-on-failure: true # - name: Cargo fmt # if: ${{ matrix.test }} # uses: actions-rs/cargo@v1 # with: # command: fmt # args: --all -- --check # - name: Cargo check # if: ${{ matrix.test }} # uses: actions-rs/cargo@v1 # with: # command: check # args: --workspace # - name: Debug build # uses: actions-rs/cargo@v1 # with: # command: build # args: --all-targets # - name: Run tests # if: ${{ matrix.test }} # uses: actions-rs/cargo@v1 # with: # command: test # args: --workspace -- --nocapture --test-threads 1 # env: # RUST_BACKTRACE: full # # RUST_LOG: debug # - if: ${{ failure() }} # uses: luchihoratiu/debug-via-ssh@main # with: # NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} # SSH_PASS: ${{ secrets.SSH_PASS }} # - name: Test askar-crypto no_std # if: ${{ matrix.test }} # uses: actions-rs/cargo@v1 # with: # command: test # args: --manifest-path ./askar-crypto/Cargo.toml --no-default-features # - name: Test askar-bbs no_std # if: ${{ matrix.test }} # uses: actions-rs/cargo@v1 # with: # command: test # args: --manifest-path ./askar-bbs/Cargo.toml --no-default-features # - name: Build library # uses: actions-rs/cargo@v1 # with: # command: build # args: --release # - name: Upload library artifacts # uses: actions/upload-artifact@v2 # with: # name: library-${{ matrix.name }} # path: target/release/${{ matrix.lib }} build-manylinux: name: Build (Manylinux) strategy: fail-fast: false matrix: include: - os: ubuntu-latest lib: libaries_askar.so container: andrewwhitehead/manylinux2014-base container: ${{ matrix.container }} runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v2 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: 1.56 override: true # - name: Cache cargo resources # uses: Swatinem/rust-cache@v1 # with: # shared_key: check - name: Build library env: BUILD_TARGET: ${{ matrix.target }} # LIBSQLITE3_FLAGS: SQLITE_DEBUG SQLITE_MEMDEBUG run: sh ./build.sh - name: Upload library artifacts uses: actions/upload-artifact@v2 with: name: library-${{ runner.os }} path: target/release/${{ matrix.lib }} build-other: name: Build Library needs: [check] strategy: fail-fast: false matrix: include: - os: macos-11 lib: libaries_askar.dylib target: apple-darwin # creates a universal library toolchain: nightly-2021-10-21 # beta required for aarch64-apple-darwin target - os: windows-latest lib: aries_askar.dll toolchain: 1.56 runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v2 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: ${{ matrix.toolchain }} override: true # - name: Cache cargo resources # uses: Swatinem/rust-cache@v1 # with: # shared_key: check - name: Build library env: BUILD_TARGET: ${{ matrix.target }} BUILD_TOOLCHAIN: ${{ matrix.toolchain }} # LIBSQLITE3_FLAGS: SQLITE_DEBUG SQLITE_MEMDEBUG run: sh ./build.sh - name: Upload library artifacts uses: actions/upload-artifact@v2 with: name: library-${{ runner.os }} path: target/release/${{ matrix.lib }} build-py: name: Build Python needs: [build-manylinux, build-other] strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-11, windows-latest] python-version: [3.7] include: - os: ubuntu-latest plat-name: manylinux2014_x86_64 - os: macos-11 plat-name: macosx_10_9_universal2 # macosx_10_9_x86_64 - os: windows-latest plat-name: win_amd64 runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel twine auditwheel - name: Fetch library artifacts uses: actions/download-artifact@v2 with: name: library-${{ runner.os }} path: wrappers/python/aries_askar/ - name: Build and test python package shell: sh run: | python setup.py bdist_wheel --python-tag=py3 --plat-name=${{ matrix.plat-name }} pip install pytest pytest-asyncio dist/* echo "-- Test SQLite in-memory --" python -m pytest --log-cli-level=WARNING echo "-- Test SQLite file DB --" TEST_STORE_URI=sqlite://test.db python -m pytest --log-cli-level=WARNING working-directory: wrappers/python env: no_proxy: "*" # python issue 30385 RUST_BACKTRACE: full # RUST_LOG: debug - if: ${{ failure() }} uses: luchihoratiu/debug-via-ssh@main with: NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} SSH_PASS: ${{ secrets.SSH_PASS }} - if: "runner.os == 'Linux'" name: Test postgres run: | sudo systemctl start postgresql.service pg_isready sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres'" python -m pytest --log-cli-level=WARNING working-directory: wrappers/python env: no_proxy: "*" # python issue 30385 RUST_BACKTRACE: full # RUST_LOG: debug TEST_STORE_URI: postgres://postgres:postgres@localhost:5432/test-db - if: ${{ failure() }} uses: luchihoratiu/debug-via-ssh@main with: NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} SSH_PASS: ${{ secrets.SSH_PASS }} - if: "runner.os == 'Linux'" name: Audit wheel run: auditwheel show wrappers/python/dist/* - name: Upload python package uses: actions/upload-artifact@v2 with: name: python-${{ runner.os }} path: wrappers/python/dist/* - if: | (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')) name: Publish python package env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | twine upload --skip-existing dist/* working-directory: wrappers/python