-
Notifications
You must be signed in to change notification settings - Fork 48
76 lines (73 loc) · 2.2 KB
/
ci.yml
File metadata and controls
76 lines (73 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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.15.1]
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
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
echo "Waiting for MySQL to start..."
while ! mysqladmin ping -h 127.0.0.1 -P 3306 -uroot -proot --silent --wait=5; do
echo "Waiting for MySQL to be ready..."
sleep 2
done
echo "MySQL is ready!"
mysql -uroot -proot -e "create database public; show databases;"
- 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
sudo systemctl start mysql.service
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