Skip to content

Commit

Permalink
Merge pull request #124 from clog-tool/gh-actions
Browse files Browse the repository at this point in the history
Migrate to GH Actions
  • Loading branch information
kbknapp authored Jul 9, 2024
2 parents 99119b9 + f190944 commit e424614
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 188 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Tests

on:
pull_request:

concurrency:
group: ci-pr-${{ github.ref }}
cancel-in-progress: true

jobs:
test-full:
name: Full
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Cache Builds
uses: Swatinem/rust-cache@v2
- name: Checkout
uses: actions/checkout@v4
- name: Compile
run: cargo test --no-run --all-features
- name: Test
run: cargo test --all-features
test-minimal:
name: Min
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Cache Builds
uses: Swatinem/rust-cache@v2
- name: Checkout
uses: actions/checkout@v4
- name: Compile
run: cargo test --no-run --no-default-features
- name: Test
run: cargo test --no-default-features
43 changes: 43 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Lint

on:
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check spelling
uses: crate-ci/typos@master
with:
config: ./.typos.toml

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Clippy
run: cargo clippy --all-features --all-targets

- name: Format Check
run: cargo fmt --check
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.74.1 # msrv

- name: Check
run: cargo check
82 changes: 82 additions & 0 deletions .github/workflows/release_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
on:
push:
branches: [master, main]

name: Nightly Release

env:
RELEASE_BIN: clog
RELEASE_ADDS: >-
LICENSE-APACHE
LICENSE-MIT
nightly-CHANGELOG.md
README.md
jobs:
nightly-release:
name: Nightly Release

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
target: x86_64-unknown-linux-musl

- name: Compile
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-unknown-linux-musl

- name: Install CLOG
uses: actions-rs/cargo@v1
with:
command: install
args: clog-cli

- name: Generate Changelog
run: clog -F -o nightly-CHANGELOG.md -i /dev/null

- name: Make artifacts dir
run: mkdir -p artifacts/

- name: Copy all artifacts into dir
run: cp target/x86_64-unknown-linux-musl/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }} artifacts/

- uses: benjlevesque/[email protected]
id: short-sha

- name: Create archive for Linux
run: cd artifacts/ && tar czf ../${{ env.RELEASE_BIN }}-${{ env.SHA }}-x86_64-linux-musl.tar.gz ./*
env:
SHA: ${{ steps.short-sha.outputs.sha }}

- name: Remove previous Nightly Release
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: nightly
repo: clog-tool/clog-cli
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Nightly Release
uses: softprops/action-gh-release@v1
with:
name: clog Nightly (${{ env.SHA }})
tag_name: nightly
prerelease: true
body_path: nightly-CHANGELOG.md
files: |
${{ env.RELEASE_BIN }}-${{ env.SHA }}-x86_64-linux-musl.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: clog-tool/clog-cli
SHA: ${{ steps.short-sha.outputs.sha }}

17 changes: 17 additions & 0 deletions .github/workflows/security_audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'

name: Security audit

jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
122 changes: 0 additions & 122 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[type.md.extend-words]
ba = "ba"
afe = "afe"
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ license = "MIT"
name = "clog-cli"
edition = "2021"
version = "0.9.3"
rust-version = "1.74.1" # msrv
authors = ["Christoph Burgdorf <[email protected]>"]
description = "A conventional changelog for the rest of us"
exclude = ["docs/*"]
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ There are two ways to use `clog`, as a binary via the command line or as a libra

### Binary (Command Line)

In order to use `clog` via the command line you must first obtain a binary by either compiling it yourself, or downlading and installing one of the precompiled binaries.
In order to use `clog` via the command line you must first obtain a binary by either compiling it yourself, or downloading and installing one of the precompiled binaries.

#### `cargo install`

Expand Down Expand Up @@ -87,7 +87,7 @@ Otherwise, ensure you have the `clog` binary in the directory which you operatin

#### Using clog from the Command Line

`clog` works by reading your `git` metadata and specially crafted commit messages and subjects to create a changelog. `clog` has the following options availble.
`clog` works by reading your `git` metadata and specially crafted commit messages and subjects to create a changelog. `clog` has the following options available.

```sh
USAGE:
Expand All @@ -104,7 +104,7 @@ FLAGS:
OPTIONS:
-C, --changelog <changelog> A previous changelog to prepend new changes to (this is like
using the same file for both --infile and --outfile and
should not be used in conjuction with either)
should not be used in conjunction with either)
-c, --config <config> The Clog Configuration TOML file to use (Defaults to
'.clog.toml')**
-T, --format <format> The output format, defaults to markdown
Expand Down Expand Up @@ -175,7 +175,7 @@ subtitle = "my awesome title"
link-style = "github"
# The preferred way to set a constant changelog. This file will be read for old changelog
# data, then prepended to for new changelog data. It's the equivilant to setting
# data, then prepended to for new changelog data. It's the equivalent to setting
# both infile and outfile to the same file.
#
# Do not use with outfile or infile fields!
Expand Down Expand Up @@ -223,7 +223,7 @@ MySection = ["mysec", "ms"]
Now if you make a commit message such as `mysec(Component): some message` or `ms(Component): some message` there will be a new "MySection" section along side the "Features" and "Bug Fixes" areas.
*NOTE:* Sections with spaces are suppported, such as `"My Special Section" = ["ms", "mysec"]`
*NOTE:* Sections with spaces are supported, such as `"My Special Section" = ["ms", "mysec"]`
## Companion Projects
Expand Down
Loading

0 comments on commit e424614

Please sign in to comment.