Skip to content

Commit

Permalink
release: 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chasinglogic committed Sep 8, 2023
1 parent bdd7706 commit 17b6618
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 2 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: ci

on: [push, pull_request]

jobs:
test:
name: test
env:
# Emit backtraces on panics.
RUST_BACKTRACE: 1
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
# Test on stable and beta rust compilers.
- stable
- beta
include:
- build: macos
os: macos-latest
rust: stable
- build: stable
os: ubuntu-latest
rust: stable
- build: beta
os: ubuntu-latest
rust: beta
steps:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Build licensure
run: cargo build --verbose ${{ env.TARGET_FLAGS }}

- name: Run cargo tests
run: cargo test

clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Lint
run: cargo clippy --no-deps --all-targets

rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
116 changes: 116 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
env:
LICENSURE_VERSION: ""
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
licensure_version: ${{ env.LICENSURE_VERSION }}
steps:
- name: Get the release version from the tag
shell: bash
if: env.LICENSURE_VERSION == ''
run: |
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "LICENSURE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.LICENSURE_VERSION }}"
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.LICENSURE_VERSION }}
release_name: ${{ env.LICENSURE_VERSION }}

build-release:
name: build-release
needs: ['create-release']
runs-on: ${{ matrix.os }}
env:
CARGO: cargo
TARGET_FLAGS: "--target ${{ matrix.target }}"
TARGET_DIR: ./target/${{ matrix.target }}
strategy:
matrix:
build: [linux, linux-arm, macos]
include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
- build: linux-arm
os: ubuntu-latest
rust: stable
target: arm-unknown-linux-gnueabihf
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin

steps:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Use Cross
shell: bash
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET_FLAGS }}"
echo "target dir is: ${{ env.TARGET_DIR }}"
- name: Build release binary
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }}

- name: Strip release binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos'
run: strip "target/${{ matrix.target }}/release/licensure"

- name: Strip release binary (arm)
if: matrix.build == 'linux-arm'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:arm-unknown-linux-gnueabihf \
arm-linux-gnueabihf-strip \
/target/arm-unknown-linux-gnueabihf/release/licensure
- name: Build archive
shell: bash
run: |
staging="licensure-${{ needs.create-release.outputs.licensure_version }}-${{ matrix.target }}"
mkdir -p "$staging/complete"
cp {README.md,LICENSE} "$staging/"
cp "target/${{ matrix.target }}/release/licensure" "$staging/"
tar czvf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
- name: Upload release archive
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream
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,7 +1,7 @@
[package]
authors = ["Mathew Robinson <[email protected]>"]
name = "licensure"
version = "0.3.0"
version = "0.3.1"
keywords = ["licensing", "cli", "tool", "license"]
license = "GPL-3.0"
readme = "README.md"
Expand Down

0 comments on commit 17b6618

Please sign in to comment.