-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
161 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
binary: | ||
name: Publish binary for ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
# This should work with only the `include`s but it currently doesn't because of this bug: | ||
# https://github.community/t5/How-to-use-Git-and-GitHub/GitHub-Actions-Matrix-options-dont-work-as-documented/td-p/29558 | ||
target: [x86_64-osx, x86_64-unknown-linux-musl, armv7-unknown-linux-musleabihf, armv7-linux-androideabi, aarch64-linux-android] | ||
include: | ||
- os: macos-latest | ||
target: x86_64-osx | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
- os: ubuntu-latest | ||
target: armv7-unknown-linux-musleabihf | ||
- os: ubuntu-latest | ||
target: armv7-linux-androideabi | ||
- os: ubuntu-latest | ||
target: aarch64-linux-android | ||
|
||
steps: | ||
- uses: hecrj/setup-rust-action@v1.3.1 | ||
with: | ||
rust-version: nightly | ||
- uses: actions/checkout@v1 | ||
- name: Build | ||
run: ci/action.sh release ${{ matrix.target }} | ||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v1-release | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: target/tar/cocogito.tar.gz | ||
tag: ${{ github.ref }} | ||
asset_name: cocogitto-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.tar.gz |
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,69 @@ | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
test: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install nightly toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
|
||
- name: Test | ||
uses: actions-rs/tarpaulin@v0.1 | ||
with: | ||
args: '-- --test-threads 1' | ||
|
||
- name: Upload to codecov.io | ||
uses: codecov/codecov-action@v1.0.2 | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
|
||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: code-coverage-report | ||
path: cobertura.xml | ||
|
||
lints: | ||
name: Lints & Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install nightly toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
components: rustfmt, clippy | ||
|
||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
continue-on-error: false | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
- name: Run cargo clippy | ||
uses: actions-rs/cargo@v1 | ||
continue-on-error: false | ||
with: | ||
command: clippy | ||
args: -- -D warnings |
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,47 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
export COCOGITTO_HOME="$(cd "$(dirname "$0")/.." && pwd)" | ||
|
||
echoerr() { | ||
echo "$@" 1>&2 | ||
} | ||
|
||
release() { | ||
|
||
TAR_DIR="${COCOGITTO_HOME}/target/tar" | ||
|
||
target="${1:-}" | ||
if [[ $target == *"osx"* ]]; then | ||
echoerr "OSX cross-compile is impossible. Fallbacking to cargo..." | ||
target="" | ||
fi | ||
|
||
cd "$COCOGITTO_HOME" | ||
|
||
rm -rf "${COCOGITTO_HOME}/target" 2> /dev/null || true | ||
|
||
if [ -n "$target" ]; then | ||
cargo install cross 2> /dev/null || true | ||
cross build --release --target "$target" --bin cocogitto | ||
bin_folder="${target}/release" | ||
else | ||
cargo build --release | ||
bin_folder="release" | ||
fi | ||
|
||
bin_path="${COCOGITTO_HOME}/target/${bin_folder}/cocogitto" | ||
chmod +x "$bin_path" | ||
mkdir -p "$TAR_DIR" 2> /dev/null || true | ||
|
||
cp "$bin_path" "$TAR_DIR" | ||
|
||
cd "$TAR_DIR" | ||
tar -czf cocogitto.tar.gz * | ||
|
||
} | ||
|
||
cmd="$1" | ||
shift | ||
|
||
release "$@" |