Skip to content

Commit

Permalink
wip: merge API and CLI crates
Browse files Browse the repository at this point in the history
  • Loading branch information
cilki committed Jun 2, 2024
1 parent ef0c458 commit 5000b49
Show file tree
Hide file tree
Showing 21 changed files with 362 additions and 132 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: check
permissions:
contents: read
# This configuration allows maintainers of this repo to create a branch and pull request based on
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
# built once.
on:
push:
branches: [master]
pull_request:
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
fmt:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore: release')"
name: stable / fmt
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore: release')"
name: ${{ matrix.toolchain }} / clippy
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
# Get early warning of new lints which are regularly introduced in beta channels.
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: cargo clippy
uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-check'
github_token: ${{ secrets.GITHUB_TOKEN }}
doc:
runs-on: ubuntu-24.04
if: "!contains(github.event.head_commit.message, 'chore: release')"
name: nightly / doc
steps:
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev
- uses: actions/checkout@v4
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
- name: cargo doc
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: --cfg docsrs
msrv:
runs-on: ubuntu-24.04
if: "!contains(github.event.head_commit.message, 'chore: release')"
strategy:
matrix:
msrv: ["1.74.0"]
name: ubuntu / ${{ matrix.msrv }}
steps:
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev
- uses: actions/checkout@v4
- name: Install ${{ matrix.msrv }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.msrv }}
- name: cargo +${{ matrix.msrv }} check
run: cargo check
26 changes: 26 additions & 0 deletions .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: prepare_release
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- master

jobs:
github:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore: release')"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: dtolnay/rust-toolchain@stable

- uses: MarcoIeni/[email protected]
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

113 changes: 113 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: release
on:
push:
branches:
- master

jobs:
github:
runs-on: ubuntu-24.04
if: "contains(github.event.head_commit.message, 'chore: release')"
steps:
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev

- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: dtolnay/rust-toolchain@stable

- uses: MarcoIeni/[email protected]
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

linux:
name: linux / ${{ matrix.target }}
runs-on: ubuntu-latest
needs: github
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- i686-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true

- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}

- uses: actions/upload-artifact@v4
with:
name: goldboot-${{ matrix.target }}
path: target/${{ matrix.target }}/release/gantry

- name: Upload artifacts to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
for tag in $(git tag --points-at HEAD); do
if cp target/${{ matrix.target }}/release/${tag%-*} ${tag%-*}_${{ matrix.target }}; then
gh release upload "${tag}" "${tag%-*}_${{ matrix.target }}"
fi
done
docker:
runs-on: ubuntu-latest
needs: linux
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true

- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- uses: actions/download-artifact@v4
with:
name: gantry-x86_64-unknown-linux-musl
path: gantry/linux-amd64

- uses: actions/download-artifact@v4
with:
name: gantry-aarch64-unknown-linux-musl
path: gantry/linux-arm64

- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Find version tags
id: get_tags
run: |
for tag in $(git tag --points-at HEAD); do
echo "${tag%-*}=${tag##*-}" >>"$GITHUB_OUTPUT"
done
- uses: docker/build-push-action@v5
if: ${{ steps.get_tags.outputs.goldboot != '' }}
with:
context: .
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
push: true
tags: fossable/gantry:latest,fossable/gantry:${{ steps.get_tags.outputs.gantry }}

- uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: fossable/gantry

37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test
permissions:
contents: read
on:
push:
branches: [master]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
required:
runs-on: ubuntu-24.04
if: "!contains(github.event.head_commit.message, 'chore: release')"
name: ubuntu / ${{ matrix.toolchain }}
strategy:
matrix:
# run on stable and beta to ensure that tests won't break on the next version of the rust
# toolchain
toolchain: [stable, beta]
steps:
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev
- uses: actions/checkout@v4
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: cargo generate-lockfile
# enable this ci template to run regardless of whether the lockfile is checked in or not
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
# https://twitter.com/jonhoo/status/1571290371124260865
- name: cargo test --locked
run: cargo test --locked --all-features
# https://github.com/rust-lang/cargo/issues/6669
- name: cargo test --doc
run: cargo test --locked --all-features --doc
16 changes: 16 additions & 0 deletions .release-plz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[changelog]
header = "# Changelog"
body = "Body"
trim = true
protect_breaking_commits = true
sort_commits = "newest"

commit_parsers = [
{ message = "^.*: add", group = "Added" },
{ message = "^.*: support", group = "Added" },
{ message = "^.*: remove", group = "Removed" },
{ message = "^.*: delete", group = "Removed" },
{ message = "^test", group = "Fixed" },
{ message = "^fix", group = "Fixed" },
{ message = "^.*: fix", group = "Fixed" },
]
Loading

0 comments on commit 5000b49

Please sign in to comment.