Skip to content

Commit

Permalink
actions
Browse files Browse the repository at this point in the history
  • Loading branch information
shnewto committed Mar 2, 2024
1 parent f8c6844 commit 032f124
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
format:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2

- name: install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: install rustfmt
run: rustup component add rustfmt

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

macos-latest-stable:
needs: [format]
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build

macos-latest-nightly:
needs: [format]
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build

windows-latest-stable:
needs: [format]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build

windows-latest-nightly:
needs: [format]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build

ubuntu-latest-nightly:
needs: [format]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build

clippy:
needs: [format]
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- run: rustup component add clippy
- name: cargo clippy
run: cargo clippy --all-features --all-targets
45 changes: 45 additions & 0 deletions .github/workflows/tag-and-publish-crate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: tag and publish crate [manual]

on:
workflow_dispatch:
inputs:
tag-increment:
default: patch
required: true
type: choice
options:
- patch
- minor
- major

jobs:
publish:
runs-on: macos-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: checkout repo
uses: actions/checkout@v2
- name: install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: install rustfmt
run: rustup component add rustfmt
- name: rustfmt check
run: cargo fmt --all -- --check
- name: install clippy
run: rustup component add clippy
- name: cargo clippy
run: cargo clippy --all-features --all-targets
- name: install cargo bump
run: cargo install cargo-bump
- name: bump version
run: cargo bump -g ${{ inputs.tag-increment }}
- name: push
run: git push && git push --tags
- name: cargo publish
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}

0 comments on commit 032f124

Please sign in to comment.