From e932f9a0cec0c3e6be0904cb326e270e36504a3b Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Tue, 18 Apr 2023 19:57:52 +0100 Subject: [PATCH] ci: move to the dockerhub conventional-tools update --- .github/workflows/ci.yml | 14 -------------- .github/workflows/ct-commitlint.yml | 21 +++++++++++++++++++++ lua/ivy/libivy_test.lua | 15 ++++++++++++--- 3 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/ct-commitlint.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a49d0b..e70053e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,20 +5,6 @@ on: pull_request: { branches: ["0.x"] } jobs: - commits: - name: Commitlint - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 1000 - - - name: Lint commits - uses: docker://registry.k1.zportal.co.uk/practically-oss/conventional-tools:0.x - with: - args: conventional-tools commitlint -l1 -f39febd82e236a9c79f5b408e98cbd20410f11e9e - luacheck: name: Luacheck runs-on: ubuntu-latest diff --git a/.github/workflows/ct-commitlint.yml b/.github/workflows/ct-commitlint.yml new file mode 100644 index 0000000..f62f45c --- /dev/null +++ b/.github/workflows/ct-commitlint.yml @@ -0,0 +1,21 @@ +name: Conventional Tools Commitlint + +on: + push: { branches: ["0.x"] } + pull_request: { branches: ["0.x"] } + +jobs: + commits: + name: Commitlint + runs-on: ubuntu-latest + container: practically/conventional-tools:1.x@sha256:e0603c12e8b4b835c9fcceaa4ddad4077ccf223665c0180db91511e2ce168670 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: {fetch-depth: 1000} + + - name: Git safe.directory + run: git config --global --add safe.directory $PWD + + - name: Lint commits + run: conventional-tools commitlint -l1 -f39febd82e236a9c79f5b408e98cbd20410f11e9e diff --git a/lua/ivy/libivy_test.lua b/lua/ivy/libivy_test.lua index 4f4426f..c7fe89b 100644 --- a/lua/ivy/libivy_test.lua +++ b/lua/ivy/libivy_test.lua @@ -10,9 +10,18 @@ end) it("should find a dot file", function(t) local current_dir = libivy.ivy_cwd() - local matches = libivy.ivy_files("ci.yml", current_dir) + local matches = libivy.ivy_files(".github/workflows/ci.yml", current_dir) - if matches ~= ".github/workflows/ci.yml\n" then - t.error("Invalid matches: " .. matches) + local results = {} + for line in string.gmatch(matches, "[^\r\n]+") do + table.insert(results, line) + end + + if #results ~= 2 then + t.error "Incorrect number of results" + end + + if results[2] ~= ".github/workflows/ci.yml" then + t.error("Invalid matches: " .. results[2]) end end)