Actix-Demo/.github/workflows/ci.yml

120 lines
3.0 KiB
YAML
Raw Normal View History

2021-04-21 07:54:44 +00:00
# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
#
# While our "example" application has the platform-specific code,
# for simplicity we are compiling and testing everything on the Ubuntu environment only.
# For multi-OS testing see the `cross.yml` workflow.
on: [push, pull_request]
name: Continuous Integration
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
2021-04-21 08:11:02 +00:00
- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
2021-04-21 07:54:44 +00:00
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
2021-04-21 08:11:02 +00:00
- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
2021-04-21 07:54:44 +00:00
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
2021-04-21 08:11:02 +00:00
- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
2021-04-21 07:54:44 +00:00
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: actions-rs/cargo@v1
2021-04-22 15:05:48 +00:00
# continue-on-error: true
2021-04-21 07:54:44 +00:00
with:
command: clippy
args: -- -D warnings
build:
2021-04-21 10:18:58 +00:00
name: Build Binaries
2021-04-21 07:54:44 +00:00
runs-on: ubuntu-latest
needs: [check, test, lints]
2021-04-22 14:38:48 +00:00
# strategy:
# matrix:
# target:
# - x86_64-unknown-linux-gnu
# # - aarch64-unknown-linux-gnu
# # - powerpc64-unknown-linux-gnu
2021-04-21 07:54:44 +00:00
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
2021-04-21 08:11:02 +00:00
- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
2021-04-21 07:54:44 +00:00
- uses: actions-rs/cargo@v1
with:
command: build
2021-04-22 14:38:48 +00:00
args: --release --target=x86_64-unknown-linux-gnu
2021-04-21 10:18:58 +00:00
build-docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [check, test, lints]
steps:
- uses: actions/checkout@v2
- name: Docker layer cache
uses: satackey/action-docker-layer-caching@v0.0.11
continue-on-error: true
- name: Build Image
run: docker build -t rohansircar/actix-demo:latest .