Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
okaneco committed May 26, 2022
0 parents commit 1f0e954
Show file tree
Hide file tree
Showing 25 changed files with 2,537 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/rust-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Rust CD

on:
push:
tags:
- "*.*.*"

jobs:
publish-binary:
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
rust: [ stable ]
platform:
- os: macos-latest
os-name: macos
target: x86_64-apple-darwin
architecture: x86_64
binary-postfix: ""
use-cross: false
- os: ubuntu-latest
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
binary-postfix: ""
use-cross: false
- os: windows-latest
os-name: windows
target: x86_64-pc-windows-msvc
architecture: x86_64
binary-postfix: ".exe"
use-cross: false
- os: ubuntu-latest
os-name: linux
target: aarch64-unknown-linux-gnu
architecture: arm64
binary-postfix: ""
use-cross: true
- os: ubuntu-latest
os-name: linux
target: i686-unknown-linux-gnu
architecture: i686
binary-postfix: ""
use-cross: true

steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true

- name: Checkout repository
uses: actions/checkout@v2

- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
use-cross: ${{ matrix.platform.use-cross }}
toolchain: ${{ matrix.rust }}
args: --release --target ${{ matrix.platform.target }}

- name: Package final binary
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
BINARY_NAME=simple_clustering${{ matrix.platform.binary-postfix }}
########## create tar.gz ##########
RELEASE_NAME=simple_clustering-${GITHUB_REF/refs\/tags\//}-${{ matrix.platform.os-name }}-${{ matrix.platform.architecture }}
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
########## create sha256 ##########
if [[ ${{ runner.os }} == 'Windows' ]]; then
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256
else
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
fi
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.platform.target }}/release/simple_clustering-*.tar.gz
target/${{ matrix.platform.target }}/release/simple_clustering-*.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Rust CI

on:
push:
branches: master
pull_request:
branches: master
schedule:
- cron: "0 0 1 * *" # monthly
workflow_dispatch: # allow manual triggering of the action

env:
RUSTFLAGS: "-Dwarnings"

jobs:
build-crate:
name: Build and test crate/docs
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
toolchain: [nightly, beta, stable]
include:
- os: macos-latest
toolchain: stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
components: rust-docs
override: true
- name: Build library
run: cargo build -v --lib --no-default-features
- name: Build binary
run: cargo build -v --bins
- name: Test library
run: cargo test --no-default-features --lib
- name: Doc tests
run: cargo test --doc --no-default-features
- name: Build docs
run: cargo doc --no-deps --no-default-features

clippy-rustfmt:
name: Clippy and rustfmt
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy, rustfmt
override: true
- name: clippy
run: cargo clippy
continue-on-error: true
- name: rustfmt
run: cargo fmt -- --check
continue-on-error: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target
/test
**/.DS_Store
/*.jpg
/*.png
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# `simple_clustering` changelog

## Version 0.1.0 - 2022-04
- Initial Commit
Loading

0 comments on commit 1f0e954

Please sign in to comment.