From 2cff0fea48a70bbe75967b6d5225554297ea5354 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Tue, 3 Sep 2024 04:54:46 -0300 Subject: [PATCH] test: Add CI workflows --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ .github/workflows/coverage.yml | 30 ++++++++++++++++++++++++++++++ Hacefile.yml | 2 +- spec/tartrazine_spec.cr | 1 + 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..614f819 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +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: + push: +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 + run: | + wget https://github.com/alecthomas/chroma/releases/download/v2.14.0/chroma-2.14.0-linux-amd64.tar.gz + tar xzvf chroma-2.14.0*gz + mkdir ~/.local/bin -p + sudo mv chroma ~/.local/bin + shards install + crystal tool format --check + crystal spec -v diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..3b033fa --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,30 @@ +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 + wget https://github.com/alecthomas/chroma/releases/download/v2.14.0/chroma-2.14.0-linux-amd64.tar.gz + tar xzvf chroma-2.14.0*gz + mkdir ~/.local/bin -p + sudo mv chroma ~/.local/bin + shards install + crystal build src/run_tests.cr + kcov --clean --include-path=./src $PWD/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 }} diff --git a/Hacefile.yml b/Hacefile.yml index 462702d..3598d41 100644 --- a/Hacefile.yml +++ b/Hacefile.yml @@ -35,7 +35,7 @@ tasks: phony: true always_run: true dependencies: - - bin/hace + - bin/tartrazine commands: | rm ${HOME}/.local/bin/{{NAME}} cp bin/hace ${HOME}/.local/bin/{{NAME}} diff --git a/spec/tartrazine_spec.cr b/spec/tartrazine_spec.cr index 652f652..f768a9b 100644 --- a/spec/tartrazine_spec.cr +++ b/spec/tartrazine_spec.cr @@ -28,6 +28,7 @@ bad_in_chroma = { "#{__DIR__}/tests/octave/test_multilinecomment.txt", "#{__DIR__}/tests/php/test_string_escaping_run.txt", "#{__DIR__}/tests/python_2/test_cls_builtin.txt", + "#{__DIR__}/tests/bqn/test_syntax_roles.txt", # This one only fails in CI } known_bad = {