codemp/.github/workflows/lua.yml

93 lines
3.3 KiB
YAML

name: lua
on:
push:
branches:
- stable
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
platform:
- runner: ubuntu-latest
arch: x86_64
target: linux-gnu
pre: lib
ext: so
- runner: windows-latest
arch: x86_64
target: windows-msvc
pre:
ext: dll
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: cargo build --release --features=luajit
- run: mv target/release/${{matrix.platform.pre}}codemp.${{matrix.platform.ext}} dist/lua/codemp-lua-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
- uses: actions/upload-artifact@v4
with:
name: codemp-lua-${{ matrix.platform.target }}
path: dist/lua/codemp-lua-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
# macos requires some extra cargo config to make it work, but
# these settings make test fail so better limit them to this run
build-macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
platform:
- runner: macos-latest
arch: aarch64
target: darwin
pre: lib
ext: dylib
#- runner: macos-12
# arch: x86_64
# platform: darwin
# pre: lib
# ext: dylib
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: cargo rustc --release --features=luajit -- -C link-arg=-undefined -C link-arg=dynamic_lookup
- run: mv target/release/${{matrix.platform.pre}}codemp.${{matrix.platform.ext}} dist/lua/codemp-lua-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
- uses: actions/upload-artifact@v4
with:
name: codemp-lua-${{ matrix.platform.target }}
path: dist/lua/codemp-lua-${{matrix.platform.arch}}-${{matrix.platform.target}}.${{matrix.platform.ext}}
# TODO this just copies files on our server, maybe publish on luarocks? maybe do it properly with versions
publish:
runs-on: ubuntu-latest
needs: [build, build-macos]
steps:
- uses: actions/checkout@v4
- run: mkdir dist/lua/publish
- uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/download-artifact@v4
with:
pattern: codemp-lua-*
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/
# TODO ugly fix to deal with folders on this side...
- name: copy files on remote
run: |
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/
done