-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (54 loc) · 2.37 KB
/
Copy pathtests.yml
File metadata and controls
67 lines (54 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
name: Tests
on:
pull_request:
push:
branches: [main]
jobs:
test:
name: Tests - Lua 5.4
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Lux
uses: lumen-oss/gh-actions-lux@bd58f7b97fe2147910580a33b677efadf746e179 # v1.0.1
with:
version: 0.28.2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y lua5.4 liblua5.4-dev cmake
sudo ln -sf /usr/bin/lua5.4 /usr/bin/lua
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
- name: Run tests
run: just test-ci
lint:
name: Lint & Format
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Lux
uses: lumen-oss/gh-actions-lux@bd58f7b97fe2147910580a33b677efadf746e179 # v1.0.1
with:
version: 0.28.2
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
- name: Install GitHub CLI and Lua (if missing)
run: |
which gh || sudo apt-get install -y gh
sudo apt-get update
sudo apt-get install -y lua5.4 liblua5.4-dev
sudo ln -sf /usr/bin/lua5.4 /usr/bin/lua
- name: Check formatting
run: |
lx fmt
git diff --exit-code || (echo "::error::Code is not formatted. Run 'lx fmt' locally and commit the changes." && exit 1)
- name: Run linter
run: just lint-ci
- name: Comment on PR if formatting needed
if: ${{ !env.ACT && failure() && github.event_name == 'pull_request' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment --edit-last --body $'## ⚠️ Formatting Required\n\nYour pull request contains Lua code that is not formatted according to the project\'s style guidelines.\n\n**To fix this locally:**\n\n1. Run `lx fmt` in the repository root.\n2. Commit the changes and push again.\n\n**Pro tip:** Install [lefthook](https://github.com/evilmartians/lefthook) and run `lefthook install` to automatically format your code on each commit.\n\nOnce you\'ve formatted your code, this check will pass and you can merge your PR.'