Skip to content

📢 publish via github actions and maintenance by oct 2024 #27

📢 publish via github actions and maintenance by oct 2024

📢 publish via github actions and maintenance by oct 2024 #27

Workflow file for this run

name: CICD
on:
push:
branches:
- 'main'
tags:
- '*'
pull_request:
branches: [ 'main' ]
workflow_dispatch:
permissions:
contents: write
jobs:
check:
name: Check
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.74.0
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check
test:
name: Test Suite
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.74.0
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: test
fmt:
name: Rustfmt
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
build:
name: Build
needs: [check, fmt, test, clippy]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release
- name: Package
shell: bash
run: |
mkdir -p build
case ${{ matrix.os }} in
"ubuntu-latest")
cp target/release/rodalies-cli build/rodalies-cli-linux-amd64
;;
"macos-latest")
cp target/release/rodalies-cli build/rodalies-cli-darwin-amd64
;;
"windows-latest")
cp target/release/rodalies-cli.exe build/rodalies-cli-windows-amd64.exe
;;
*)
echo "no OS match...error!"
exit 0
;;
esac
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/rodalies-cli*
release:
name: Publish (crates.io)
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Login
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo login
- name: Publish
run: cargo publish