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

feat: Add github actions for both templates #27

Merged
merged 4 commits into from
Dec 24, 2023
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
32 changes: 0 additions & 32 deletions .github/workflows/build.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build Template
on:
push:
branches:
- main
pull_request:

jobs:
build-simple:
runs-on: ubuntu-latest
env:
PROJECT_NAME: ratatui-github-example
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run cargo generate
uses: cargo-generate/[email protected]
with:
name: ${{ env.PROJECT_NAME }}
template: simple
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cargo check
# we need to move the generated project to a temp folder, away from the template project
# otherwise `cargo` runs would fail
# see https://github.com/rust-lang/cargo/issues/9922
run: |
mv $PROJECT_NAME ${{ runner.temp }}/
cd ${{ runner.temp }}/$PROJECT_NAME
cargo check --tests

build-async:
runs-on: ubuntu-latest
env:
PROJECT_NAME: ratatui-github-example
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run cargo generate
uses: cargo-generate/[email protected]
with:
name: ${{ env.PROJECT_NAME }}
template: async
template_values_file: .github/workflows/template.toml
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cargo check
# we need to move the generated project to a temp folder, away from the template project
# otherwise `cargo` runs would fail
# see https://github.com/rust-lang/cargo/issues/9922
run: |
mv $PROJECT_NAME ${{ runner.temp }}/
cd ${{ runner.temp }}/$PROJECT_NAME
cargo check --tests
7 changes: 7 additions & 0 deletions .github/workflows/template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[values]
gh-username = "ratatui"
project-description = "Example of ratatui template"
msrv = "nightly"
use_gitserver = false
crossterm_io = "stderr"
use_rustfmt = false
2 changes: 1 addition & 1 deletion async/template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# {{project-name}}

[![CI](https://github.com/{{gh-username}}/{{project-name}}/workflows/CI/badge.svg)](https://github.com/{{gh-username}}/{{project-name}}/actions)
[![CI](https://github.com/{{gs-username}}/{{project-name}}/workflows/CI/badge.svg)](https://github.com/{{gs-username}}/{{project-name}}/actions)

{{project-description}}
2 changes: 1 addition & 1 deletion async/template/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ macro_rules! trace_dbg {
pub fn version() -> String {
let author = clap::crate_authors!();

let commit_hash = GIT_COMMIT_HASH.clone();
let commit_hash = GIT_COMMIT_HASH;

// let current_exe_path = PathBuf::from(clap::crate_name!()).display().to_string();
let config_dir_path = get_config_dir().display().to_string();
Expand Down