Skip to content

Commit

Permalink
Add CD
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX committed Nov 24, 2021
1 parent 060ed1d commit 5cbabfe
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/cid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
default: true
- name: Build project
run: cargo build --release --all-features

test:
strategy:
matrix:
Expand All @@ -33,6 +34,7 @@ jobs:
default: true
- name: Run tests
run: cargo test

lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -46,3 +48,65 @@ jobs:
components: rustfmt, clippy
- name: Run lint
run: ./lint.sh

deploy_release:
needs: [build, test, lint]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
- name: Publish release
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

attach_binaries:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
needs: [build, test, lint]
runs-on: ${{ matrix.os }}
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.target }}
default: true
- name: Build binary
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --locked --target=${{ matrix.target }}
- name: Upload binary
if: matrix.os != 'windows-latest'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/ftzz
asset_name: ftzz-${{ matrix.target }}
tag: ${{ github.ref }}
- name: Upload binary
if: matrix.os == 'windows-latest'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/ftzz.exe
asset_name: ftzz-${{ matrix.target }}.exe
tag: ${{ github.ref }}

0 comments on commit 5cbabfe

Please sign in to comment.