Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
feat: Add proper CI with auto-publish (#18)
Browse files Browse the repository at this point in the history
* feat: Add proper CI with auto-publish

* chore: Trigger circleCI

* feat: Set rust toolchain to use

* chore: Rename rust-toolchain.toml -> rust-toolchain

* fix: Don't trigger release-please in monorepo mode

* chore: Remove sccache for now
  • Loading branch information
NeoLegends committed Mar 12, 2021
1 parent a8ae63c commit 4688f53
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 15 deletions.
46 changes: 46 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 2.1

workflows:
version: 2
rust:
jobs:
- lint:
context: [shared-secrets]
- test:
context: [shared-secrets]

jobs:
lint:
description: Run lints
executor: rust/medium
steps:
- checkout
- run:
name: Check formatting
command: cargo fmt -- --check
- run:
name: Lint with clippy
environment:
RUSTFLAGS: -Dwarnings
command: cargo clippy --all-features -- -D warnings

test:
description: Run unit tests
executor: rust/medium
steps:
- checkout
- run:
name: Run unit tests
command: cargo test --all-features

orbs:
rust:
executors:
medium:
description: "Rust Executor"
docker:
- image: gcr.io/netlify-services/circleci-rust:main
auth:
username: _json_key
password: $GCLOUD_SERVICE_KEY
resource_class: medium
38 changes: 38 additions & 0 deletions .github/workflows/pr-conventions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PR conventions
on:
pull_request:
types:
- opened
- edited
- synchronize

jobs:
label-pr:
name: Auto-label PR
runs-on: ubuntu-latest
steps:
- uses: netlify/pr-labeler-action@v1.0.0
if: startsWith(github.event.pull_request.title, 'fix')
with:
token: "${{ secrets.GITHUB_TOKEN }}"
label: "type: bug"
- uses: netlify/pr-labeler-action@v1.0.0
if: startsWith(github.event.pull_request.title, 'chore')
with:
token: "${{ secrets.GITHUB_TOKEN }}"
label: "type: chore"
- uses: netlify/pr-labeler-action@v1.0.0
if: startsWith(github.event.pull_request.title, 'feat')
with:
token: "${{ secrets.GITHUB_TOKEN }}"
label: "type: feature"

lint:
name: Lint PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v3.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: true
23 changes: 23 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches: [main]

name: Release Please

jobs:
crates:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v2
id: release
with:
token: ${{ secrets.PKG_RELEASE_TOKEN }}
release-type: rust
package-name: netlify_toml

- uses: actions/checkout@v2
if: ${{ steps.release.outputs.release_created }}

- name: Publish crate
if: ${{ steps.release.outputs.release_created }}
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
types: [edited]
schedule:
# every hour
- cron: 0 * * * *

name: Renovate

jobs:
check_dependencies:
name: Check dependencies
runs-on: ubuntu-20.04
if: |
(github.event_name != 'pull_request') || startsWith(github.head_ref, 'renovate/')
steps:
- uses: actions/checkout@v2

- name: Renovate repository
uses: netlify/renovate-cli-action@v1
with:
github-token: ${{ secrets.PKG_RELEASE_TOKEN }}
git-author: "Renovate Bot <statusbot@netlify.com>"
15 changes: 0 additions & 15 deletions .github/workflows/rust.yml

This file was deleted.

4 changes: 4 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>netlify/renovate-rust-preset"]
}
4 changes: 4 additions & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
channel = "1.50.0"
components = [ "rustfmt", "clippy" ]
targets = [ "x86_64-unknown-linux-gnu" ]

0 comments on commit 4688f53

Please sign in to comment.