mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-08 04:30:26 -03:00
Compare commits
7 Commits
8eb8b8cb48
...
411c969cc4
Author | SHA1 | Date | |
---|---|---|---|
411c969cc4 | |||
36bf784e35 | |||
396a806b50 | |||
0f31534468 | |||
db95abf31c | |||
9136ff9768 | |||
9a2ebc6c12 |
22
.github/workflows/ci.yml
vendored
Normal file
22
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
name: Tests
|
||||||
|
on:
|
||||||
|
# This can't yet run automatically, because tests fail because of
|
||||||
|
# different versions of chroma. Need to get the same one in my
|
||||||
|
# local env and in CI
|
||||||
|
workflow_dispatch:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Download source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install Crystal
|
||||||
|
uses: crystal-lang/install-crystal@v1
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
sudo apt-get update && sudo apt-get install golang-chroma -y
|
||||||
|
shards install
|
||||||
|
crystal tool format --check
|
||||||
|
crystal spec -v
|
26
.github/workflows/coverage.yml
vendored
Normal file
26
.github/workflows/coverage.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
name: Coverage
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 1 * * *"
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Install Crystal
|
||||||
|
uses: crystal-lang/install-crystal@v1
|
||||||
|
- name: Run tests using kcov
|
||||||
|
run: |
|
||||||
|
sudo apt update && sudo apt install kcov
|
||||||
|
shards install
|
||||||
|
crystal build src/run_tests.cr
|
||||||
|
kcov --clean --include-path=./src coverage ./run_tests
|
||||||
|
curl -Os https://uploader.codecov.io/latest/linux/codecov
|
||||||
|
chmod +x codecov
|
||||||
|
./codecov -t ${CODECOV_TOKEN} -s coverage
|
||||||
|
env:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
@ -35,7 +35,7 @@ tasks:
|
|||||||
phony: true
|
phony: true
|
||||||
always_run: true
|
always_run: true
|
||||||
dependencies:
|
dependencies:
|
||||||
- bin/hace
|
- bin/tartrazine
|
||||||
commands: |
|
commands: |
|
||||||
rm ${HOME}/.local/bin/{{name}}
|
rm ${HOME}/.local/bin/{{name}}
|
||||||
cp bin/hace ${HOME}/.local/bin/{{name}}
|
cp bin/hace ${HOME}/.local/bin/{{name}}
|
||||||
|
@ -73,7 +73,7 @@ end
|
|||||||
# Helper that creates lexer and tokenizes
|
# Helper that creates lexer and tokenizes
|
||||||
def tokenize(lexer_name, text)
|
def tokenize(lexer_name, text)
|
||||||
tokenizer = Tartrazine.lexer(lexer_name).tokenizer(text)
|
tokenizer = Tartrazine.lexer(lexer_name).tokenizer(text)
|
||||||
Tartrazine::Lexer.collapse_tokens(tokenizer.to_a)
|
Tartrazine::RegexLexer.collapse_tokens(tokenizer.to_a)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Helper that tokenizes using chroma to validate the lexer
|
# Helper that tokenizes using chroma to validate the lexer
|
||||||
@ -85,5 +85,5 @@ def chroma_tokenize(lexer_name, text)
|
|||||||
["-f", "json", "-l", lexer_name],
|
["-f", "json", "-l", lexer_name],
|
||||||
input: input, output: output
|
input: input, output: output
|
||||||
)
|
)
|
||||||
Tartrazine::Lexer.collapse_tokens(Array(Tartrazine::Token).from_json(output.to_s))
|
Tartrazine::RegexLexer.collapse_tokens(Array(Tartrazine::Token).from_json(output.to_s))
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user