2023-01-07 23:14:45 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths:
|
2023-02-23 03:41:49 +00:00
|
|
|
- ".github/workflows/main.yml"
|
2023-01-07 23:14:45 +00:00
|
|
|
- "**.zig"
|
|
|
|
pull_request:
|
|
|
|
paths:
|
2023-02-23 03:41:49 +00:00
|
|
|
- ".github/workflows/main.yml"
|
2023-01-07 23:14:45 +00:00
|
|
|
- "**.zig"
|
|
|
|
schedule:
|
|
|
|
- cron: "0 0 * * *"
|
|
|
|
workflow_dispatch:
|
2023-01-17 01:15:12 +00:00
|
|
|
inputs:
|
|
|
|
bypass_tracy_and_artifacts:
|
|
|
|
type: boolean
|
|
|
|
description: Bypass Tracy and artifact builds (much faster)
|
2023-01-07 23:14:45 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
submodules: true
|
|
|
|
- uses: goto-bus-stop/setup-zig@v2
|
|
|
|
with:
|
|
|
|
version: master
|
|
|
|
|
|
|
|
- run: zig version
|
|
|
|
- run: zig env
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: zig build
|
|
|
|
|
|
|
|
- name: Build with Tracy
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os != 'macos-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
run: zig build -Denable_tracy -Denable_tracy_allocation
|
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
run: zig build test
|
|
|
|
|
|
|
|
- name: Build artifacts
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
run: |
|
2023-04-04 21:23:33 +01:00
|
|
|
declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "x86-windows" "x86-linux" "aarch64-linux" "aarch64-macos" "wasm32-wasi")
|
2023-01-07 23:14:45 +00:00
|
|
|
mkdir -p "artifacts/"
|
|
|
|
|
|
|
|
for target in "${targets[@]}"; do
|
|
|
|
mkdir -p artifacts/$target
|
|
|
|
echo "Building target ${target}..."
|
|
|
|
if [ "${GITHUB_REF##*/}" == "master" ]; then
|
|
|
|
echo "Building safe"
|
2023-02-03 22:27:14 +00:00
|
|
|
zig build -Dtarget=${target} -Doptimize=ReleaseSafe --prefix artifacts/${target}/
|
2023-01-07 23:14:45 +00:00
|
|
|
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}/
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: Upload x86_64-windows artifact
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: zls-x86_64-windows
|
|
|
|
path: artifacts/x86_64-windows/
|
|
|
|
|
|
|
|
- name: Upload x86_64-linux artifact
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: zls-x86_64-linux
|
|
|
|
path: artifacts/x86_64-linux/
|
|
|
|
|
|
|
|
- name: Upload x86_64-macos artifact
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: zls-x86_64-macos
|
|
|
|
path: artifacts/x86_64-macos/
|
|
|
|
|
|
|
|
- name: Upload x86-windows artifact
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: zls-x86-windows
|
|
|
|
path: artifacts/x86-windows/
|
|
|
|
|
|
|
|
- name: Upload x86-linux artifact
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: zls-x86-linux
|
|
|
|
path: artifacts/x86-linux/
|
|
|
|
|
|
|
|
- name: Upload aarch64-linux artifact
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: zls-aarch64-linux
|
|
|
|
path: artifacts/aarch64-linux/
|
|
|
|
|
|
|
|
- name: Upload aarch64-macos artifact
|
2023-01-17 01:49:28 +00:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
2023-01-07 23:14:45 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: zls-aarch64-macos
|
|
|
|
path: artifacts/aarch64-macos/
|
|
|
|
|
2023-04-04 21:23:33 +01:00
|
|
|
- name: Upload wasm32-wasi artifact
|
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.event.inputs.bypass_tracy_and_artifacts != 'true' }}
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: zls-wasm32-wasi
|
|
|
|
path: artifacts/wasm32-wasi/
|
|
|
|
|
2023-01-07 23:14:45 +00:00
|
|
|
- name: Beam to Felix
|
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' && github.repository_owner == 'zigtools' }}
|
|
|
|
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 }}
|