Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jfredett committed Jan 18, 2025
1 parent 2ae4fba commit 77c47d7
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 74 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,18 @@ jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.4']

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- uses: cachix/install-nix-action@v27
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Install just
uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6
nix_path: nixpkgs=channel:nixos-unstable

- name: Run tests
run: just test
run: |
nix run .#ci --impure
- name:
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@

test *ARGS:
bundle exec rspec spec {{ARGS}}

ci:
bundle install
bundle exec rspec spec/
33 changes: 33 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

141 changes: 97 additions & 44 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,50 +1,103 @@
{
description = "Tabitha, a tree-sitter based Rust Code Exploration and Diagramming Tool";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:cachix/devenv";
};


outputs = { self, nixpkgs, devenv, ... } @ inputs:
let
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems);
in
{
packages.x86_64-linux.devenv-up = self.devShells.x86_64-linux.default.config.procfileScript;
devShells = forAllSystems
(system: let
pkgs = import nixpkgs { inherit system; };
in {
default = devenv.lib.mkShell {
inherit inputs pkgs;
description = "Tabitha, a tree-sitter based Rust Code Exploration and Diagramming Tool";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:cachix/devenv";
};

outputs = { self, nixpkgs, devenv, flake-utils } @ inputs: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in {
packages.${system} = {
devenv-up = self.devShells.${system}.default.config.procfileScript;
ci = pkgs.writeShellApplication {
name = "ci";

runtimeInputs = with pkgs; [
ruby_3_4
just
bundler
];

text = /* bash */ ''
if [ -d .parsers ]; then
rm .parsers/*
else
mkdir -p .parsers
fi
ln -s "${pkgs.tree-sitter-grammars.tree-sitter-rust}/parser" .parsers/rust.so
ln -s "${pkgs.tree-sitter-grammars.tree-sitter-rust}/queries" .parsers/rust_queries
just ci
'';
};
};

devShells.${system}.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [{
languages.ruby = {
enable = true;
bundler.enable = true;
package = pkgs.ruby_3_4;
};

enterShell = /* bash */ ''
if [ -d .parsers ]; then
rm .parsers/*
else
mkdir -p .parsers
fi
ln -s "${pkgs.tree-sitter-grammars.tree-sitter-rust}/parser" .parsers/rust.so
ln -s "${pkgs.tree-sitter-grammars.tree-sitter-rust}/queries" .parsers/rust_queries
'';

packages = with pkgs; [
cloc
gnuplot
plantuml
just
];
languages.ruby = {
enable = true;
bundler.enable = true;
package = pkgs.ruby_3_4;
};

enterShell = /* bash */ ''
if [ -d .parsers ]; then
rm .parsers/*
else
mkdir -p .parsers
fi
ln -s "${pkgs.tree-sitter-grammars.tree-sitter-rust}/parser" .parsers/rust.so
ln -s "${pkgs.tree-sitter-grammars.tree-sitter-rust}/queries" .parsers/rust_queries
'';

packages = with pkgs; [
cloc
gnuplot
plantuml
just
];
}];
};
});
};
};
}
# outputs = { self, nixpkgs, devenv, ... } @ inputs: let
# systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems);
# in forAllSystems (system: let
# pkgs = import nixpkgs { inherit system; };
# in {
# packages.${system}.devenv-up = self.devShells.${system}.default.config.procfileScript;


# devShells.${system}.default = devenv.lib.mkShell {
# inherit inputs pkgs;

# modules = [{
# languages.ruby = {
# enable = true;
# bundler.enable = true;
# package = pkgs.ruby_3_4;
# };

# enterShell = /* bash */ ''
# if [ -d .parsers ]; then
# rm .parsers/*
# else
# mkdir -p .parsers
# fi
# ln -s "${pkgs.tree-sitter-grammars.tree-sitter-rust}/parser" .parsers/rust.so
# ln -s "${pkgs.tree-sitter-grammars.tree-sitter-rust}/queries" .parsers/rust_queries
# '';

# packages = with pkgs; [
# cloc
# gnuplot
# plantuml
# just
# ];
# }];
# };
# });
2 changes: 0 additions & 2 deletions lib/tabitha/engine/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class Entry
def content
return @content unless @content.nil?
@content ||= SourceTree.parse(File.read(@path))
rescue Exception => e
binding.pry
end

def query(code)
Expand Down
33 changes: 17 additions & 16 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
# frozen_string_literal: true

require 'simplecov'
require 'simplecov-cobertura'
require 'rspec/its'

require "tabitha"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"

SimpleCov.start
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.formatter = :progress

config.expect_with :rspec do |c|
c.syntax = :expect
end
end

require 'simplecov'
require 'simplecov-cobertura'

SimpleCov.start
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter


require "tabitha"

# Helper method to create a location
def loc(line, col)
Tabitha::Engine::Location.new(line: line, column: col)
Expand All @@ -22,15 +35,3 @@ def fixture(*path)
File.expand_path(File.join(FIXTURES_PATH, *path))
end

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"

# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.formatter = :progress

config.expect_with :rspec do |c|
c.syntax = :expect
end
end

0 comments on commit 77c47d7

Please sign in to comment.