From ecb9919e02383c1e6db4f29eb94ad8c000723fad Mon Sep 17 00:00:00 2001 From: Oleksandr Smirnov Date: Mon, 17 Feb 2025 15:51:28 +0200 Subject: [PATCH] chore(ci): it should stop ci from running the same action twice add basic test to check ci chore(ci): hopefully adds cache for tests --- .github/workflows/linters.yml | 8 +++++++- .github/workflows/tests.yml | 14 +++++++++++++- spec/integration/struct_tags_test.lua | 9 +++++++++ spec/testutils.lua | 18 ++++++++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 spec/integration/struct_tags_test.lua create mode 100644 spec/testutils.lua diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index a78c3c3..389b72f 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -1,5 +1,11 @@ name: linters -on: [push, pull_request] + +on: + push: + branches: + - main + - develop + pull_request: jobs: linters: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 74a9d11..856e0f4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,5 +1,11 @@ name: tests -on: [push, pull_request] + +on: + push: + branches: + - main + - develop + pull_request: jobs: tests: @@ -19,6 +25,12 @@ jobs: - uses: actions/checkout@v3 + - name: Cache .tests + uses: actions/cache@v4 + with: + path: .tests + key: ${{ runner.os }}-tests-${{ hashFiles('.tests') }} + - name: Install NeoVim uses: rhysd/action-setup-vim@v1 with: diff --git a/spec/integration/struct_tags_test.lua b/spec/integration/struct_tags_test.lua new file mode 100644 index 0000000..9d09971 --- /dev/null +++ b/spec/integration/struct_tags_test.lua @@ -0,0 +1,9 @@ +local t = require "spec.testutils" + +local T = MiniTest.new_set {} +T["struct_tags"] = MiniTest.new_set {} +T["struct_tags"]["fuck it"] = function() + t.eq(1, 1) +end + +return T diff --git a/spec/testutils.lua b/spec/testutils.lua new file mode 100644 index 0000000..e931820 --- /dev/null +++ b/spec/testutils.lua @@ -0,0 +1,18 @@ +-- NOTE: there's a probably a better way to do this +local fixtures_dir = (vim.fn.expand "%:p:h") .. "/spec/fixtures/" + +---@class gopher.TestUtils +local testutils = {} + +---@generic T +---@param a T +---@param b T +---@return boolean +function testutils.eq(a, b) + return MiniTest.expect.equality(a, b) +end + +-- TODO: continue with writing fixtures helpers +-- https://github.com/olexsmir/gopher.nvim/pull/71/files + +return testutils