Skip to content

Merge pull request #77 from andfoy/dependabot/cargo/windows-0.58.0 #174

Merge pull request #77 from andfoy/dependabot/cargo/windows-0.58.0

Merge pull request #77 from andfoy/dependabot/cargo/windows-0.58.0 #174

name: Library tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
windows:
name: Rust ${{ matrix.RUST_TOOLCHAIN }}
runs-on: windows-latest
env:
RUST_TOOLCHAIN: ${{ matrix.RUST_TOOLCHAIN }}
RUNNER_OS: "windows"
CI: "1"
strategy:
fail-fast: false
matrix:
RUST_TOOLCHAIN: ["stable", "nightly",]
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install latest Rust ${{ matrix.RUST_TOOLCHAIN }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.RUST_TOOLCHAIN }}
target: x86_64-pc-windows-msvc
override: true
components: rustfmt, clippy
- name: Install grcov
if: ${{ matrix.RUST_TOOLCHAIN == 'nightly' }}
shell: bash -l {0}
run: cargo install grcov
- name: Add llvm-tools-preview component
if: ${{ matrix.RUST_TOOLCHAIN == 'nightly' }}
shell: bash -l {0}
run: |
rustup component add llvm-tools-preview
echo "RUSTFLAGS=-Cinstrument-coverage" >> $GITHUB_ENV
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: test
channels: conda-forge,defaults
python-version: 3.9
- name: Conda env info
shell: bash -l {0}
run: conda env list
- name: Install winpty
shell: bash -l {0}
run: conda install -y winpty
- name: Cargo lint
if: ${{ matrix.RUST_TOOLCHAIN == 'stable' }}
shell: bash -l {0}
run: cargo clippy
- name: Cargo build
shell: bash -l {0}
run: cargo build -vv --features conpty --features winpty
- name: Set LLVM_PROFILE_FILE
if: ${{ matrix.RUST_TOOLCHAIN == 'nightly' }}
shell: bash -l {0}
run: echo "LLVM_PROFILE_FILE=winpty_rs-%p-%m.profraw" >> $GITHUB_ENV
- name: Cargo test
# shell: bash -l {0}
run: cargo test --features conpty --features winpty -- --test-threads=1
- name: Gather test coverage
if: ${{ matrix.RUST_TOOLCHAIN == 'nightly' }}
shell: bash -l {0}
run: |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
ls
- name: Upload coverage results
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./lcov.info # optional
flags: unittests # optional
verbose: true # optional (default = false)
# fail_ci_if_error: true # optional (default = false)
# name: codecov-umbrella # optional
# Enable this to get RDP access to the worker.
# - name: Download
# if: ${{ failure() }}
# run: Invoke-WebRequest https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip -OutFile ngrok.zip
# - name: Extract
# if: ${{ failure() }}
# run: Expand-Archive ngrok.zip
# - name: Auth
# if: ${{ failure() }}
# run: .\ngrok\ngrok.exe authtoken 1raaG4z7gsaCRlLw8cRkUWW6ItF_2LWTUFxXwd6UeeJNAAAci
# - name: Enable TS
# if: ${{ failure() }}
# run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
# - run: Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
# if: ${{ failure() }}
# - run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1
# if: ${{ failure() }}
# - run: Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "P@ssw0rd!" -Force)
# if: ${{ failure() }}
# - name: Create Tunnel
# if: ${{ failure() }}
# run: .\ngrok\ngrok.exe tcp 3389