Skip to content

Commit

Permalink
Cache dependencies for CI. (enso-org/ide#277)
Browse files Browse the repository at this point in the history
Original commit: enso-org/ide@4e55dc5
  • Loading branch information
Kesanov authored Mar 31, 2020
1 parent a18a46f commit 47f11a2
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 124 deletions.
127 changes: 4 additions & 123 deletions ide/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build (MacOS, Linux, Windows)

on: [push]
on:
push:
branches: master

# Please check if all components are available before updating the rust toolchain version.
# https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu.html
Expand All @@ -10,7 +12,6 @@ jobs:

build:
name: Build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -82,126 +83,6 @@ jobs:
path: dist/client/mac/Enso Studio.app


check:
name: Check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true

- name: Install Clippy
run: rustup component add clippy

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '12.16.1'

- name: Building Rust Sources
run: node ./run lint


test:
name: Tests
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true

- name: Install wasm-pack
uses: actions-rs/cargo@v1
with:
command: install
args: wasm-pack --version 0.8.1

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '12.16.1'

- name: Run tests
run: node ./run test --no-wasm


wasm-test:
name: WASM Tests
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true

- name: Install wasm-pack
uses: actions-rs/cargo@v1
with:
command: install
args: wasm-pack --version 0.8.1

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '12.16.1'

- name: Run tests
run: node ./run test --no-native


# TODO: enable after fixing https://github.com/actions-rs/grcov/issues/50
# coverage:
# name: Coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
#
# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly-2019-11-04
# override: true
#
# - name: Install Node
# uses: actions/setup-node@v1
# with:
# node-version: '12.16.1'
#
# - name: Generate test profile
# working-directory: src/rust
# run: cargo test --all-features --no-fail-fast
# env:
# 'CARGO_INCREMENTAL': '0'
# 'RUSTFLAGS': '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads'
#
# - name: Generate coverage report
# id: coverage
# uses: actions-rs/grcov@v0.1
#
# - name: Show the coverage report
# run: cat ${{ steps.coverage.outputs.report }}
#
# - name: Upload the coverage report
# uses: codecov/codecov-action@v1.0.2
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./lcov.info


build-fm:
name: Build File Manager Server Mock
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -241,4 +122,4 @@ jobs:
with:
name: File Manager Server (Windows)
path: src/rust/target/release/file-manager-server.exe
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-latest'
213 changes: 213 additions & 0 deletions ide/.github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
name: Check

on: [push]

# Please check if all components are available before updating the rust toolchain version.
# https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu.html

jobs:

build:
name: Build
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1

- name: Cache Cargo Registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-wasm-registry-${{ hashFiles('src/rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-wasm-registry

- name: Cache Wasm
uses: actions/cache@v1
with:
path: src/rust/target
key: ${{ runner.os }}-wasm-build-${{ hashFiles('src/rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-wasm-build

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true

- name: Install wasm-pack
# We could use cargo install wasm-pack, but that takes 3.5 minutes compared to few seconds.
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.8.1
WASMPACKDIR: wasm-pack-v0.8.1-x86_64-apple-darwin
run: |
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash


- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '12.16.1'

- name: Build
run: node ./run build --dev


check:
name: Linter
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1

- name: Cache Cargo Registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('src/rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-registry

- name: Cache Cargo Check
uses: actions/cache@v1
with:
path: src/rust/target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('src/rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-build

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true

- name: Install Clippy
run: rustup component add clippy

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '12.16.1'

- name: Building Rust Sources
run: node ./run lint


test:
name: Tests
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1

- name: Cache Cargo Registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('src/rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-registry

- name: Cache Cargo Test
uses: actions/cache@v1
with:
path: src/rust/target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('src/rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-build

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '12.16.1'

- name: Run tests
run: node ./run test --no-wasm


wasm-test:
name: WASM Tests
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1

- name: Cache Cargo Registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-wasm-test-registry-${{ hashFiles('src/rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-wasm-test-registry

- name: Cache Wasm Test
uses: actions/cache@v1
with:
path: src/rust/target
key: ${{ runner.os }}-wasm-test-build-${{ hashFiles('src/rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-wasm-test-build

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true

- name: Install wasm-pack
# We could use cargo install wasm-pack, but that takes 3.5 minutes compared to few seconds.
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.8.1
WASMPACKDIR: wasm-pack-v0.8.1-x86_64-apple-darwin
run: |
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash


- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '12.16.1'

- name: Run tests
run: node ./run test --no-native


# TODO: enable after fixing https://github.com/actions-rs/grcov/issues/50
# coverage:
# name: Coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v1
#
# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly-2019-11-04
# override: true
#
# - name: Install Node
# uses: actions/setup-node@v1
# with:
# node-version: '12.16.1'
#
# - name: Generate test profile
# working-directory: src/rust
# run: cargo test --all-features --no-fail-fast
# env:
# 'CARGO_INCREMENTAL': '0'
# 'RUSTFLAGS': '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads'
#
# - name: Generate coverage report
# id: coverage
# uses: actions-rs/grcov@v0.1
#
# - name: Show the coverage report
# run: cat ${{ steps.coverage.outputs.report }}
#
# - name: Upload the coverage report
# uses: codecov/codecov-action@v1.0.2
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./lcov.info
3 changes: 2 additions & 1 deletion ide/build/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ commands.test.rust = async function(argv) {

commands.lint = command(`Lint the codebase`)
commands.lint.rust = async function() {
await run('cargo',['clippy','--','-D','warnings'])
// We run clippy-preview due to https://github.com/rust-lang/rust-clippy/issues/4612
await run('cargo',['clippy-preview','-Z','unstable-options','--','-D','warnings'])
}


Expand Down

0 comments on commit 47f11a2

Please sign in to comment.