Browse Source

Simple CI pipeline

David Peter 2 years ago
parent
commit
aec6e3a9fe
2 changed files with 32 additions and 1 deletions
  1. 25 0
      .github/workflows/ci.yml
  2. 7 1
      numbat-cli/src/main.rs

+ 25 - 0
.github/workflows/ci.yml

@@ -0,0 +1,25 @@
+name: CI
+
+on:
+  push:
+    branches: [ "master" ]
+    tags: [ "*" ]
+  pull_request:
+
+env:
+  CARGO_TERM_COLOR: always
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v3
+    - name: Check formatting
+      run: cargo fmt -- --check
+    - name: Build
+      run: cargo build --verbose
+    - name: Run tests
+      run: |
+        export NUMBAT_MODULES_PATH="$PWD/modules/"
+        cargo test --verbose

+ 7 - 1
numbat-cli/src/main.rs

@@ -406,7 +406,13 @@ impl Cli {
     }
 
     fn get_modules_paths() -> Vec<PathBuf> {
-        let mut paths = vec![Self::get_config_path().join("modules")];
+        let mut paths = vec![];
+
+        if let Some(path) = std::env::var_os("NUMBAT_MODULES_PATH") {
+            paths.push(path.into());
+        }
+
+        paths.push(Self::get_config_path().join("modules"));
         if cfg!(unix) {
             paths.push("/usr/share/numbat/modules".into());
         } else {