2021-04-21 07:54:44 +00:00
|
|
|
# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
|
|
|
|
|
|
|
|
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-24 17:16:11 +00:00
|
|
|
- name: Run Cargo Check
|
2021-04-21 07:54:44 +00:00
|
|
|
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
|
|
|
|
2021-04-24 17:16:11 +00:00
|
|
|
- name: Run Tests
|
2021-04-21 07:54:44 +00:00
|
|
|
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-24 17:16:11 +00:00
|
|
|
- name: Run Cargo fmt
|
2021-04-21 07:54:44 +00:00
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: fmt
|
|
|
|
args: --all -- --check
|
2021-04-24 17:16:11 +00:00
|
|
|
- name: Run Cargo clippy
|
2021-04-21 07:54:44 +00:00
|
|
|
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
|
|
|
|
|
2021-04-24 17:16:11 +00:00
|
|
|
build-aarch64:
|
2021-04-24 17:35:41 +00:00
|
|
|
name: Build ARM64 Binaries
|
2021-04-22 17:56:30 +00:00
|
|
|
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
|
2021-04-21 07:54:44 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [check, test, lints]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
override: true
|
2021-04-23 12:18:54 +00:00
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
2021-04-24 17:16:11 +00:00
|
|
|
~/.cargo/bin
|
|
|
|
~/.cargo/.crates2.json
|
|
|
|
~/.cargo/.crates.toml
|
2021-04-23 12:18:54 +00:00
|
|
|
target
|
2021-04-24 17:16:11 +00:00
|
|
|
key: ${{ runner.os }}-aarch64-unknown-linux-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}
|
2021-04-22 17:56:30 +00:00
|
|
|
- name: Compile
|
|
|
|
uses: actions-rs/cargo@v1
|
2021-04-21 07:54:44 +00:00
|
|
|
with:
|
2021-04-22 17:56:30 +00:00
|
|
|
use-cross: true
|
2021-04-21 07:54:44 +00:00
|
|
|
command: build
|
2021-04-24 17:16:11 +00:00
|
|
|
args: --release --target=aarch64-unknown-linux-gnu
|
|
|
|
|
|
|
|
build-ppc:
|
|
|
|
name: Build PowerPC Binaries
|
|
|
|
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
|
|
|
|
continue-on-error: true
|
2021-04-24 18:09:19 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2021-04-24 17:16:11 +00:00
|
|
|
needs: [check, test, lints]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
2021-04-24 17:35:41 +00:00
|
|
|
target: powerpc64-unknown-linux-gnu
|
2021-04-24 17:16:11 +00:00
|
|
|
override: true
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
~/.cargo/bin
|
|
|
|
~/.cargo/.crates2.json
|
|
|
|
~/.cargo/.crates.toml
|
|
|
|
target
|
|
|
|
key: ${{ runner.os }}-powerpc64-unknown-linux-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}
|
2021-04-24 17:22:59 +00:00
|
|
|
- name: Install PowerPC gcc
|
2021-04-24 17:16:11 +00:00
|
|
|
run: sudo apt-get install -y gcc-powerpc-linux-gnu
|
|
|
|
- name: Compile
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release --target=powerpc64-unknown-linux-gnu
|
2021-04-21 10:18:58 +00:00
|
|
|
|
2021-04-22 17:56:30 +00:00
|
|
|
publish-docker:
|
|
|
|
name: Build and Publish Docker Image
|
|
|
|
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
|
2021-04-24 18:09:19 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2021-04-21 10:18:58 +00:00
|
|
|
needs: [check, test, lints]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-04-24 17:16:11 +00:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2021-04-26 14:40:43 +00:00
|
|
|
toolchain: 1.50.0
|
2021-04-24 17:16:11 +00:00
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
override: true
|
2021-04-25 19:33:00 +00:00
|
|
|
- name: Rust Cache
|
|
|
|
uses: Swatinem/rust-cache@v1.2.0
|
2021-04-22 17:56:30 +00:00
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: rohansircar
|
|
|
|
password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
|
2021-04-24 17:16:11 +00:00
|
|
|
- name: Compile
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release
|
2021-04-21 10:18:58 +00:00
|
|
|
- name: Build Image
|
2021-04-24 17:16:11 +00:00
|
|
|
run: docker build -f ci.Dockerfile -t rohansircar/actix-demo:latest .
|
2021-04-24 17:24:12 +00:00
|
|
|
env:
|
|
|
|
DOCKER_BUILDKIT: 1
|
2021-04-22 17:56:30 +00:00
|
|
|
- name: Publish Image
|
2021-04-22 18:01:23 +00:00
|
|
|
run: docker push rohansircar/actix-demo:latest
|