Add renovate.json #258
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
paths-ignore: | |
- "docs/**" | |
- "**.md" | |
pull_request: | |
paths-ignore: | |
- "docs/**" | |
- "**.md" | |
jobs: | |
# Run the `rustfmt` code formatter | |
rustfmt: | |
name: Rustfmt [Formatter] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
components: rustfmt | |
override: true | |
- run: rustup component add rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
# Run the `clippy` linting tool | |
clippy: | |
name: Clippy [Linter] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install dependencies | |
run: sudo apt-get install -y xorg-dev libasound2-dev | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
components: clippy | |
override: true | |
- uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-targets --all-features -- -D clippy::all | |
# Ensure that the project could be successfully compiled | |
cargo_check: | |
name: Compile | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install dependencies | |
run: sudo apt-get install -y xorg-dev libasound2-dev | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
args: --all | |
# Run tests on Linux, macOS, and Windows | |
# On both Rust stable and Rust nightly | |
test: | |
name: Test Suite | |
needs: [cargo_check] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
rust: [stable, nightly] | |
steps: | |
# Checkout the branch being tested | |
- uses: actions/checkout@v1 | |
# Install all the required dependencies for testing | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
# Install Node.js at a fixed version | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: "12.0" | |
# Install Ruby at a fixed version | |
- uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: "2.6" | |
# Install Python at a fixed version | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: "3.7" | |
# Install dotnet at a fixed version | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: "2.2.402" | |
- name: Install dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install -y xorg-dev libasound2-dev | |
# Run the ignored tests that expect the above setup | |
- name: Run all tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: -- -Z unstable-options --include-ignored | |
# Build sources for every OS | |
github_build: | |
if: startsWith(github.ref, 'refs/tags/v') | |
name: Build release binaries | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
- x86_64-apple-darwin | |
- x86_64-pc-windows-msvc | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
name: castle-game-x86_64-unknown-linux-gnu.tar.gz | |
- target: x86_64-apple-darwin | |
os: macOS-latest | |
name: castle-game-x86_64-apple-darwin.tar.gz | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
name: castle-game-x86_64-pc-windows-msvc.zip | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install -y xorg-dev libasound2-dev | |
- name: Build target | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target ${{ matrix.target }} | |
- name: Prepare build artifacts [Windows] | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
strip castle-game.exe | |
7z a ../../../${{ matrix.name }} castle-game.exe | |
cd - | |
- name: Prepare build artifacts [-nix] | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/${{ matrix.target }}/release | |
strip castle-game | |
tar czvf ../../../${{ matrix.name }} castle-game | |
cd - | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.name }} | |
path: ${{ matrix.name }} | |
# Create GitHub release with Rust build targets and release notes | |
github_release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
name: Create GitHub Release | |
needs: github_build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
# These can be squashed when https://github.com/actions/download-artifact/issues/6 is closed | |
- name: Download releases from github_build | |
uses: actions/download-artifact@v1 | |
with: | |
name: castle-game-x86_64-unknown-linux-gnu.tar.gz | |
path: . | |
- name: Download releases from github_build | |
uses: actions/download-artifact@v1 | |
with: | |
name: castle-game-x86_64-apple-darwin.tar.gz | |
path: . | |
- name: Download releases from github_build | |
uses: actions/download-artifact@v1 | |
with: | |
name: castle-game-x86_64-pc-windows-msvc.zip | |
path: . | |
- name: Generate checksums | |
run: for file in castle-game-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done | |
- name: Create GitHub release ${{ matrix.target }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
castle-game-* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |