ci: add ability to release via ci #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [master] | |
workflow_call: | |
jobs: | |
windows-x86_64: | |
name: Build for Windows | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
editor: | |
- name: lite-xl | |
make_opts: "'LTS_CFLAGS=-std=c11'" | |
- name: pragtical | |
make_opts: "'LTS_CFLAGS=-std=c11 -DPRAGTICAL'" | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: >- | |
base-devel | |
git | |
mingw-w64-x86_64-gcc | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build | |
run: >- | |
sh make.sh lua_tree_sitter.dll ${{ matrix.editor.make_opts }} && | |
mv lua-tree-sitter/lua_tree_sitter.dll ${{ matrix.editor.name }}-tree-sitter.x86_64-windows.dll | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.editor.name }}-tree-sitter.x86_64-windows | |
path: ${{ matrix.editor.name }}-tree-sitter.x86_64-windows.dll | |
if-no-files-found: error | |
linux: | |
name: Build for Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
editor: | |
- name: lite-xl | |
make_opts: "'LTS_CFLAGS=-std=c11'" | |
- name: pragtical | |
make_opts: "'LTS_CFLAGS=-std=c11 -DPRAGTICAL'" | |
arch: | |
- name: x86_64 | |
pkg: | |
cc: gcc | |
- name: aarch64 | |
pkg: gcc-aarch64-linux-gnu | |
cc: aarch64-linux-gnu-gcc | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install cc | |
run: sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get install make ${{ matrix.arch.pkg }} | |
- name: Build | |
run: >- | |
sh make.sh lua_tree_sitter.so CC=${{ matrix.arch.cc }} ${{ matrix.editor.make_opts }} && | |
mv lua-tree-sitter/lua_tree_sitter.so ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-linux.so | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-linux | |
path: ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-linux.so | |
if-no-files-found: error | |
macos: | |
name: Build for MacOS | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
editor: | |
- name: lite-xl | |
make_opts: "'LTS_CFLAGS=-std=c11'" | |
- name: pragtical | |
make_opts: "'LTS_CFLAGS=-std=c11 -DPRAGTICAL'" | |
arch: | |
- name: x86_64 | |
make_opts: "'CFLAGS=-O3 -fvisibility=hidden -fPIC -flto=auto -target x86_64-apple-darwin'" | |
- name: aarch64 | |
make_opts: "'CFLAGS=-O3 -fvisibility=hidden -fPIC -flto=auto -target aarch64-apple-darwin'" | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build | |
run: >- | |
bash make.sh lua_tree_sitter.so ${{ matrix.arch.make_opts }} ${{ matrix.editor.make_opts }} && | |
mv lua-tree-sitter/lua_tree_sitter.so ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-darwin.so | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-darwin | |
path: ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-darwin.so | |
if-no-files-found: error |