Skip to content

Commit

Permalink
ci(rustfmt, clippy): fix them
Browse files Browse the repository at this point in the history
  • Loading branch information
wizard-28 committed Mar 31, 2023
1 parent 7b19e01 commit b12317c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 31 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: CI # Continuous Integration

on:
workflow_dispatch:
push:
branches: [ master ]
branches: [master]
pull_request:

jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create blank versions of configured file
run: echo -e "" >> src/config.rs
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
Expand All @@ -27,7 +27,6 @@ jobs:
toolchain: nightly
command: fmt
args: --all -- --check

spellcheck:
name: Spellcheck
runs-on: ubuntu-latest
Expand All @@ -40,13 +39,21 @@ jobs:
builtin: clear,rare,informal,code
ignore_words_file: .codespellignore
skip: "*.po,./.git"

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v1
- name: Install meson
run: pip install meson ninja
- name: Install dependencies
run: sudo apt-get install libgtk-4-dev libadwaita-1-dev
- name: Setup project
# Disable dependency checks
run: meson setup -D profile=CI build/
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
Expand All @@ -60,7 +67,6 @@ jobs:
with:
command: clippy
args: --all-targets --all-features --workspace -- -D warnings -D clippy::pedantic

docs:
name: Docs
runs-on: ubuntu-latest
Expand Down
18 changes: 11 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ iconsdir = datadir / 'icons'
podir = meson.project_source_root() / 'po'
gettext_package = meson.project_name()

if get_option('profile') == 'development'
if get_option('profile') == 'development' or get_option('profile') == 'CI'
profile = 'Devel'
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
if vcs_tag == ''
Expand All @@ -49,12 +49,16 @@ else
application_id = base_id
endif

subdir('data')
if get_option('profile') != 'CI'
subdir('data')
endif
subdir('po')
subdir('src')

gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true,
)
if get_option('profile') != 'CI'
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true,
)
endif
5 changes: 3 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ option(
type: 'combo',
choices: [
'default',
'development'
'development',
'CI'
],
value: 'default',
description: 'The build profile for Rhino Setup. One of "default" or "development".'
description: 'The build profile for Rhino Setup. One of "default", "development" or "CI".'
)
34 changes: 18 additions & 16 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ else
message('Building in debug mode')
endif

cargo_build = custom_target(
'cargo-build',
build_by_default: true,
build_always_stale: true,
output: meson.project_name(),
console: true,
install: true,
install_dir: bindir,
depends: resources,
command: [
cargo, 'build',
cargo_options,
'&&',
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
]
)
if get_option('profile') != 'CI'
cargo_build = custom_target(
'cargo-build',
build_by_default: true,
build_always_stale: true,
output: meson.project_name(),
console: true,
install: true,
install_dir: bindir,
depends: resources,
command: [
cargo, 'build',
cargo_options,
'&&',
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
]
)
endif

0 comments on commit b12317c

Please sign in to comment.