Skip to content

Commit

Permalink
ci: split out the workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Rui Chen <rui@chenrui.dev>
  • Loading branch information
chenrui333 committed May 14, 2024
1 parent 141ec12 commit ccb4c7f
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 29 deletions.
33 changes: 4 additions & 29 deletions .github/workflows/ci.yml → .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI (linux)

on:
workflow_dispatch:
Expand All @@ -18,11 +18,10 @@ on:
jobs:
examples:
timeout-minutes: 10
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest] # macos-latest is macos-14, which is arm runner
zig: [0.12.0, master]
steps:
- uses: actions/checkout@v4
Expand All @@ -46,38 +45,14 @@ jobs:
mysql database: 'public'
mysql root password: 'password'
mysql user: 'developer'
- name: mysql for macOS
if: matrix.os == 'macos-latest'
run: |
node .github/ci.js

- name: Install deps
run: |
make install-deps
- name: Set pkg-config(macOS)
if: matrix.os == 'macos-latest'
run: |
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)
if: matrix.os == 'ubuntu-latest'
- name: Run examples
run: |
pkg-config --libs --cflags libpq mysqlclient
zig fmt --check src/
zig build
zig build run-all --summary all
- name: Run examples(macOS)
if: matrix.os == 'macos-latest'
run: |
pkg-config --libs --cflags libpq mysqlclient
zig fmt --check src/
zig build -Dtarget=aarch64-macos
zig build run-all -Dtarget=aarch64-macos --summary all
- name: Run examples(Windows)
if: matrix.os == 'windows-latest'
run: |
zig.exe fmt --check src/
zig.exe build
zig.exe build run-all --summary all
58 changes: 58 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI (macOS)

on:
workflow_dispatch:
schedule:
- cron: '10 20 * * *'
pull_request:
paths:
- "**.zig"
- ".github/**"
push:
branches:
- main
paths:
- "**.zig"
- ".github/**"

jobs:
examples:
timeout-minutes: 10
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
zig: [0.12.0, master]
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ matrix.zig }}
- name: Start services
uses: ikalnytskyi/action-setup-postgres@v6
with:
username: postgres
password: postgres
database: postgres
port: 5432

- name: Setup MySQL
run: |
node .github/ci.js
- name: Install deps
run: |
make install-deps
- name: Set pkg-config
if: matrix.os == 'macos-latest'
run: |
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
run: |
pkg-config --libs --cflags libpq mysqlclient
zig fmt --check src/
zig build -Dtarget=aarch64-macos
zig build run-all -Dtarget=aarch64-macos --summary all

0 comments on commit ccb4c7f

Please sign in to comment.