Riven/.github/workflows/ci.yml
2022-08-15 16:01:07 -07:00

120 lines
3.1 KiB
YAML

name: CI
on:
push:
branches: [v/2.x.x]
pull_request:
branches: [v/2.x.x]
schedule:
- cron: "24 05 * * *" # Daily at 10:24 PM PDT, 9:24 PM PST.
workflow_dispatch:
# TODO: generate nightly releases
# inputs:
# should_bench:
# description: "Should Benchmark? (`true`)"
# required: true
# default: "false"
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.0
with:
cancel_others: "true"
test:
name: Check & Test
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Node dependencies
run: npm ci --prefix riven/srcgen
- name: Run codegen
run: node riven/srcgen
- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Run `cargo +stable check --all-targets`
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: check
args: --all-targets
- name: Run `cargo +stable check --all-targets --features tracing`
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: check
args: --all-targets --features tracing
- name: Run `cargo check --all-targets --features nightly,tracing`
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets --features nightly,tracing
- name: Run `cargo build --all-targets --features nightly,deny-unknown`
uses: actions-rs/cargo@v1
with:
command: build
args: --all-targets --features nightly,deny-unknown
- name: Run `cargo test --features nightly,deny-unknown`
uses: actions-rs/cargo@v1
with:
command: test
args: --features nightly,deny-unknown
env:
RUST_BACKTRACE: 1
RUSTLOG: riven=trace
RGAPI_KEY: ${{ secrets.RGAPI_KEY }}
# lints:
# name: Lints
# needs: pre_job
# if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v2
# - name: Install nightly toolchain
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: nightly
# override: true
# components: rustfmt, clippy
# - name: Run cargo fmt
# uses: actions-rs/cargo@v1
# with:
# command: fmt
# args: --all -- --check
# - name: Run cargo clippy
# uses: actions-rs/cargo@v1
# with:
# command: clippy
# args: -- -D warnings