Skip to content

Commit

Permalink
cleanup, bump versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nbari committed Mar 9, 2024
1 parent 2a260f8 commit 001d713
Show file tree
Hide file tree
Showing 13 changed files with 462 additions and 205 deletions.
2 changes: 2 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[codespell]
ignore-words-list = crate
3 changes: 3 additions & 0 deletions .github/actions-rs/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
output-type: lcov
output-file: ./lcov.info
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Test & Build

on:
push:
branches:
- '*'
workflow_dispatch:

permissions:
contents: write

jobs:
test:
uses: ./.github/workflows/test.yml

build:
name: Build
runs-on: ${{ matrix.os }}
needs: test

strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl

- build: macos
os: macos-latest
target: x86_64-apple-darwin

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Branch name
run: echo "${GITHUB_REF##*/}"

- name: Get the release version from the tag
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- run: sudo apt -y install musl-dev musl-tools
if: matrix.build == 'linux'

- name: Build
run: |-
cargo build --release --locked --target ${{ matrix.target }}
45 changes: 0 additions & 45 deletions .github/workflows/ci.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Coverage

on:
push:
branches-ignore:
- develop
- main

jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly

- name: Run tests
run: cargo test --verbose -- --nocapture
env:
RUST_BACKTRACE: full
CARGO_INCREMENTAL: '0'
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code
-Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests
RUSTDOCFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code
-Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests

- name: rust-grcov
uses: actions-rs/[email protected]

- name: Upload to codecov.io
uses: codecov/codecov-action@v3

- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
89 changes: 89 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
name: Deploy

on:
push:
tags:
- '*'
workflow_dispatch:

permissions:
contents: write

jobs:
test:
uses: ./.github/workflows/test.yml

build:
name: Build and release
runs-on: ${{ matrix.os }}
needs: test

strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl

- build: macos
os: macos-latest
target: x86_64-apple-darwin

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get the release version from the tag
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- run: sudo apt -y install musl-dev musl-tools
if: matrix.build == 'linux'

- name: Build Linux
run: |
cargo build --release --locked --target ${{ matrix.target }} --features "openssl/vendored"
if: matrix.build == 'linux'

- name: Build
run: |
cargo build --release --locked --target ${{ matrix.target }}
if: matrix.build != 'linux'

- name: Build archive
shell: bash
run: |
binary_name="slick"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |-
${{ env.ASSET }}
publish:
name: Publish
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
85 changes: 85 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: Test

on:
workflow_call:
pull_request:
branches:
- '*'

jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Format
run: cargo fmt --all -- --check

lint:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Clippy
run: cargo clippy -- -D clippy::all -D clippy::nursery -D warnings

check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: Check
run: cargo check

test:
name: Test
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
rust:
- stable
runs-on: ${{ matrix.os }}
needs:
- format
- lint
- check
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- name: test
run: cargo test

coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly

- name: Run tests
run: cargo test --verbose
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code
-Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests
RUSTDOCFLAGS: -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code
-Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests

- name: rust-grcov
uses: actions-rs/[email protected]

- name: Upload to codecov.io
uses: codecov/codecov-action@v3

- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
Loading

0 comments on commit 001d713

Please sign in to comment.