Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create workspace and add CI #1

Merged
merged 2 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: CI

on:
push:
branches:
- master
pull_request:
release:
types: [published]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}

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

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

# Build caching action
- uses: Swatinem/rust-cache@v1

- name: Install rustfmt
run: rustup component add rustfmt

- name: Install Cargo.toml linter
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-toml-lint
version: "0.1"

- name: Run Cargo.toml linter
run: git ls-files | grep Cargo.toml$ | xargs --verbose -n 1 cargo-toml-lint

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --verbose -- --check

- name: Check build
uses: actions-rs/cargo@v1
with:
command: check
args: --verbose --all-targets

- name: Check Clippy Lints
uses: actions-rs/cargo@v1
with:
command: clippy
args: --verbose --all-targets

- name: Run tests (default features)
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --all-targets

- name: Run tests (no default features)
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --all-targets --no-default-features

- name: Notify if Job Fails
uses: ravsamhq/notify-slack-action@v1
if: always() && github.ref == 'refs/heads/master'
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: '{workflow} has {status_message}'
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>'
footer: ''
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}

publish:
# Only do this job if publishing a release
needs: build
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest

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

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Verify tag version
run: |
curl -sSLf "$(curl -sSLf https://github.com/gitapi/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | cut -d\" -f 4)" -L -o dasel && chmod +x dasel
mv ./dasel /usr/local/bin/dasel
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} derive/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} indexer/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} lib/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} schema/Cargo.toml


- name: Publish crate
uses: katyo/publish-crates@v1
with:
publish-delay: 30000
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- name: Notify if Job Fails
uses: ravsamhq/notify-slack-action@v1
if: always()
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: '{workflow} has {status_message}'
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>'
footer: ''
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
14 changes: 14 additions & 0 deletions .github/workflows/nightly-cargo-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Nightly Cargo Audit

on:
schedule:
- cron: '0 0 * * *'

jobs:
cargo_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/target
Loading