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: 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'