From 07224fd62e0224bb943d98bb7149686af3a16225 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Thu, 21 Oct 2021 19:07:33 +0200 Subject: [PATCH 1/3] ci: add doc workflow GitHub Actions to build and deploy doc to gh-pages. --- .editorconfig | 2 +- .github/workflows/doc.yaml | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/doc.yaml diff --git a/.editorconfig b/.editorconfig index 5967019..98236fe 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,5 +11,5 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[*.json] +[*.{json,yaml}] indent_size = 2 diff --git a/.github/workflows/doc.yaml b/.github/workflows/doc.yaml new file mode 100644 index 0000000..36646b8 --- /dev/null +++ b/.github/workflows/doc.yaml @@ -0,0 +1,40 @@ +name: Build doc + +on: + push: + branches: [$default-branch] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +# Cancel the previous run if it's still in progress +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Generate docs with LDoc + uses: lunarmodules/ldoc@v1.5.0 + - name: Upload static files as artifact + id: deployment + uses: actions/upload-pages-artifact@v3 + with: + path: doc/ + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 96540e14ff6611d9486c0262c5e6e9b4b7695be5 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Thu, 21 Oct 2021 20:12:56 +0200 Subject: [PATCH 2/3] add(README) # Documentation --- .github/workflows/doc.yaml | 18 ++++++++---------- README.md | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/doc.yaml b/.github/workflows/doc.yaml index 36646b8..dfc738c 100644 --- a/.github/workflows/doc.yaml +++ b/.github/workflows/doc.yaml @@ -2,7 +2,8 @@ name: Build doc on: push: - branches: [$default-branch] + branches: + - $default-branch workflow_dispatch: permissions: @@ -10,7 +11,8 @@ permissions: pages: write id-token: write -# Cancel the previous run if it's still in progress +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false @@ -19,13 +21,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Generate docs with LDoc - uses: lunarmodules/ldoc@v1.5.0 - - name: Upload static files as artifact + - uses: actions/checkout@v4 + - uses: lunarmodules/ldoc@v1.5.0 + - uses: actions/upload-pages-artifact@v3 id: deployment - uses: actions/upload-pages-artifact@v3 with: path: doc/ deploy: @@ -35,6 +34,5 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - - name: Deploy to GitHub Pages + - uses: actions/deploy-pages@v4 id: deployment - uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 3a29472..62243fd 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,18 @@ A declarative API to connect signals for the AwesomeWM. It completes the native `gears.signal` module to make signal connection easier to manage. + +## Documentation + +API references for the latest release are available at . + +It is also possible to manually build the documentation locally using ldoc. The +documentation content is part of the source code, and all configurations needed +are provided by the `config.ld` file. To generate documentation, you need to +run : + +```sh +ldoc . +``` + +The documentation site will be generated in the `doc` directory. From 0f9ec52e4a14eeae8d81422af5ba07ca602711ea Mon Sep 17 00:00:00 2001 From: Aire-One Date: Thu, 24 Oct 2024 19:49:36 +0200 Subject: [PATCH 3/3] ci: add lint workflow --- .cspell.json | 18 +++++++++++++ .github/workflows/lint.yaml | 43 +++++++++++++++++++++++++++++++ src/awesome-slot/init.lua | 4 +-- src/awesome-slot/slots/client.lua | 10 +++---- src/awesome-slot/slots/init.lua | 14 +++++----- src/awesome-slot/slots/ruled.lua | 10 +++---- src/awesome-slot/slots/screen.lua | 14 +++++----- src/awesome-slot/slots/tag.lua | 6 ++--- 8 files changed, 84 insertions(+), 35 deletions(-) create mode 100644 .cspell.json create mode 100644 .github/workflows/lint.yaml diff --git a/.cspell.json b/.cspell.json new file mode 100644 index 0000000..350535a --- /dev/null +++ b/.cspell.json @@ -0,0 +1,18 @@ +{ + "words": [ + "Aire-One", + "capi", + "constructorfct", + "fatalwarnings", + "fullscreen", + "hasitem", + "JohnnyMorganz", + "ldoc", + "luacheck", + "luadoc", + "lunarmodules", + "mousebindings", + "staticfct", + "stylua" + ] +} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..435eccd --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,43 @@ +name: Lint + +on: + push: + branches: + - $default-branch + pull_request: + +jobs: + luacheck: + needs: [] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: lunarmodules/luacheck@v1 + + stylua: + needs: [] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: JohnnyMorganz/stylua-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: v0.20.0 + args: --check . + + ldoc: + needs: [] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: lunarmodules/ldoc@v1.5.0 + with: + args: --fatalwarnings . + + spellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: streetsidesoftware/cspell-action@v6 + with: + incremental_files_only: false diff --git a/src/awesome-slot/init.lua b/src/awesome-slot/init.lua index 793493d..134cc7a 100644 --- a/src/awesome-slot/init.lua +++ b/src/awesome-slot/init.lua @@ -108,7 +108,7 @@ end -- @tparam string params.signal The signal the slot connects to. -- @tparam function params.slot The callback function to connect to the signal. -- @tparam table params.slot_params The parameters to pass to the callback --- function. (The signal will invok the callback function with this table as +-- function. (The signal will invoke the callback function with this table as -- parameter) -- @tparam[opt=false] boolean params.connect Connect the slot now. -- @treturn Slot The created Slot instance. @@ -201,5 +201,3 @@ function awesome_slot.mt:__call(...) -- luacheck: ignore unused argument self end return setmetatable(awesome_slot, awesome_slot.mt) - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/src/awesome-slot/slots/client.lua b/src/awesome-slot/slots/client.lua index 3b0ef04..085d49f 100644 --- a/src/awesome-slot/slots/client.lua +++ b/src/awesome-slot/slots/client.lua @@ -1,21 +1,19 @@ local client_slots = {} function client_slots.append_mousebindings(params) - local amouse = require "awful.mouse" + local mouse = require "awful.mouse" for _, bindings in pairs(params.mousebindings) do - amouse.append_client_mousebindings(bindings) + mouse.append_client_mousebindings(bindings) end end function client_slots.append_keybindings(params) - local akeyboard = require "awful.keyboard" + local keyboard = require "awful.keyboard" for _, bindings in pairs(params.keybindings) do - akeyboard.append_client_keybindings(bindings) + keyboard.append_client_keybindings(bindings) end end return client_slots - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/src/awesome-slot/slots/init.lua b/src/awesome-slot/slots/init.lua index f7d6c2d..46c1910 100644 --- a/src/awesome-slot/slots/init.lua +++ b/src/awesome-slot/slots/init.lua @@ -1,10 +1,8 @@ -local aslot_slots = {} +local slots = {} -aslot_slots.client = require "awesome-slot.slots.client" -aslot_slots.ruled = require "awesome-slot.slots.ruled" -aslot_slots.screen = require "awesome-slot.slots.screen" -aslot_slots.tag = require "awesome-slot.slots.tag" +slots.client = require "awesome-slot.slots.client" +slots.ruled = require "awesome-slot.slots.ruled" +slots.screen = require "awesome-slot.slots.screen" +slots.tag = require "awesome-slot.slots.tag" -return aslot_slots - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 +return slots diff --git a/src/awesome-slot/slots/ruled.lua b/src/awesome-slot/slots/ruled.lua index 36f8dc5..d3debca 100644 --- a/src/awesome-slot/slots/ruled.lua +++ b/src/awesome-slot/slots/ruled.lua @@ -1,21 +1,19 @@ local ruled_slots = {} function ruled_slots.append_client_rules(params) - local rclient = require "ruled.client" + local client = require "ruled.client" for _, rule in pairs(params.rules) do - rclient.append_rule(rule) + client.append_rule(rule) end end function ruled_slots.append_notification_rules(params) - local rnotification = require "ruled.notification" + local notification = require "ruled.notification" for _, rule in pairs(params.rules) do - rnotification.append_rule(rule) + notification.append_rule(rule) end end return ruled_slots - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/src/awesome-slot/slots/screen.lua b/src/awesome-slot/slots/screen.lua index 32c659a..3752482 100644 --- a/src/awesome-slot/slots/screen.lua +++ b/src/awesome-slot/slots/screen.lua @@ -2,24 +2,22 @@ local screen_slots = {} function screen_slots.wallpaper(screen, params) local beautiful = require "beautiful" - local gwallpaper = require "gears.wallpaper" + local wallpaper = require "gears.wallpaper" params = params or { wallpaper = beautiful.wallpaper, } - local wallpaper = params.wallpaper + local w = params.wallpaper - if wallpaper then + if w then -- If wallpaper is a function, call it with the screen - if type(wallpaper) == "function" then - wallpaper = wallpaper(screen) + if type(w) == "function" then + w = w(screen) end - gwallpaper.maximized(wallpaper, screen, true) + wallpaper.maximized(w, screen, true) end end return screen_slots - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/src/awesome-slot/slots/tag.lua b/src/awesome-slot/slots/tag.lua index 79600fc..f6eb8ac 100644 --- a/src/awesome-slot/slots/tag.lua +++ b/src/awesome-slot/slots/tag.lua @@ -1,11 +1,9 @@ local tag_slots = {} function tag_slots.default_layouts(params) - local alayout = require "awful.layout" + local layout = require "awful.layout" - alayout.append_default_layouts(params.layouts) + layout.append_default_layouts(params.layouts) end return tag_slots - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80