ci back
This commit is contained in:
parent
f4ee184734
commit
4c51adb903
3 changed files with 106 additions and 15 deletions
33
.github/workflows/ci.yaml
vendored
Normal file
33
.github/workflows/ci.yaml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
binary: rust-template
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: olegtarasov/get-tag@v2.1.2
|
||||||
|
id: get_version
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
|
with:
|
||||||
|
targets: x86_64-unknown-linux-gnu
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cargo build --release --target x86_64-unknown-linux-gnu
|
||||||
|
- name: Upload binaries to release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: target/x86_64-unknown-linux-gnu/release/${{ env.binary }}
|
||||||
|
asset_name: ${{ env.binary }}
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
overwrite: true
|
58
.github/workflows/release.yaml
vendored
Normal file
58
.github/workflows/release.yaml
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
- 'feat/*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
- 'feat/*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
{%- if ci-tests %}
|
||||||
|
test:
|
||||||
|
name: Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@nightly
|
||||||
|
- name: Run cargo test
|
||||||
|
run: cargo test
|
||||||
|
{%- endif %}
|
||||||
|
{% if ci-clippy %}
|
||||||
|
clippy_check:
|
||||||
|
name: Clippy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@nightly
|
||||||
|
with:
|
||||||
|
components: clippy
|
||||||
|
- name: Run clippy
|
||||||
|
run: cargo clippy -- -D warnings
|
||||||
|
{%- endif %}
|
||||||
|
{% if ci-fmt %}
|
||||||
|
format:
|
||||||
|
name: Format
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@nightly
|
||||||
|
with:
|
||||||
|
components: rustfmt
|
||||||
|
- name: Run cargo fmt
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
{%- endif -%}
|
|
@ -46,18 +46,18 @@ ignore = ["src/main.rs"]
|
||||||
[conditional.'crate_type == "bin"']
|
[conditional.'crate_type == "bin"']
|
||||||
ignore = ["src/lib.rs"]
|
ignore = ["src/lib.rs"]
|
||||||
|
|
||||||
# [placeholders]
|
[placeholders]
|
||||||
# ci-release = { type = "bool", prompt = "CI release?", default = true }
|
ci-release = { type = "bool", prompt = "CI release?", default = true }
|
||||||
# ci = { type = "bool", prompt = "CI?", default = true }
|
ci = { type = "bool", prompt = "CI?", default = true }
|
||||||
#
|
|
||||||
# [conditional.'ci == false']
|
[conditional.'ci == false']
|
||||||
# ignore = [".github/workflows/ci.yaml"]
|
ignore = [".github/workflows/ci.yaml"]
|
||||||
#
|
|
||||||
# [conditional.'ci == true'.placeholders]
|
[conditional.'ci == true'.placeholders]
|
||||||
# ci-tests = { type = "bool", prompt = "CI tests?", default = true }
|
ci-tests = { type = "bool", prompt = "CI tests?", default = true }
|
||||||
# ci-fmt = { type = "bool", prompt = "CI fmt?", default = true }
|
ci-fmt = { type = "bool", prompt = "CI fmt?", default = true }
|
||||||
# ci-clippy = { type = "bool", prompt = "CI clippy?", default = true }
|
ci-clippy = { type = "bool", prompt = "CI clippy?", default = true }
|
||||||
#
|
|
||||||
# [conditional.'ci-release == false']
|
[conditional.'ci-release == false']
|
||||||
# ignore = [".github/workflows/release.yaml"]
|
ignore = [".github/workflows/release.yaml"]
|
||||||
#
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue