aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml64
1 files changed, 64 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..a795f8a
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,64 @@
+name: Build and Test
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Set up dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y lua5.4 liblua5.4-dev
+
+ - name: Install Premake
+ run: |
+ PREMAKE_VERSION="5.0.0-beta2"
+ OS="linux"
+ wget -q https://github.com/premake/premake-core/releases/download/v${PREMAKE_VERSION}/premake-${PREMAKE_VERSION}-${OS}.tar.gz -O premake.tar.gz
+ tar -xzf premake.tar.gz
+ sudo mv premake5 /usr/bin
+ sudo chmod +x /usr/bin/premake5
+ rm premake.tar.gz
+
+ - name: Generate Makefile with Premake
+ run: premake5 gmake
+
+ - name: Build project
+ run: make
+
+ - name: Install shell program
+ run: |
+ if [ ! -d ~/.lush ]; then
+ cp -rf ./.lush ~/
+ fi
+
+ sudo cp ./bin/Debug/lush/lush /usr/bin/lush.new
+ sudo mv /usr/bin/lush.new /usr/bin/lush
+
+ # Ensure the shell is registered in /etc/shells
+ if ! grep -Fxq "/usr/bin/lush" /etc/shells; then
+ echo "/usr/bin/lush" | sudo tee -a /etc/shells >/dev/null
+ fi
+
+ # Optionally change the shell
+ chsh -s /usr/bin/lush
+
+ - name: Run Lua tests
+ run: lush ./test/run_tests.lua
+
+ - name: Upload the compiled binary (Optional)
+ uses: actions/upload-artifact@v3
+ with:
+ name: lush-binary
+ path: ./bin/Debug/lush/lush