Skip to content

Commit

Permalink
Crib helium-wallet-rs's GH workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JayKickliter committed Mar 13, 2021
1 parent d347e32 commit 9e8cc99
Showing 1 changed file with 111 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Continuous Integration

on:
push:
branches: [ master ]
tags: ['v*']
pull_request:
branches: [ master ]

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

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
components: clippy, rustfmt

- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}

- name: Check formatting
run: cargo fmt -- --check

- name: Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -Dclippy::all

- name: Build
run: cargo build --all --release

- name: Name Release
if: startsWith(github.ref, 'refs/tags/')
id: name_release
run: echo ::set-output name=RELEASE::lwr-$(echo $GITHUB_REF | cut -d / -f 3)-x86-64-linux

- name: Prepare Release
if: startsWith(github.ref, 'refs/tags/')
env:
NAME: ${{ steps.name_release.outputs.RELEASE }}
run: |
strip target/release/lwr
mkdir $NAME
mv target/release/lwr $NAME/
cp README.md $NAME/
cp LICENSE $NAME/
tar -zcvf $NAME.tar.gz $NAME/
- name: Push Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ steps.name_release.outputs.RELEASE }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-mac:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
default: true
override: true

- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}

- name: Build
run: cargo build --all --release

- name: Name Release
if: startsWith(github.ref, 'refs/tags/')
id: name_release
run: echo ::set-output name=RELEASE::lwr-$(echo $GITHUB_REF | cut -d / -f 3)-x86-64-macos

- name: Prepare Release
if: startsWith(github.ref, 'refs/tags/')
env:
NAME: ${{ steps.name_release.outputs.RELEASE }}
run: |
strip target/release/lwr
mkdir $NAME
mv target/release/lwr $NAME/
cp README.md $NAME/
cp LICENSE $NAME/
tar -zcvf $NAME.tar.gz $NAME/
- name: Push Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ steps.name_release.outputs.RELEASE }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 9e8cc99

Please sign in to comment.