Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRibera authored Dec 25, 2023
0 parents commit 19678fb
Show file tree
Hide file tree
Showing 21 changed files with 1,360 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .busted
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
return {
_all = {
coverage = false,
lpath = "lua/?.lua;lua/?/init.lua",
},
default = {
verbose = true
},
tests = {
verbose = true
},
}
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*.*]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake . -Lv
7 changes: 7 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
11 changes: 11 additions & 0 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Nix build"
on:
pull_request:
push:
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- run: nix flake check -L
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: "Luarocks release"
on:
pull_request:
push:
tags:
- 'v*.*.*'

jobs:
luarocks-release:
runs-on: ubuntu-latest
name: Release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fail if changelog entry does not exist
if: startsWith(github.ref, 'refs/tags/')
run: grep -q "${{ github.ref_name }}" CHANGELOG.md
- name: Luarocks Upload
uses: nvim-neorocks/luarocks-tag-release@v5
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
- name: Fail if changelog entry does not exist
run: grep -q "${{ github.ref_name }}" CHANGELOG.md
- name: GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
bodyFile: "CHANGELOG.md"
allowUpdates: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
result
.pre-commit-config.yaml
.direnv
10 changes: 10 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ignore = {
"631", -- max_line_length
"122", -- read-only field of global variable
}
read_globals = {
"vim",
"describe",
"it",
"assert"
}
6 changes: 6 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "NoSingleTable"
collapse_simple_statement = "Never"
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!-- markdownlint-disable -->
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [3.1.0] - 2023-09-05

### Added

- Use `neorocksTest`.

### Changed

- Bump `luarocks-tag-release` version.

### Fixed

- Fail release if changelog entry doesn't exist.

## [3.0.0] - 2023-08-16

### Fixed

- Luarocks Upload workflow.

### Changed

- Loosen license restrictions to allow any OSI approved open source derivations.
- Switch from `flake-utils` to `flake-parts`.

### Added

- More pre-commit-hooks and linters.
- `luarocks-tag-release` workflow.
- Add lua-ls pre-commit checks.

### Changed

- Remove `cachix-action` from workflow.

## [2.0.0] - 2023-01-02

### Changed

- Replace `nixpkgs-fmt` with `alejandra`.

## [1.0.0] - 2022-10-20

### Added

- Initial release
76 changes: 76 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributing guide

Contributions are more than welcome!

Please don't forget to add your changes to the "Unreleased" section of
[the changelog](./CHANGELOG.md) (if applicable).

## Commit messages

This project uses
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).

## Development

I use [`nix`](https://nixos.org/download.html#download-nix)
(with flakes enabled) for development and testing.

Formatting is done with [`stylua`](https://github.com/JohnnyMorganz/StyLua).

To enter a development shell:

```console
nix develop
```

To apply formatting, while in a devShell, run

```console
pre-commit run --all
```

If you use [`direnv`](https://direnv.net/),
just run `direnv allow` and you will be dropped in this devShell.

## Tests

### Running tests

I use [`busted`](https://lunarmodules.github.io/busted/) for testing,
but with Neovim as the Lua interpreter.

The easiest way to run tests is with Nix (see below).

If you do not use Nix, you can also run the test suite using `luarocks test`.
For more information on how to set up Neovim as a Lua interpreter, see

- The [neorocks tutorial](https://github.com/nvim-neorocks/neorocks#without-neolua).

Or

- [`nlua`](https://github.com/mfussenegger/nlua).

> [!NOTE]
>
> The Nix devShell sets up `luarocks test` to use Neovim as the interpreter.
### Running tests and checks with Nix

If you just want to run all checks that are available,
run:

```console
nix flake check --print-build-logs
```

To run tests locally

```console
nix build .#checks.<your-system>.ci --print-build-logs
```

For formatting:

```console
nix build .#checks.<your-system>.formatting --print-build-logs
```
Loading

0 comments on commit 19678fb

Please sign in to comment.