zls/.github/workflows/main.yml

121 lines
3.7 KiB
YAML
Raw Normal View History

2020-05-14 14:49:05 +01:00
name: CI
2020-11-04 22:50:29 +00:00
2020-05-14 15:09:50 +01:00
on:
push:
paths:
- "**.zig"
2020-05-14 15:09:50 +01:00
pull_request:
paths:
- "**.zig"
2020-11-04 23:11:01 +00:00
schedule:
- cron: "0 0 * * *"
2020-11-04 22:50:29 +00:00
workflow_dispatch:
2020-05-14 15:09:50 +01:00
2020-05-14 14:49:05 +01:00
jobs:
build:
2020-11-04 22:50:29 +00:00
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
2020-11-04 23:15:57 +00:00
runs-on: ${{ matrix.os }}
2020-05-14 14:49:05 +01:00
steps:
- uses: actions/checkout@v3
2020-11-04 22:50:29 +00:00
with:
fetch-depth: 0
2020-11-04 22:50:29 +00:00
submodules: true
- uses: goto-bus-stop/setup-zig@v2
2020-11-04 22:50:29 +00:00
with:
version: master
2020-05-14 14:57:19 +01:00
2021-12-30 06:44:24 +00:00
- run: zig version
- run: zig env
2020-11-04 22:50:29 +00:00
- name: Build
run: zig build
2020-05-14 14:57:19 +01:00
- name: Build with Tracy
if: ${{ matrix.os != 'macos-latest' }}
run: zig build -Denable_tracy -Denable_tracy_allocation
2020-11-04 23:15:57 +00:00
- name: Run Tests
run: zig build test
- name: Build artifacts
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
2022-12-02 09:01:09 +00:00
declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "x86-windows" "x86-linux" "aarch64-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
2021-10-20 03:32:28 +01:00
cp LICENSE artifacts/${target}/
done
- name: Upload x86_64-windows artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86_64-windows
path: artifacts/x86_64-windows/
- name: Upload x86_64-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86_64-linux
path: artifacts/x86_64-linux/
- name: Upload x86_64-macos artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86_64-macos
path: artifacts/x86_64-macos/
- name: Upload x86-windows artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86-windows
path: artifacts/x86-windows/
- name: Upload x86-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: zls-x86-linux
path: artifacts/x86-linux/
- name: Upload aarch64-linux artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: zls-aarch64-linux
path: artifacts/aarch64-linux/
- name: Upload aarch64-macos artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: zls-aarch64-macos
path: artifacts/aarch64-macos/
2022-07-13 10:22:01 +01:00
- name: Beam to Felix
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' && github.repository_owner == 'zigtools' }}
2022-07-13 10:22:01 +01:00
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 }}