Skip to content

CI

CI #657

Workflow file for this run

name: CI
on:
workflow_dispatch:
schedule:
- cron: '10 20 * * *'
pull_request:
paths:
- "**.zig"
- ".github/**"
push:
branches:
- main
paths:
- "**.zig"
- ".github/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
examples:
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
zig-version: [0.13.0]
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v1
with:
version: ${{ matrix.zig-version }}
- name: Start services
uses: ikalnytskyi/action-setup-postgres@v7
with:
username: postgres
password: postgres
database: postgres
port: 5432
- name: mysql for ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#mysql
sudo systemctl start mysql.service
mysql -uroot -proot -e "create database public"
- name: Install deps
run: |
make install-deps
- name: mysql for macOS
if: matrix.os == 'macos-latest'
run: |
node .github/ci.js
prefix=$(brew --prefix)
echo "PKG_CONFIG_PATH=${prefix}/opt/sqlite/lib/pkgconfig:${prefix}/opt/libpq/lib/pkgconfig:${prefix}/opt/mysql-client/lib/pkgconfig" >> ${GITHUB_ENV}
- name: Run examples(Unix)
run: |
pkg-config --libs --cflags libpq mysqlclient
zig fmt --check src/
if [ `uname -s` = "Linux" ]; then
zig build
zig build run-all --summary all
else
TARGET="aarch64-macos"
zig build -Dtarget="${TARGET}"
zig build run-all -Dtarget="${TARGET}" --summary all
fi