2024-09-09 17:08:24 +02:00
|
|
|
name: lua
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- stable
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
2024-09-09 19:47:42 +02:00
|
|
|
build:
|
2024-09-09 17:08:24 +02:00
|
|
|
runs-on: ${{ matrix.platform.runner }}
|
|
|
|
strategy:
|
2024-09-09 19:52:32 +02:00
|
|
|
fail-fast: false
|
2024-09-09 17:08:24 +02:00
|
|
|
matrix:
|
2024-09-10 16:09:56 +02:00
|
|
|
platform:
|
2024-09-09 17:08:24 +02:00
|
|
|
- runner: ubuntu-latest
|
2024-09-10 16:02:54 +02:00
|
|
|
arch: x86_64
|
2024-09-10 16:09:56 +02:00
|
|
|
target: linux-gnu
|
2024-09-10 02:39:55 +02:00
|
|
|
pre: lib
|
2024-09-10 16:02:54 +02:00
|
|
|
ext: so
|
2024-09-09 17:08:24 +02:00
|
|
|
- runner: windows-latest
|
2024-09-10 16:02:54 +02:00
|
|
|
arch: x86_64
|
2024-09-10 16:15:31 +02:00
|
|
|
target: windows-msvc
|
2024-09-10 02:39:55 +02:00
|
|
|
pre:
|
2024-09-10 16:02:54 +02:00
|
|
|
ext: dll
|
2024-09-10 02:16:21 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: arduino/setup-protoc@v3
|
2024-09-10 14:51:58 +02:00
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2024-09-10 14:38:52 +02:00
|
|
|
- run: cargo build --release --features=luajit
|
2024-09-10 16:09:56 +02:00
|
|
|
- run: mv target/release/${{matrix.platform.pre}}codemp.${{matrix.platform.ext}} dist/lua/codemp-lua-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
|
2024-09-10 02:16:21 +02:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: codemp-lua-${{ matrix.platform.target }}
|
2024-09-10 16:09:56 +02:00
|
|
|
path: dist/lua/codemp-lua-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
|
2024-09-10 02:16:21 +02:00
|
|
|
|
|
|
|
# macos requires some extra cargo config to make it work, but
|
|
|
|
# these settings make test fail so better limit them to this run
|
2024-09-10 03:39:01 +02:00
|
|
|
build-macos:
|
|
|
|
runs-on: ${{ matrix.platform.runner }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform:
|
2024-09-10 03:45:38 +02:00
|
|
|
- runner: macos-latest
|
2024-09-10 16:02:54 +02:00
|
|
|
arch: aarch64
|
2024-09-10 16:09:56 +02:00
|
|
|
target: darwin
|
2024-09-10 15:42:20 +02:00
|
|
|
pre: lib
|
2024-09-10 16:02:54 +02:00
|
|
|
ext: dylib
|
2024-09-10 03:39:01 +02:00
|
|
|
#- runner: macos-12
|
2024-09-10 16:02:54 +02:00
|
|
|
# arch: x86_64
|
|
|
|
# platform: darwin
|
2024-09-10 15:42:20 +02:00
|
|
|
# pre: lib
|
2024-09-10 16:02:54 +02:00
|
|
|
# ext: dylib
|
2024-09-10 03:39:01 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: arduino/setup-protoc@v3
|
2024-09-10 14:51:58 +02:00
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2024-09-10 14:38:52 +02:00
|
|
|
- run: cargo rustc --release --features=luajit -- -C link-arg=-undefined -C link-arg=dynamic_lookup
|
2024-09-10 16:09:56 +02:00
|
|
|
- run: mv target/release/${{matrix.platform.pre}}codemp.${{matrix.platform.ext}} dist/lua/codemp-lua-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
|
2024-09-10 03:39:01 +02:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: codemp-lua-${{ matrix.platform.target }}
|
2024-09-10 16:09:56 +02:00
|
|
|
path: dist/lua/codemp-lua-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
|
2024-09-10 02:06:57 +02:00
|
|
|
|
2024-09-10 03:25:23 +02:00
|
|
|
# TODO this just copies files on our server, maybe publish on luarocks? maybe do it properly with versions
|
2024-09-10 02:06:57 +02:00
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-latest
|
2024-09-10 03:39:01 +02:00
|
|
|
needs: [build, build-macos]
|
2024-09-10 02:06:57 +02:00
|
|
|
steps:
|
2024-09-10 16:14:35 +02:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- run: mkdir dist/lua/publish
|
2024-09-10 02:06:57 +02:00
|
|
|
- uses: webfactory/ssh-agent@v0.9.0
|
|
|
|
with:
|
|
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
- uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
pattern: codemp-lua-*
|
2024-09-10 16:14:35 +02:00
|
|
|
path: dist/lua/publish
|
|
|
|
- run: tree dist/lua
|
|
|
|
- run: scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dist/lua/annotations.lua dev@codemp.dev:/srv/http/codemp/files/releases/lua/
|
2024-09-10 03:25:23 +02:00
|
|
|
# TODO ugly fix to deal with folders on this side...
|
|
|
|
- name: copy files on remote
|
|
|
|
run: |
|
2024-09-10 16:14:35 +02:00
|
|
|
for DIR in $(ls dist/lua/publish); do
|
|
|
|
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null dist/lua/publish/$DIR/* dev@codemp.dev:/srv/http/codemp/files/releases/lua/
|
2024-09-10 03:25:23 +02:00
|
|
|
done
|