-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
What? ===== This is an initial release of the CLI tool, `complexity`.
- Loading branch information
1 parent
030473c
commit ccc769e
Showing
15 changed files
with
647 additions
and
26 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,19 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --all --verbose | ||
- name: Verify formatting | ||
run: cargo fmt -- --check |
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,12 @@ | ||
name: Security audit | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
jobs: | ||
audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/audit-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,149 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
- '[0-9]+.[0-9]+.[0-9]+.alpha' | ||
- '[0-9]+.[0-9]+.[0-9]+.beta' | ||
- '[0-9]+.[0-9]+.[0-9]+.rc' | ||
jobs: | ||
create-release: | ||
name: create-release | ||
runs-on: ubuntu-latest | ||
# env: | ||
# Set to force version number, e.g., when no tag exists. | ||
# COMPLEXITY_VERSION: TEST-0.0.0 | ||
steps: | ||
- name: Create artifacts directory | ||
run: mkdir artifacts | ||
|
||
- name: Get the release version from the tag | ||
if: env.COMPLEXITY_VERSION == '' | ||
run: | | ||
# Apparently, this is the right way to get a tag name. Really? | ||
# | ||
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 | ||
echo "::set-env name=COMPLEXITY_VERSION::${GITHUB_REF#refs/tags/}" | ||
echo "version is: ${{ env.COMPLEXITY_VERSION }}" | ||
- name: Create GitHub release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.COMPLEXITY_VERSION }} | ||
release_name: ${{ env.COMPLEXITY_VERSION }} | ||
|
||
- name: Save release upload URL to artifact | ||
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url | ||
|
||
- name: Save version number to artifact | ||
run: echo "${{ env.COMPLEXITY_VERSION }}" > artifacts/release-version | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
build-release: | ||
name: build-release | ||
needs: ['create-release'] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
# For some builds, we use cross to test on 32-bit and big-endian | ||
# systems. | ||
CARGO: cargo | ||
# When CARGO is set to CROSS, this is set to `--target matrix.target`. | ||
TARGET_FLAGS: | ||
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target. | ||
TARGET_DIR: ./target | ||
# Emit backtraces on panics. | ||
RUST_BACKTRACE: 1 | ||
strategy: | ||
matrix: | ||
build: [linux, macos] | ||
include: | ||
- build: linux | ||
os: ubuntu-18.04 | ||
rust: stable | ||
target: x86_64-unknown-linux-musl | ||
- build: macos | ||
os: macos-latest | ||
rust: stable | ||
target: x86_64-apple-darwin | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
target: ${{ matrix.target }} | ||
|
||
- name: Use Cross | ||
run: | | ||
# FIXME: to work around bugs in latest cross release, install master. | ||
# See: https://github.com/rust-embedded/cross/issues/357 | ||
cargo install --git https://github.com/rust-embedded/cross | ||
echo "::set-env name=CARGO::cross" | ||
echo "::set-env name=TARGET_FLAGS::--target ${{ matrix.target }}" | ||
echo "::set-env name=TARGET_DIR::./target/${{ matrix.target }}" | ||
- name: Show command used for Cargo | ||
run: | | ||
echo "cargo command is: ${{ env.CARGO }}" | ||
echo "target flag is: ${{ env.TARGET_FLAGS }}" | ||
echo "target dir is: ${{ env.TARGET_DIR }}" | ||
- name: Get release download URL | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
- name: Set release upload URL and release version | ||
shell: bash | ||
run: | | ||
release_upload_url="$(cat artifacts/release-upload-url)" | ||
echo "::set-env name=RELEASE_UPLOAD_URL::$release_upload_url" | ||
echo "release upload url: $RELEASE_UPLOAD_URL" | ||
release_version="$(cat artifacts/release-version)" | ||
echo "::set-env name=RELEASE_VERSION::$release_version" | ||
echo "release version: $RELEASE_VERSION" | ||
- name: Build release binary | ||
run: ${{ env.CARGO }} build --verbose --release --bin complexity ${{ env.TARGET_FLAGS }} | ||
|
||
- name: Strip release binary (Linux and macOS) | ||
if: matrix.build == 'linux' || matrix.build == 'macos' | ||
run: strip "target/${{ matrix.target }}/release/complexity" | ||
|
||
- name: Build archive | ||
shell: bash | ||
run: | | ||
staging="complexity-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" | ||
mkdir -p "$staging" | ||
cp {README.md,LICENSE} "$staging/" | ||
cp "target/${{ matrix.target }}/release/complexity" "$staging/" | ||
tar czf "$staging.tar.gz" "$staging" | ||
echo "::set-env name=ASSET::$staging.tar.gz" | ||
- name: Upload release archive | ||
uses: actions/upload-release-asset@v1.0.1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream |
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 +1,2 @@ | ||
/target | ||
tmp |
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,6 @@ | ||
# Code of Conduct | ||
|
||
By participating in this project, you agree to abide by the | ||
[thoughtbot code of conduct][1]. | ||
|
||
[1]: https://thoughtbot.com/open-source-code-of-conduct |
Oops, something went wrong.