Changes to work with pragtical luajit #40
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: CI | |
on: { push: { branches: [master] } } | |
permissions: write-all | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.setup_release.outputs.version }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: { fetch-depth: 0 } | |
- name: Setup Release | |
id: setup_release | |
env: { GITHUB_TOKEN: "${{ github.token }}" } | |
run: | | |
export VERSION=`git describe --tags --match "v*" | tail -c +2` | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "Building terminal version $VERSION." | |
perl -pe 'last if $_ =~ m/^\s*#/ && $_ !~ m/#\s*$ENV{VERSION}/' < CHANGELOG.md | tail -n +2 > NOTES.md | |
if [[ `git tag --points-at HEAD | head -c 1` == "v" ]]; then | |
gh release delete -y v$VERSION || true; gh release create -t v$VERSION v$VERSION | |
gh release delete -y latest || true; gh release create -t latest latest | |
fi | |
gh release delete -y continuous || true; gh release create -p -t 'Continuous Release' continuous -F NOTES.md | |
build_linux: | |
needs: [version] | |
permissions: write-all | |
runs-on: ubuntu-20.04 | |
defaults: { run: { shell: bash } } | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: { fetch-depth: 0, submodules: true } | |
- name: Install Cross Compiler | |
run: | | |
sudo apt-get install -y gcc-aarch64-linux-gnu | |
- name: Build Linux | |
run: | | |
BIN=libterminal.x86_64-linux.so ./build.sh -O3 -DLIBTERMINAL_VERSION='"'${{ needs.version.outputs.version }}-x86_64-linux'"' | |
BIN=libterminal.aarch64-linux.so CC=aarch64-linux-gnu-gcc ./build.sh -O3 -DLIBTERMINAL_VERSION='"'${{ needs.version.outputs.version }}-aarch64-linux'"' | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: { name: "Linux", path: "*.so" } | |
build_windows: | |
needs: [version] | |
permissions: write-all | |
runs-on: ubuntu-latest | |
defaults: { run: { shell: bash } } | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: { fetch-depth: 0, submodules: true } | |
- name: Build Windows | |
env: { GITHUB_TOKEN: "${{ github.token }}" } | |
run: sudo apt-get install mingw-w64 && BIN=libterminal.x86_64-windows.dll CC=x86_64-w64-mingw32-gcc ./build.sh -O3 -DLIBTERMINAL_VERSION='"'${{ needs.version.outputs.version }}-x86_64-windows'"' | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: { name: "Windows", path: "*.dll" } | |
build_macos: | |
needs: [version] | |
runs-on: macos-11 | |
env: | |
CC: clang | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: { fetch-depth: 0, submodules: true } | |
- name: Build MacOS | |
env: { GITHUB_TOKEN: "${{ github.token }}" } | |
run: | | |
./build.sh clean | |
BIN=libterminal.x86_64-darwin.so ./build.sh -O3 -DLIBTERMINAL_VERSION='"'${{ needs.version.outputs.version }}-x86_64-darwin'"' | |
BIN=libterminal.aarch64-darwin.so CC=clang CFLAGS="-arch arm64" ./build.sh -O3 -DLIBTERMINAL_VERSION='"'${{ needs.version.outputs.version }}-x86_64-darwin'"' | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: { name: "MacOS", path: "*.so" } | |
finalize: | |
needs: [version, build_macos, build_linux, build_windows] | |
runs-on: ubuntu-latest | |
environment: Release | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: { fetch-depth: 0 } | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: { path: "." } | |
- name: Perform Release | |
env: | |
GITHUB_TOKEN: "${{ github.token }}" | |
run: | | |
if [[ `git tag --points-at HEAD | head -c 1` == "v" ]]; then | |
gh release upload v${{ needs.version.outputs.version }} Linux/*.so MacOS/*.so Windows/*.dll | |
gh release upload latest Linux/*.so MacOS/*.so Windows/*.dll | |
git branch -f latest HEAD | |
git tag -f latest | |
git push -f origin refs/heads/latest | |
git push -f origin refs/tags/latest | |
fi | |
gh release upload continuous Linux/*.so MacOS/*.so Windows/*.dll | |
git tag -f continuous | |
git push -f origin refs/tags/continuous |