Skip to content

Commit

Permalink
Feature: Create GH workflows (#145)
Browse files Browse the repository at this point in the history
* feat(ci): introduce base GH Actions

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* test(broken)

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* fix(ci): use proper branch names

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* fix(clippy): run once only

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* fix(clippy): only run once

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* fix(clippy): run at least once

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* chore(readme): update test status badge

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* test pre-commit using github actions

* add stable and 1.47 rust to test

* fixed toolchain proper matrix toolchain

* upgrade pre-commit

* install rustfmt

* add max-parallel to allow to complete both items in matrix

* use order to enforce to test 1.47 first

* disable latest 1.48 clippy checks

* remove 1.47.0 as we need to use 1.48 clippy checks

* run clippy on all targets and fixed clippy issues in example

* fix(pre-commit): remove clippy and format

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* fix(badge): point at riker repo test resultss

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* Apply suggestions from code review

Co-authored-by: Rajiv Shah <rajivshah1@icloud.com>

* Update .github/workflows/audit.yml

Co-authored-by: Rajiv Shah <rajivshah1@icloud.com>

* chore(travis): purge

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

Co-authored-by: olexiyb <olexiyb@gmail.com>
Co-authored-by: Rajiv Shah <rajivshah1@icloud.com>
  • Loading branch information
3 people committed Nov 30, 2020
1 parent 69be3d9 commit edc07d5
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 42 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/audit.yml
@@ -0,0 +1,26 @@
name: Audit

on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- master
paths:
- "**/Cargo.lock"
- "**/Cargo.toml"
pull_request:
branches:
- master
paths:
- "**/Cargo.lock"
- "**/Cargo.toml"

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
77 changes: 77 additions & 0 deletions .github/workflows/build-and-test.yml
@@ -0,0 +1,77 @@
name: Build and run tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
project: [./, ./riker-macros/]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Get current date
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Get current date
if: matrix.os == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8

- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.project }}-${{ matrix.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.project }}-${{ matrix.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.project }}-${{ matrix.os }}-${{ matrix.rust }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.project }}-${{ matrix.os }}-${{ matrix.rust }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo target
uses: actions/cache@v2
with:
path: ${{ matrix.project}}/target
# Add date to the cache to keep it up to date
key: ${{ matrix.project }}-${{ matrix.os }}-${{ matrix.rust }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.project }}-${{ matrix.os }}-${{ matrix.rust }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}
- name: Build ${{ matrix.project }}
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path=${{ matrix.project }}Cargo.toml --all --release

- name: Run tests for ${{ matrix.project }}
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path=${{ matrix.project }}Cargo.toml --all --release
28 changes: 28 additions & 0 deletions .github/workflows/pre-commit.yml
@@ -0,0 +1,28 @@
name: pre-commit

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
pre-commit:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: clippy, rustfmt
- uses: pre-commit/action@v2.0.0
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Expand Up @@ -7,16 +7,17 @@ repos:
language: system
entry: sh -c 'touch src/lib.rs'
- repo: https://github.com/doublify/pre-commit-rust
rev: 14b3e118cfc36fb87d8d9cbd1305a2238fd85868
rev: v1.0
hooks:
- id: clippy
args: ["--all-targets", "--all-features", "--", "-D", "warnings"]
name: cargo clippy https://github.com/rust-lang/rust-clippy/blob/master/README.md .
- id: cargo-check
name: cargo check https://doc.rust-lang.org/cargo/commands/cargo-check.html .
- id: fmt
name: rustfmt https://github.com/rust-lang/rustfmt/blob/master/README.md .
- repo: https://github.com/prettier/prettier.git
rev: 2.1.1
- repo: https://github.com/pre-commit/mirrors-prettier.git
rev: v2.2.0
hooks:
- id: prettier
name: prettier https://prettier.io/docs/en/ .
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Riker

[![Build Status](https://travis-ci.org/riker-rs/riker.svg?branch=master)](https://travis-ci.org/riker-rs/riker)
[![Build status](https://github.com/riker-rs/riker/workflows/Build%20and%20run%20tests/badge.svg)](https://github.com/riker-rs/riker/actions?query=workflow%3A%22Build+and+run+tests%22)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
[![crates.io](https://meritbadge.herokuapp.com/riker)](https://crates.io/crates/riker)
[![Released API docs](https://docs.rs/riker/badge.svg)](https://docs.rs/riker)
Expand Down
16 changes: 2 additions & 14 deletions examples/channel.rs
Expand Up @@ -26,13 +26,7 @@ impl Actor for GpsActor {

println!("{}: pre_start subscribe to {:?}", ctx.myself.name(), topic);
let sub = Box::new(ctx.myself());
self.chan.tell(
Subscribe {
actor: sub.clone(),
topic,
},
None,
);
self.chan.tell(Subscribe { actor: sub, topic }, None);
}

fn recv(&mut self, ctx: &Context<Self::Msg>, msg: Self::Msg, sender: Sender) {
Expand Down Expand Up @@ -67,13 +61,7 @@ impl Actor for NavigationActor {

println!("{}: pre_start subscribe to {:?}", ctx.myself.name(), topic);
let sub = Box::new(ctx.myself());
self.chan.tell(
Subscribe {
actor: sub.clone(),
topic,
},
None,
);
self.chan.tell(Subscribe { actor: sub, topic }, None);
}

fn recv(&mut self, ctx: &Context<Self::Msg>, msg: Self::Msg, sender: Sender) {
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Expand Up @@ -4,6 +4,8 @@
// #![deny(clippy::nursery)]
#![allow(clippy::new_ret_no_self)]
#![allow(clippy::large_enum_variant)]
#![allow(clippy::rc_buffer)]
#![allow(clippy::to_string_in_display)]

mod validate;

Expand Down

0 comments on commit edc07d5

Please sign in to comment.