Skip to content

Commit

Permalink
Merge pull request #13 from sebastienrousseau/feature/mini-functions
Browse files Browse the repository at this point in the history
fix(workflow): various tweaks
  • Loading branch information
sebastienrousseau authored Jan 4, 2023
2 parents de679ae + dc3c06b commit 6943d4f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 96 deletions.
77 changes: 0 additions & 77 deletions .github/workflows/build.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .github/workflows/lints.yml → .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: lints
name: clippy

on: [push, pull_request]
on:
push:
branches:
- main

env:
CARGO_TERM_COLOR: always
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: ❯ release

on: [push, pull_request]
on:
push:
branches:
- release

jobs:
mini_functions:
Expand All @@ -23,24 +26,28 @@ jobs:
- uses: actions/checkout@v3

- name: Cache cargo registry 🧑‍💼
id: cache-cargo-registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build 🚀
id: cache-cargo-build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

- name: Toolchain 🛠
id: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Extract version number 📜
id: version
run: |
version=$(grep version Cargo.toml | cut -d '"' -f 2)
echo "version=$version"
Expand All @@ -52,24 +59,23 @@ jobs:
cross build --release --target=${{ matrix.target }} --lib
- name: Test 🧪
id: test
run: |
cargo test --all
- name: Package 📦
id: package
run: |
mkdir -p packages
mv target/${{ matrix.target }}/release/libmini_functions.rlib packages/libmini_functions-$version-${{ github.sha }}.rlib
tar -czvf packages/mini_functions-$version-${{ github.sha }}.tar.gz packages/libmini_functions-$version-${{ github.sha }}.rlib
mv target/${{ matrix.target }}/release/libmini_functions.rlib packages/libmini_functions-$version.rlib
tar -czvf packages/mini_functions-$version.tar.gz packages/libmini_functions-$version.rlib
publish:
needs: mini_functions
if: startsWith(github.ref, 'refs/tags/')
name: Release Library
runs-on: ubuntu-latest
steps:
- name: Checkout 🛒
id: checkout
uses: actions/checkout@v3

- name: Generate Changelog 📜
id: changelog
run: |
# Generate a changelog based on the commit history
git log --oneline --decorate --color > changelog.txt
Expand All @@ -80,15 +86,18 @@ jobs:
cat changelog.txt >> ${{ github.workspace }}-CHANGELOG.txt
echo changelog.txt
- name: Create Release
- name: Create Release 🚀
id: create_release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ${{ github.workspace }}-CHANGELOG.txt
files: |
packages/mini_functions-$version-${{ github.sha }}.tar.gz
packages/mini_functions-$version.tar.gz
name: ${{ github.workspace }}
release_name: ${{ github.workspace }}
tag_name: ${{ github.workspace }}
draft: false
prerelease: false
11 changes: 7 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
name: ❯ rust

on: [push, pull_request]
on:
push:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
build:
rust:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Build
- name: Build 🚀
run: cargo build --verbose
- name: Run tests
- name: Run tests 🧪
run: cargo test --verbose
7 changes: 5 additions & 2 deletions .github/workflows/fmt.yml → .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: ❯ rustfmt

on: [push, pull_request]
on:
push:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
build:
rustfmt:
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"rlib",
"rustc",
"RUSTFLAGS",
"rustfmt",
"rustup",
"Seedable",
"softprops",
Expand Down

0 comments on commit 6943d4f

Please sign in to comment.