Skip to content

Commit

Permalink
build: run ci for all supported targets
Browse files Browse the repository at this point in the history
  • Loading branch information
mahor1221 committed Jul 9, 2024
1 parent 08e0b35 commit c31c517
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 31 deletions.
79 changes: 53 additions & 26 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,6 @@ jobs:
id: cargo-fmt
run: cargo fmt --all -- --check

- name: Check build
if: success() || failure()
id: cargo-check
run: cargo check --profile=ci --locked

- name: Check lints
if: success() || failure()
id: cargo-clippy
run: cargo clippy --profile=ci --locked

- name: Check tests
if: success()
id: cargo-test
run: cargo test --profile=ci --locked

- name: Check documents
if: success()
id: cargo-doc
run: cargo doc --profile=ci --locked --no-deps

# create check runs for pull requests

- name: Check file size
if: (success() || failure()) && github.event_name == 'pull_request'
id: lfs
Expand All @@ -79,6 +57,8 @@ jobs:
filesizelimit: 256000
sendComment: false

# create check runs for pull requests

- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
Expand Down Expand Up @@ -107,30 +87,77 @@ jobs:
name: Check formatting
conclusion: ${{ steps.cargo-fmt.outcome }}

check-target:
name: Check target
timeout-minutes: 2
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu }
- { os: ubuntu-latest, target: aarch64-unknown-linux-musl }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-latest, target: x86_64-unknown-linux-musl }
# - { os: windows-latest, target: aarch64-pc-windows-msvc }
# - { os: windows-latest, target: x86_64-pc-windows-msvc }

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
cache-on-failure: true
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Check build
if: success() || failure()
id: cargo-check
run: cargo check --profile=ci --locked --target ${{ matrix.target }}

- name: Check lints
if: success() || failure()
id: cargo-clippy
run: cargo clippy --profile=ci --locked --target ${{ matrix.target }}

- name: Check tests
if: success()
id: cargo-test
run: cargo test --profile=ci --locked --target ${{ matrix.target }}

- name: Check documents
if: success()
id: cargo-doc
run: cargo doc --profile=ci --locked --target ${{ matrix.target }} --no-deps

# create check runs for pull requests

- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check build
name: Check build ${{ matrix.target }}
conclusion: ${{ steps.cargo-check.outcome }}

- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check lints
name: Check lints ${{ matrix.target }}
conclusion: ${{ steps.cargo-clippy.outcome }}

- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check tests
name: Check tests ${{ matrix.target }}
conclusion: ${{ steps.cargo-test.outcome }}

- uses: LouisBrunner/checks-action@v2.0.0
if: (success() || failure()) && github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Check documents
name: Check documents ${{ matrix.target }}
conclusion: ${{ steps.cargo-doc.outcome }}
10 changes: 5 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ env:
# RUSTDOCFLAGS: -D warnings

jobs:
pre-release:
name: Pre-release
release:
name: Release
if: github.event_name == 'create'
timeout-minutes: 5
permissions:
Expand Down Expand Up @@ -60,9 +60,9 @@ jobs:
changelog: CHANGELOG.md
token: ${{ secrets.GITHUB_TOKEN }}

release:
name: Release
needs: pre-release
release-target:
name: Release target
needs: release
timeout-minutes: 10
permissions:
# required for taiki-e/upload-rust-binary-action
Expand Down
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use crate::{
use chrono::{DateTime, Local};
use clap::ColorChoice;
use clap::Parser;
#[cfg(unix)]
use const_format::formatcp;
use serde::{de, Deserialize, Deserializer};
use std::{
Expand All @@ -58,7 +59,9 @@ pub const FADE_STEPS: u8 = 40;
pub const DEFAULT_SLEEP_DURATION: u64 = 5000;
pub const DEFAULT_SLEEP_DURATION_SHORT: u64 = 100;

#[cfg(unix_without_macos)]
pub const RANDR_MINOR_VERSION_MIN: u32 = 3;
#[cfg(unix_without_macos)]
pub const RANDR_MAJOR_VERSION: u32 = 1;

/// Merge of cli arguments and config files from highest priority to lowest:
Expand Down
3 changes: 3 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ impl<T, E> InjectErr<T, E> for Result<T, E> {
}

/// Shortcut for inject_err().map_err(..) on Result types
#[cfg(unix_without_macos)]
pub trait InjectMapErr<T, E> {
fn inject_map_err<F1, F2, O, Index>(self, f: O) -> Result<T, F2>
where
Self: Sized,
F1: CoprodInjector<E, Index>,
O: FnOnce(F1) -> F2;
}

#[cfg(unix_without_macos)]
impl<T, E> InjectMapErr<T, E> for Result<T, E> {
#[inline(always)]
fn inject_map_err<F1, F2, O, Index>(self, f: O) -> Result<T, F2>
Expand Down

0 comments on commit c31c517

Please sign in to comment.