Skip to content

Fix bxt_lightstyle wiki #681

Fix bxt_lightstyle wiki

Fix bxt_lightstyle wiki #681

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *' # Monthly
env:
RUN_SLOW_TESTS: 1
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]
rust: [stable, beta]
configuration: [debug, release]
cross: [false, true]
exclude:
- configuration: release
rust: beta
- cross: true
os: windows-2019
include:
- os: ubuntu-20.04
cross: false
label: Ubuntu
target: i686-unknown-linux-gnu
filename: libbxt_rs.so
- os: ubuntu-20.04
cross: true
label: Debian (cross to Windows)
target: i686-pc-windows-gnu
filename: bxt_rs.dll
cross-dep: gcc-mingw-w64-i686
# MinGW on Ubuntu fails to link, so use rust:latest which is based on Debian.
container: rust:latest
- os: windows-2019
label: Windows
target: i686-pc-windows-msvc
filename: bxt_rs.dll
- configuration: release
release-flag: '--release'
name: ${{ matrix.rust }} - ${{ matrix.label }} - ${{ matrix.configuration }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
with:
# We need the full history to find the tag
fetch-depth: 0
# Containers have wrong permissions for the folder, so git freaks out.
# https://github.com/actions/runner/issues/2033
- if: job.container
run: chown -R $(id -u):$(id -g) .
# We need the tags for the version string inside bxt-rs
- run: git fetch --force --tags
# Install sudo so that the subsequent steps are the same between container and no container.
- name: Install sudo
if: job.container
run: |
apt-get update -y
apt-get install sudo -y
- name: Install dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update -y
sudo apt-get install -y libc6-dev-i386 ${{ matrix.cross-dep }}
- name: Install Rust
run: |
rustup set auto-self-update check-only
rustup toolchain install ${{ matrix.rust }} --profile minimal
rustup override set ${{ matrix.rust }}
rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.configuration }}-${{ matrix.cross }}
- name: Build
run: cargo build --target ${{ matrix.target }} ${{ matrix.release-flag }}
- name: Build Tests
# Testing cross-compiled build requires wine which is large. We test native Windows anyway so no need.
if: |
!matrix.cross
run: cargo test --no-run --all --target ${{ matrix.target }} ${{ matrix.release-flag }}
- name: Test
# Testing cross-compiled build requires wine which is large. We test native Windows anyway so no need.
if: |
!matrix.cross
run: cargo test --all --target ${{ matrix.target }} ${{ matrix.release-flag }} -- --nocapture
- uses: actions/upload-artifact@v3
if: matrix.rust == 'stable' && !matrix.cross
with:
name: bxt-rs-${{ runner.os }}-${{ matrix.configuration }}
path: target/${{ matrix.target }}/${{ matrix.configuration }}/${{ matrix.filename }}
if-no-files-found: error
- name: Prepare Release
if: startsWith(github.ref, 'refs/tags/') && matrix.rust == 'stable' && matrix.configuration == 'release' && !matrix.cross
run: |
cp target/${{ matrix.target }}/${{ matrix.configuration }}/${{ matrix.filename }} ${{ matrix.filename }}
7z a bxt-rs-${{ runner.os }}.7z ${{ matrix.filename }} COPYING
- name: Release
if: startsWith(github.ref, 'refs/tags/') && matrix.rust == 'stable' && matrix.configuration == 'release' && !matrix.cross
uses: softprops/action-gh-release@v1
with:
files: bxt-rs-${{ runner.os }}.7z
draft: true
fail_on_unmatched_files: true
- name: Generate Wiki Page
if: >
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
matrix.os == 'ubuntu-20.04' &&
matrix.rust == 'stable' &&
matrix.configuration == 'release' &&
!matrix.cross
run: |
mkdir temp_wiki_output
cargo run --target ${{ matrix.target }} --release --bin gen-wiki > temp_wiki_output/Features.md
- name: Upload Wiki Page Artifact
uses: actions/upload-artifact@v3
if: >
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
matrix.os == 'ubuntu-20.04' &&
matrix.rust == 'stable' &&
matrix.configuration == 'release' &&
!matrix.cross
with:
name: wiki
path: temp_wiki_output/
clippy:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
label: Ubuntu
target: i686-unknown-linux-gnu
- os: windows-2019
label: Windows
target: i686-pc-windows-msvc
name: clippy - ${{ matrix.label }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install libc6-dev-i386
- name: Install Rust
run: |
rustup set auto-self-update check-only
rustup toolchain install stable --profile minimal --component clippy
rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --all --all-targets --target ${{ matrix.target }}
rustfmt:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: |
rustup set auto-self-update check-only
rustup toolchain install nightly --profile minimal --component rustfmt
rustup override set nightly
- name: Run rustfmt
run: cargo fmt --all -- --check
publish-wiki:
name: Publish Wiki
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [build, clippy, rustfmt]
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v3
with:
name: wiki
path: temp_wiki_output/
- run: ls --recursive temp_wiki_output/
- uses: SwiftDocOrg/github-wiki-publish-action@v1
with:
path: temp_wiki_output/
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}