-
Notifications
You must be signed in to change notification settings - Fork 2
177 lines (171 loc) · 5.33 KB
/
Copy pathci.yaml
File metadata and controls
177 lines (171 loc) · 5.33 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: test
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
# Downloads LuaLs and EmmyLua binaries for all OSes and uploads them as an
# artifact so that the test job can re-use them without re-downloading.
prepare:
name: Download LuaLs
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: python -m pip install '.'
- name: Download LuaLs for Linux
run: python -m sphinx_lua_ls.lua_ls linux x86_64 --runtime luals ~/lua_ls_release/ubuntu-latest
- name: Download LuaLs for Windows
run: python -m sphinx_lua_ls.lua_ls win32 amd64 --runtime luals ~/lua_ls_release/windows-latest
- name: Download LuaLs for MacOs
run: python -m sphinx_lua_ls.lua_ls darwin arm --runtime luals ~/lua_ls_release/macos-latest
- name: Download EmmyLua for Linux
run: python -m sphinx_lua_ls.lua_ls linux x86_64 --runtime emmylua ~/lua_ls_release/ubuntu-latest
- name: Download EmmyLua for Windows
run: python -m sphinx_lua_ls.lua_ls win32 amd64 --runtime emmylua ~/lua_ls_release/windows-latest
- name: Download EmmyLua for MacOs
run: python -m sphinx_lua_ls.lua_ls darwin arm --runtime emmylua ~/lua_ls_release/macos-latest
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: lua_ls_release
path: ~/lua_ls_release
include-hidden-files: true
retention-days: 3
# Runs main tests for the package.
#
# Runs on all events except when closing a pull request.
test:
name: Test package
needs:
- prepare
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
type:
- test
include:
- os: ubuntu-latest
python-version: "3.13"
type: code style
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install UV
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
uv tool install poethepoet
# Tests
- name: Download LuaLs
if: ${{ matrix.type == 'test' }}
uses: actions/download-artifact@v8
with:
name: lua_ls_release
path: ~/lua_ls_release
- name: Test package
if: ${{ matrix.type == 'test' }}
run: |
poe ci
env:
LUA_LS_CACHE_PATH: ~/lua_ls_release/${{ matrix.os }}
# Lint
- name: Check code style
if: ${{ matrix.type == 'code style' }}
run: |
poe lint --color always
# Builds python packages.
#
# Only runs on tag pushes.
build:
name: Build package
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}
runs-on: ubuntu-latest
outputs:
link: ${{ steps.metadata.outputs.link }}
is-pre-release: ${{ steps.changelog.outputs.is-pre-release }}
is-unreleased: ${{ steps.changelog.outputs.is-unreleased }}
changelog-text: ${{ steps.changelog.outputs.text }}
steps:
- name: Checkout source
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate release metadata
id: metadata
run: |
ref="${{ github.ref }}";
version=${ref#refs/tags/v};
link="https://pypi.org/p/sphinx-lua-ls/${version}/";
echo "link=${link}" >> $GITHUB_OUTPUT
- name: Parse Changelog
id: changelog
uses: taminomara/cl-keeper@v1
with:
version: ${{ github.ref }}
- name: Install UV
uses: astral-sh/setup-uv@v7
- name: Build project
run: |
uv build
- name: Upload the build artifact
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/
# Publishes python packages.
#
# Only runs on tag pushes.
publish_to_pypi:
name: Publish package to PyPi
needs:
- test
- build
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/sphinx-lua-ls
permissions:
contents: write
id-token: write
steps:
- name: Download build artifact
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: false
- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
prerelease: ${{ fromJSON(needs.build.outputs.is-pre-release) }}
draft: ${{ fromJSON(needs.build.outputs.is-unreleased) }}
body: |
## Changelog
${{ needs.build.outputs.changelog-text }}
[See release on PyPi](${{ needs.build.outputs.link }})