zls/.github/workflows/main.yml

79 lines
2.3 KiB
YAML

name: CI
on:
push:
paths:
- "**.zig"
pull_request:
paths:
- "**.zig"
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- uses: goto-bus-stop/setup-zig@v1
with:
version: master
- run: zig version
- run: zig env
- name: Build
run: zig build
- name: Run Tests
run: zig build test
- name: Build artifacts
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "i386-windows" "i386-linux" "aarch64-macos")
mkdir -p "artifacts/"
for target in "${targets[@]}"; do
mkdir -p artifacts/$target
echo "Building target ${target}..."
if [ "${GITHUB_REF##*/}" == "master" ]; then
echo "Building safe"
zig build -Dtarget=${target} -Drelease-safe --prefix artifacts/${target}/
else
echo "Building debug as action is not running on master"
zig build -Dtarget=${target} --prefix artifacts/${target}/
fi
sed -e '1,5d' < README.md > artifacts/${target}/README.md
cp LICENSE artifacts/${target}/
cd artifacts/${target}/
tar cfa ${target}.tar.zst *.md bin/*
mv ${target}.tar.zst ../
cd ../..
done
- name: Upload artifacts
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v2
with:
name: builds
path: artifacts/*.tar.zst
- name: Beam to Felix
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' }}
uses: easingthemes/ssh-deploy@v2.1.1
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_PRIVKEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "artifacts/"
REMOTE_HOST: ${{ secrets.WEBSITE_DEPLOY_HOST }}
REMOTE_USER: ${{ secrets.WEBSITE_DEPLOY_USER }}
TARGET: ${{ secrets.WEBSITE_DEPLOY_FOLDER }}