Skip to content

Commit

Permalink
Remove repetitive tasks in workflow with matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Grégoire Henry committed Dec 13, 2023
1 parent 62dc4d0 commit 759e860
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 61 deletions.
73 changes: 14 additions & 59 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: Check code can compile
name: Check

on:
push:
branches:
- '**'

jobs:
check-ubuntu:
runs-on: ubuntu-latest
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: actions/cache@v3
Expand All @@ -20,68 +24,19 @@ jobs:
restore-keys: |
${{ runner.OS }}-build-
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install SDL2
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install -y libsdl2-dev

- name: Check that code can compile
run: cargo check

check-macos:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: target
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-build-
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable


- name: Install SDL2
if: ${{ matrix.os == 'macos-latest' }}
run: brew install SDL2

- name: Check that code can compile
run: cargo check

check-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: target
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-build-
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Use SDL2 from repo/include/win
if: ${{ matrix.os == 'windows-latest' }}
run: |
cp include/win/SDL2.dll .
cp include/win/SDL2.lib .
- name: Check that code can compile
run: cargo check

check-self-hosted:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check that code can compile
run: cargo check
run: cargo check --all-features
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kalast"
version = "0.4.0-beta12"
version = "0.4.0-beta13"
authors = ["Grégoire Henry <[email protected]>"]
edition = "2021"
description = "Thermophysical Model for Binary Asteroids"
Expand Down

0 comments on commit 759e860

Please sign in to comment.