Skip to content

Commit

Permalink
feat: Add Release workflow (#6)
Browse files Browse the repository at this point in the history
* chore: Rename rust-toolchain to rust-toolchain.toml

* chore: Rename rust.yml to ci.yml

* chore: Remove deprecated actions in ci.yml

* feat: Add .editorconfig

* feat: Add Release workflow

* fix: Typo in ci.yml
  • Loading branch information
fuzzypixelz authored Feb 29, 2024
1 parent 6831401 commit e982c95
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 25 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
40 changes: 16 additions & 24 deletions .github/workflows/rust.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,38 @@
# ZettaScale Zenoh Team, <[email protected]>
#


name: CI

on:
push:
branches: [ '**' ]
branches: ["**"]
pull_request:
branches: [ '**' ]
branches: ["**"]
schedule:
- cron: '0 0 * * 1-5'
- cron: "0 0 * * 1-5"
workflow_call:

jobs:
checks:
name: Code checks
runs-on: [self-hosted, ubuntu-22.04]
steps:
- uses: actions/checkout@v2
- name: Clone this repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
components: rustfmt, clippy
run: rustup component add rustfmt clippy

- name: Code format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
run: cargo fmt --check

- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets -- -D warnings
run: cargo clippy --all-targets --all-features -- --deny warnings

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-targets
run: cargo build --release --all-targets

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --release --verbose
run: cargo test --release --verbose
env:
ASYNC_STD_THREAD_COUNT: 4
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release

on:
workflow_dispatch:
inputs:
dry-run:
description: Perform a dry-run of the release, without any side-effects
type: boolean
required: true
version:
description: >
Release version. Can be left unspecified if `dry-run = true`,
in which case the workflow will generate it using `git describe`.
type: string
required: false

env:
ACTOR_NAME: zettascale-bot
ACTOR_EMAIL: [email protected]

jobs:
ci:
uses: ./.github/workflows/ci.yml@main

tag:
runs-on: [self-hosted, ubuntu-20.04]
needs: ci
outputs:
branch: ${{ steps.tag.outputs.branch }}
version: ${{ steps.tag.outputs.version }}
steps:
- id: tag
uses: ZettaScaleLabs/ci/tag-crates@develop
with:
repo: ${{ github.repository }}
dry-run: ${{ inputs.dry-run }}
github-token: ${{ secrets.ZETTASCALE_BOT_PERSONAL_ACCESS_TOKEN }}
actor-name: ${{ env.ACTOR_NAME }}
actor-email: ${{ env.ACTOR_EMAIL }}
inter-deps-pattern: ^$

publish-cargo:
runs-on: [self-hosted, ubuntu-20.04]
needs: tag
steps:
- uses: ZettaScaleLabs/ci/publish-crates-cargo@develop
with:
repos: ${{ github.repository }}
branch: ${{ needs.tag.outputs.branch }}
dry-run: ${{ inputs.dry-run }}
github-token: ${{ secrets.ZETTASCALE_BOT_PERSONAL_ACCESS_TOKEN }}
crates-io-token: ${{ secrets.ZETTASCALE_CRATES_IO_TOKEN }}
inter-deps-pattern: ^$

publish-github:
runs-on: [self-hosted, ubuntu-20.04]
needs: tag
steps:
- if: ${{ !inputs.dry-run }}
run: >
gh release create ${{ needs.tag.outputs.version }}
--target ${{ needs.tag.outputs.branch }}
--latest
--generate-notes
env:
GH_TOKEN: ${{ secrets.ZETTASCALE_BOT_PERSONAL_ACCESS_TOKEN }}
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "stable"

0 comments on commit e982c95

Please sign in to comment.