Skip to content

Commit

Permalink
Refactor (#29)
Browse files Browse the repository at this point in the history
* Giant refactor of everything
* Replace slog with fern

Due to the changes to how errors are reported
and just the general user facing aspect of this tool, it doesn't really make sense to
have structured logging for cargo-deny

* Update ban check

Follows similar reporting to the license check

* Remove non-required licenses
* Add CHANGELOG
* Add 01_allow_license
* Add 02_deny_license
* Update to spdx 0.2.0
* Add hide-inclusion-graph option
* Add help for why a license is accepted
* Nuke travis
* Replace mergify with github action
* Add publish check
  • Loading branch information
Jake-Shadle authored Oct 6, 2019
1 parent ba8dca8 commit ac7a86e
Show file tree
Hide file tree
Showing 32 changed files with 2,826 additions and 2,321 deletions.
7 changes: 0 additions & 7 deletions .ci/checksum.ps1

This file was deleted.

14 changes: 0 additions & 14 deletions .ci/install_musl.sh

This file was deleted.

30 changes: 0 additions & 30 deletions .ci/lint.sh

This file was deleted.

55 changes: 0 additions & 55 deletions .ci/prep_deploy.sh

This file was deleted.

47 changes: 0 additions & 47 deletions .ci/test.sh

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: automerge
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted
status: {}
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/automerge-action@v0.3.2"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_METHOD: "squash"
LABELS: "!work-in-progress"
196 changes: 196 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
on: [push, pull_request]
name: CI
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

# make sure all code has been formatted with rustfmt
- run: rustup component add rustfmt
- name: check rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check --color always

# run clippy to verify we have no warnings
- run: rustup component add clippy
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --lib --tests -- -D warnings

test:
name: Test
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo test build
uses: actions-rs/cargo@v1
with:
command: build
args: --tests
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test

self:
name: Self Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo install
uses: actions-rs/cargo@v1
with:
command: install
# Install in debug mode since this part is sloooooow and
# release doesn't really matter much for runtime
args: --path . --debug
- name: self check
uses: actions-rs/cargo@v1
with:
command: deny
args: -L debug check

publish-check:
name: Publish Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --dry-run

publish:
name: Publish
needs: [test, self, publish-check]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo publish
uses: actions-rs/cargo@v1
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
with:
command: publish

release:
name: Release
needs: [test, self]
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
include:
- os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
bin: cargo-deny
- os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
bin: cargo-deny.exe
- os: macOS-latest
rust: stable
target: x86_64-apple-darwin
bin: cargo-deny
runs-on: ${{ matrix.os }}
steps:
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
target: ${{ matrix.target }}
- name: Install musl tools
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y musl-tools
- name: Checkout
uses: actions/checkout@v1
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
args: --target ${{ matrix.target }}
- name: Release build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
name=cargo_deny
tag=$(git describe --tags --abbrev=0)
release_name="$name-$tag-${{ matrix.target }}"
mkdir "$release_name"
if [ "${{ matrix.target }}" != "x86_64-pc-windows-msvc" ]; then
strip "target/${{ matrix.target }}/release/$name"
fi
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "$release_name/"
cp README.md LICENSE-APACHE LICENSE-MIT "$release_name/"
tar czvf "$release_name.tar.gz" "$release_name"
rm -r "$release_name"
echo -n "$(shasum -ba 256 "$release_name.tar.gz" | cut -d " " -f 1)" > "$release_name.tar.gz.sha256"
- name: Publish
uses: softprops/action-gh-release@v1
with:
draft: true
files: 'cargo-deny*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit ac7a86e

Please sign in to comment.