-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from sebastienrousseau/feature/mini-functions
fix(workflow) Added on: [push, pull_request]
- Loading branch information
Showing
7 changed files
with
123 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: ❯ rustfmt | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- run: rustup component add rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all --check --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,84 @@ | ||
name: ❯ release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
on: [push, pull_request] | ||
|
||
env: | ||
APP_NAME: "mini-functions" | ||
RUSTFLAGS: -D warnings | ||
RUSTDOCFLAGS: -D warnings | ||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target/release | ||
key: release-${{ runner.os }}-${{ github.job }}-${{ secrets.CI_CACHE_VERSION }} | ||
- run: cargo test --release | ||
|
||
publish-binary: | ||
needs: | ||
- verify-version | ||
- test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
include: | ||
- os: macos-latest | ||
artifact_prefix: macos-x86-64 | ||
target: x86_64-apple-darwin | ||
- os: ubuntu-latest | ||
artifact_prefix: linux-x86-64 | ||
target: x86_64-unknown-linux-gnu | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target/release | ||
key: release-${{ runner.os }}-${{ github.job }}-${{ secrets.CI_CACHE_VERSION }} | ||
- run: cargo build --release --target ${{ matrix.target }} | ||
- name: package binary | ||
shell: bash | ||
run: | | ||
cd target/${{ matrix.target }}/release | ||
strip ${{ github.event.repository.name }} | ||
tar czvf \ | ||
${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz \ | ||
${{ github.event.repository.name }} | ||
shasum -a 256 ${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz \ | ||
> ${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.sha256 | ||
- name: publish release to github | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
target/${{ matrix.target }}/release/${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.tar.gz | ||
target/${{ matrix.target }}/release/${{ github.event.repository.name }}-${{ matrix.artifact_prefix }}.sha256 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
publish-crate: | ||
needs: | ||
- verify-version | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target/release | ||
key: release-${{ runner.os }}-${{ github.job }}-${{ secrets.CI_CACHE_VERSION }} | ||
- run: cargo publish --token ${{ secrets.CARGO_API_TOKEN }} --allow-dirty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,20 @@ | ||
name: ❯ rust | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
APP_NAME: "mini-functions" | ||
CARGO_TERM_COLOR: always | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "**.md" | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Cache Packages | ||
uses: Swatinem/rust-cache@v1.0.1 | ||
|
||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Publish to crates.io | ||
continue-on-error: true | ||
run: cargo publish --no-verify --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
|
||
- uses: actions/upload-artifact@v2.2.1 | ||
name: Upload a Build Artifact | ||
with: | ||
name: ${{ env.APP_NAME }} | ||
path: target/release/${{ env.APP_NAME }} | ||
|
||
- name: Versions | ||
id: version | ||
run: | | ||
echo "::set-output name=version::$(cargo metadata --format-version 1 --no-deps | jq .packages[0].version -r | sed 's/^/v/')" | ||
echo "::set-output name=tag::$(git describe --tags)" | ||
- name: Calculate SHA512 checksum | ||
run: sha512sum target/release/${{ env.APP_NAME }} > ${{ env.APP_NAME }}.sha512 | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: github.base_ref != 'master' | ||
with: | ||
tag_name: ${{ steps.version.outputs.version }} | ||
name: ${{ steps.version.outputs.version }} - ${{ github.event.head_commit.message }} | ||
draft: true | ||
files: | | ||
target/release/${{ env.APP_NAME }} | ||
${{ env.APP_NAME }}.sha512 | ||
body: | | ||
- ${{ github.event.head_commit.message }} ${{ github.sha }} | ||
generate_release_notes: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters