Updates on actions

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
This commit is contained in:
slinkydeveloper 2020-10-30 09:09:27 +01:00 committed by Francesco Guardiani
parent e6500338c6
commit a9fbb8e0ea
3 changed files with 80 additions and 61 deletions

View File

@ -1,60 +0,0 @@
name: Pull Request
on:
pull_request:
branches:
- master
jobs:
build:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: build
toolchain: stable
target: x86_64-unknown-linux-gnu
args: --workspace
- uses: actions-rs/cargo@v1
with:
command: test
toolchain: stable
target: x86_64-unknown-linux-gnu
args: --workspace
fmt:
name: Format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

View File

@ -0,0 +1,27 @@
name: Pull Request checks
on:
pull_request:
branches:
- master
jobs:
fmt:
name: Format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy, rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

View File

@ -1,6 +1,9 @@
name: Master
name: Rust tests
on:
pull_request:
branches:
- master
push:
branches:
- master
@ -78,6 +81,7 @@ jobs:
env:
CC: musl-gcc
CXX: g++
# If wasm, then we test only the main module and cloudevents-sdk-reqwest
- uses: actions-rs/cargo@v1
if: matrix.target == 'wasm32-unknown-unknown'
@ -85,3 +89,51 @@ jobs:
command: build
toolchain: ${{ matrix.toolchain }}
args: --target wasm32-unknown-unknown --package cloudevents-sdk --package cloudevents-sdk-reqwest
build-examples:
name: Build examples
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- wasm32-unknown-unknown
steps:
- uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ matrix.toolchain }}-stable-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
# Build examples
- name: "Build reqwest-wasm-example"
if: matrix.target == 'wasm32-unknown-unknown'
working-directory: ${GITHUB_WORKSPACE}/example-projects/reqwest-wasm-example
run: cargo build --target ${{ matrix.target }}
- name: "Build rdkafka-example"
if: matrix.target == 'x86_64-unknown-linux-gnu'
working-directory: ${GITHUB_WORKSPACE}/example-projects/rdkafka-example
run: cargo build --target ${{ matrix.target }}
- name: "Build actix-web-example"
if: matrix.target == 'x86_64-unknown-linux-gnu'
working-directory: ${GITHUB_WORKSPACE}/example-projects/actix-web-example
run: cargo build --target ${{ matrix.target }}