tests on github actions its easier cache platforms

This commit is contained in:
gluaxspeed 2021-07-14 13:59:51 -07:00
parent 315dcebb34
commit b8dcad44cc
2 changed files with 123 additions and 114 deletions

View File

@ -5,7 +5,7 @@ commands:
parameters: parameters:
cache_key: cache_key:
type: string type: string
default: leo-stable-cache default: leo-stable-linux-cache
steps: steps:
- run: set -e - run: set -e
- setup_remote_docker - setup_remote_docker
@ -31,7 +31,7 @@ commands:
parameters: parameters:
cache_key: cache_key:
type: string type: string
default: leo-stable-cache default: leo-stable-linux-cache
steps: steps:
- run: (sccache -s||true) - run: (sccache -s||true)
- run: set +e - run: set +e
@ -40,11 +40,44 @@ commands:
paths: paths:
- .cache/sccache - .cache/sccache
- .cargo - .cargo
orbs:
win: circleci/windows@2.4.0
jobs: jobs:
fmt:
docker:
- image: cimg/rust:1.53.0
resource_class: xlarge
steps:
- checkout
- setup_environment:
cache_key: leo-fmt-cache
- run:
name: Check style
no_output_timeout: 35m
command: cargo fmt --all -- --check
- clear_environment:
cache_key: leo-fmt-cache
clippy:
docker:
- image: cimg/rust:1.53.0
resource_class: xlarge
steps:
- checkout
- setup_environment:
cache_key: leo-clippy-cache
- run:
name: Clippy
no_output_timeout: 35m
command: cargo clippy --all-features --examples --all --benches
- clear_environment:
cache_key: leo-clippy-cache
rust-stable: rust-stable:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- checkout - checkout
@ -62,7 +95,7 @@ jobs:
leo-executable: leo-executable:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- checkout - checkout
@ -80,7 +113,7 @@ jobs:
leo-new: leo-new:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- attach_workspace: - attach_workspace:
@ -93,7 +126,7 @@ jobs:
leo-init: leo-init:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- attach_workspace: - attach_workspace:
@ -106,7 +139,7 @@ jobs:
leo-clean: leo-clean:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- attach_workspace: - attach_workspace:
@ -119,7 +152,7 @@ jobs:
leo-setup: leo-setup:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- attach_workspace: - attach_workspace:
@ -132,7 +165,7 @@ jobs:
leo-add-remove: leo-add-remove:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- attach_workspace: - attach_workspace:
@ -158,7 +191,7 @@ jobs:
leo-login-logout: leo-login-logout:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- attach_workspace: - attach_workspace:
@ -171,7 +204,7 @@ jobs:
leo-clone: leo-clone:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- attach_workspace: - attach_workspace:
@ -184,7 +217,7 @@ jobs:
leo-publish: leo-publish:
docker: docker:
- image: cimg/rust:1.52.1 - image: cimg/rust:1.53.0
resource_class: xlarge resource_class: xlarge
steps: steps:
- attach_workspace: - attach_workspace:
@ -199,6 +232,8 @@ workflows:
version: 2 version: 2
main-workflow: main-workflow:
jobs: jobs:
- fmt
- clippy
- rust-stable - rust-stable
- leo-executable - leo-executable
- leo-new: - leo-new:

View File

@ -13,68 +13,51 @@ env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
jobs: jobs:
style: test-package:
name: Check Style name: Test Package ${{ matrix.os }}
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
steps: strategy:
- name: Checkout os: [macOS-latest, windows-latest, ubuntu-latest]
uses: actions/checkout@v1 include:
- os: ubuntu-latest
- name: Install Rust sccache-path: /home/runner/.cache/sccache
uses: actions-rs/toolchain@v1 - os: macos-latest
with: sccache-path: /Users/runner/Library/Caches/Mozilla.sccache
profile: minimal - os: windows-latest
toolchain: nightly sccache-path: "C:\\Users\\runneradmin\\AppData\\Local\\Mozilla\\sccache"
override: true
components: rustfmt
- name: cargo fmt --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
env: env:
RUSTFLAGS: -Dwarnings RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: ${{ matrix.sccache-path }}
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Rust - name: Install sccache Ubuntu
uses: actions-rs/toolchain@v1 if: matrix.os == 'ubuntu-latest'
with: env:
profile: minimal LINK: https://github.com/mozilla/sccache/releases/download
toolchain: stable SCCACHE_VERSION: 0.2.15
override: true run: |
components: clippy SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Check examples - name: Install sccache Macos
uses: actions-rs/cargo@v1 if: matrix.os == 'macos-latest'
with: run: |
command: clippy brew update
args: --examples --all brew install sccache
- name: Check examples with all features on stable - name: Install sccache Windows
uses: actions-rs/cargo@v1 if: matrix.os == 'windows-latest'
with: run: |
command: clippy iwr -useb get.scoop.sh | iex
args: --examples --all-features --all Set-ExecutionPolicy RemoteSigned -scope CurrentUser
scoop install sccache
- name: Check benchmarks on nightly
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --examples --all --benches
test-package-linux:
name: Test Package Linux
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust Stable - name: Install Rust Stable
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@ -83,6 +66,29 @@ jobs:
toolchain: stable toolchain: stable
override: true override: true
- name: Cache cargo registry
uses: actions/cache@v2
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Save sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ${{ matrix.sccache-path }}
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-sccache-
- name: Start sccache server
run: sccache --start-server
- name: Install cargo-all-features - name: Install cargo-all-features
run: | run: |
cargo install cargo-all-features cargo install cargo-all-features
@ -92,51 +98,11 @@ jobs:
cd package cd package
cargo test-all-features cargo test-all-features
test-package-windows: - name: Print sccache stats
name: Test Package Windows run: sccache --show-stats
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust Stable - name: Stop sccache server
uses: actions-rs/toolchain@v1 run: sccache --stop-server || true
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-all-features
run: |
cargo install cargo-all-features
- name: Test
run: |
cd package
cargo test-all-features
test-package-macos:
name: Test Package macOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-all-features
run: |
cargo install cargo-all-features
- name: Test
run: |
cd package
cargo test-all-features
test-package-macos_m1: test-package-macos_m1:
name: Test Package macOS M1 name: Test Package macOS M1
@ -173,7 +139,7 @@ jobs:
name: Code Coverage name: Code Coverage
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
RUSTC_BOOTSTRAP=1 RUSTC_BOOTSTRAP: 1
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
@ -186,6 +152,14 @@ jobs:
override: true override: true
components: rustfmt components: rustfmt
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all --features ci_skip
env:
CARGO_INCREMENTAL: "0"
- name: Install dependencies for code coverage - name: Install dependencies for code coverage
run: | run: |
sudo apt-get update sudo apt-get update