rewrite ci

This commit is contained in:
figsoda 2021-11-01 09:39:21 -04:00
parent 272b3069ea
commit 4f9caeeec4
2 changed files with 87 additions and 317 deletions

87
.github/workflows/build-and-test.yml vendored Normal file
View File

@ -0,0 +1,87 @@
name: build-and-test
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
# - target: x86_64-pc-windows-gnu
# os: windows-latest
# ext: .exe
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies (musl)
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: |
sudo apt-get update
sudo apt-get install help2man musl-tools
- name: Build and test on stable
run: |
rustup toolchain install stable --profile minimal -t ${{ matrix.target }}
cargo +stable build --target ${{ matrix.target }}
cargo +stable test --target ${{ matrix.target }}
- name: Release on nightly
run: |
rustup toolchain install nightly --profile minimal -t ${{ matrix.target }}
cargo +nightly build --release --target ${{ matrix.target }}
env:
GEN_COMPLETIONS: 1
RUSTFLAGS: -Z strip=symbols
- name: Upload bianry
uses: actions/upload-artifact@v2
with:
name: ouch-${{ matrix.target }}${{ matrix.ext }}
path: target/${{ matrix.target }}/release/ouch${{ matrix.ext }}
- name: Build man page and find completions (musl)
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: |
help2man target/${{ matrix.target }}/release/ouch > ouch.1
cp -r target/${{ matrix.target }}/release/build/ouch-*/out/completions .
- name: Upload completions (musl)
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
uses: actions/upload-artifact@v2
with:
name: completions
path: completions
- name: Upload man page (musl)
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
uses: actions/upload-artifact@v2
with:
name: ouch.1
path: ouch.1
clippy-rustfmt:
name: clippy-rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: "Cargo: clippy, fmt"
run: |
rustup toolchain install stable --profile minimal -c clippy
rustup toolchain install nightly --profile minimal -c rustfmt
cargo +stable clippy -- -D warnings
cargo +nightly fmt -- --check

View File

@ -1,317 +0,0 @@
on: [push, pull_request]
name: build-and-test
jobs:
# aarch64-glibc:
# name: Ubuntu 18.04 (for ARMv8 - glibc)
# runs-on: ubuntu-18.04
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# target: aarch64-unknown-linux-gnu
# override: true
# - name: Install binutils-arm-none-eabi
# run: |
# sudo apt-get update
# sudo apt-get install binutils-aarch64-linux-gnu
# - uses: actions-rs/cargo@v1
# with:
# use-cross: true
# command: build
# args: --target=aarch64-unknown-linux-gnu
# - name: Run cargo test
# uses: actions-rs/cargo@v1
# with:
# use-cross: true
# command: test
# args: --target=aarch64-unknown-linux-gnu
# - name: Strip binary
# run: aarch64-linux-gnu-strip target/aarch64-unknown-linux-gnu/release/ouch
# - name: Upload binary
# uses: actions/upload-artifact@v2
# with:
# name: 'ouch-aarch64-linux-gnu'
# path: target/aarch64-unknown-linux-gnu/release/ouch
# armv7-glibc:
# name: Ubuntu 18.04 (for ARMv7 - glibc)
# continue-on-error: true
# runs-on: ubuntu-18.04
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# target: armv7-unknown-linux-gnueabihf
# override: true
# - name: Install binutils-arm-none-eabi
# run: |
# sudo apt-get update
# sudo apt-get install binutils-arm-none-eabi
# - uses: actions-rs/cargo@v1
# with:
# use-cross: true
# command: build
# args: --target=armv7-unknown-linux-gnueabihf
# - name: Run cargo test
# uses: actions-rs/cargo@v1
# with:
# use-cross: true
# command: test
# args: --target=armv7-unknown-linux-gnueabihf
# - name: Strip binary
# run: arm-none-eabi-strip target/armv7-unknown-linux-gnueabihf/release/ouch
# - name: Upload binary
# uses: actions/upload-artifact@v2
# with:
# name: 'ouch-armv7-linux-gnueabihf'
# path: target/armv7-unknown-linux-gnueabihf/release/ouch
x86_64_musl:
name: Ubuntu 20.04 (musl)
runs-on: ubuntu-20.04
strategy:
matrix:
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
override: true
- name: Install dependencies for musl libc
run: |
sudo apt-get update
sudo apt-get install help2man musl-tools
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-unknown-linux-musl
env:
GEN_COMPLETIONS: 1
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --target x86_64-unknown-linux-musl
- name: Build man page and find completions
run: |
help2man target/x86_64-unknown-linux-musl/release/ouch > ouch.1
cp -r target/x86_64-unknown-linux-musl/release/build/ouch-*/out/completions .
- name: Strip binary
run: strip target/x86_64-unknown-linux-musl/release/ouch
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: 'ouch-x86_64-linux-musl'
path: target/x86_64-unknown-linux-musl/release/ouch
- name: Upload completions
uses: actions/upload-artifact@v2
with:
name: completions
path: completions
- name: Upload man page
uses: actions/upload-artifact@v2
with:
name: ouch.1
path: ouch.1
x86_64_glibc:
name: Ubuntu 20.04 (glibc)
runs-on: ubuntu-20.04
strategy:
matrix:
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
# - name: Strip binary
# run: strip target/release/ouch
# - name: Upload binary
# uses: actions/upload-artifact@v2
# with:
# name: 'ouch-x86_64-linux-gnu'
# path: target/release/ouch
x86_64_macos:
name: macOS (x86_64)
runs-on: macos-latest
strategy:
matrix:
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
override: true
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
- name: Strip binary
run: strip target/release/ouch
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: 'ouch-x86_64-apple-darwin'
path: target/release/ouch
windows-msvc:
name: Windows Server (MSVC)
runs-on: windows-latest
strategy:
matrix:
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: 'ouch-x86_64-pc-windows-msvc'
path: target\release\ouch.exe
# windows-mingw:
# name: Windows Server (MinGW)
# runs-on: windows-2019
# strategy:
# matrix:
# rust:
# - stable
# steps:
# - name: Checkout sources
# uses: actions/checkout@v2
# - name: Install toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# target: x86_64-pc-windows-gnu
# override: true
# - name: Run cargo build
# uses: actions-rs/cargo@v1
# with:
# command: build
# args: --target x86_64-pc-windows-gnu
# - name: Run cargo test
# uses: actions-rs/cargo@v1
# with:
# command: test
# args: --target x86_64-pc-windows-gnu
# - name: Upload binary
# uses: actions/upload-artifact@v2
# with:
# name: 'ouch-x86_64-pc-windows-gnu'
# path: target\x86_64-pc-windows-gnu\release\ouch.exe
fmt:
name: Check sourcecode format
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: x86_64-unknown-linux-musl
components: rustfmt
override: true
- name: Check format with cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check