You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
4.4 KiB
YAML

name: Test (push)
on:
push:
branches:
- "!v*"
- "**"
env:
IS_ACTIONS_DOC: "false"
IS_MD_FILE: "false"
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux-stable, macos-stable, windows-stable]
include:
- build: linux-stable
os: ubuntu-latest
rust: stable
- build: macos-stable
os: macos-latest
rust: stable
- build: windows-stable
os: windows-latest
rust: stable
steps:
- name: Remove Hyper-V blocked ports (Windows)
run: |
rem Modify Dynamic Port Range for Development Users
dism /online /get-features | find /i "Microsoft-Hyper-V" && (
rem Modify Dynamic Port Range
start /wait "" netsh int ipv4 set dynamicport tcp start=20000 num=16384
start /wait "" netsh int ipv4 set dynamicport udp start=20000 num=16384
rem Add Registry Key
start /wait "" reg add HKLM\SYSTEM\CurrentControlSet\Services\hns\State /v EnableExcludedPortRange /d 0 /f
goto :eof
)
rem Set range to default
start /wait "" netsh int ipv4 set dynamicport tcp start=49152 num=16384
start /wait "" netsh int ipv4 set dynamicport udp start=49152 num=16384
rem Remove Registry Key
start /wait "" reg delete HKLM\SYSTEM\CurrentControlSet\Services\hns\State /v EnableExcludedPortRange /f
shell: cmd
if: runner.os == 'Windows'
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Install GNU tar
run: |
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
if: runner.os == 'macOS'
- name: "Prepare build environment"
run: |
chmod +x ci/setvars.sh
ci/setvars.sh
- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.build }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-cargo-registry-
if: env.IS_MD_FILE == 'false'
- name: Cache Cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ matrix.build }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-cargo-index-
if: env.IS_MD_FILE == 'false'
- name: Cache Cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ matrix.build }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.build }}-target-
if: env.IS_MD_FILE == 'false'
- name: Install Rust
run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
if: env.IS_MD_FILE == 'false'
- name: Publish docs
env:
BOT_USER: ${{ secrets.BOT_INIT_USER }}
BOT_MAIL: ${{ secrets.BOT_INIT_MAIL }}
BOT_API: ${{ secrets.BOT_API_CALL }}
GIT_SHA: ${{ env.GITHUB_SHA }}
run: |
chmod +x ci/doc.sh
ci/doc.sh
if: runner.os == 'Linux' && env.IS_ACTIONS_DOC == 'true'
- name: Run Tests
run: cargo test --verbose
env:
RUST_BACKTRACE: 1
if: env.IS_MD_FILE == 'false' && runner.os != 'Windows'
- name: Run Tests (Windows)
run: cargo test --verbose
env:
RUST_BACKTRACE: 1
shell: cmd
if: env.IS_MD_FILE == 'false' && runner.os == 'Windows'
- name: Archive artifacts
run: |
mkdir dist
cargo build
mv target/debug/skyd target/debug/skysh target/debug/sky-bench dist
if: env.IS_MD_FILE == 'false' && runner.os != 'Windows'
- name: Archive artifacts
shell: cmd
run: |
cargo build
rm -rf dist
mkdir dist
move target\debug\*.exe dist
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
if: env.IS_MD_FILE == 'false' && runner.os == 'Windows'
- name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ github.sha }}-${{ matrix.build }}-builds.zip
path: dist
if: env.IS_MD_FILE == 'false'