From 3153c6ef69317e1fb958ee3e6f277f71e6e260c9 Mon Sep 17 00:00:00 2001 From: Flori <39242991+bitfl0wer@users.noreply.github.com> Date: Tue, 29 Aug 2023 19:43:37 +0200 Subject: [PATCH] Update rust.yml --- .github/workflows/rust.yml | 39 ++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4f1b6f7..398c52f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,15 +10,38 @@ env: CARGO_TERM_COLOR: always jobs: - build: + rust: runs-on: ubuntu-latest - + steps: - uses: actions/checkout@v3 - - name: Build - run: | - cd src/ - cargo build --verbose - - name: Run tests - run: cargo test --verbose + - name: Clone spacebar server + run: | + git clone https://github.com/bitfl0wer/server.git + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'npm' + cache-dependency-path: server/package-lock.json + - name: Prepare and start Spacebar server + run: | + npm install + npm run setup + npm run start & + working-directory: ./server + - uses: Swatinem/rust-cache@v2 + with: + cache-all-crates: "true" + - name: Build, Test and Publish Coverage + run: | + if [ -n "${{ secrets.COVERALLS_REPO_TOKEN }}" ]; then + curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash + cargo binstall --no-confirm cargo-tarpaulin --force + cargo tarpaulin --all-features --avoid-cfg-tarpaulin --tests --verbose --skip-clean --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} --timeout 120 + else + echo "Code Coverage step is skipped on forks!" + cargo build --verbose --all-features + cargo test --verbose --all-features + fi +