From 0e6bc61ee451252e440957da93a29374eb1cc2f6 Mon Sep 17 00:00:00 2001 From: jiacai2050 Date: Wed, 15 May 2024 09:12:56 +0800 Subject: [PATCH 1/2] fix zig target --- .github/workflows/ci.yml | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d12ac8a..4232e77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] # macos-latest is macos-14, which is arm runner + os: [ubuntu-latest, macos-latest] zig: [0.12.0, master] steps: - uses: actions/checkout@v4 @@ -46,34 +46,25 @@ 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) + - 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) - if: matrix.os == 'ubuntu-latest' - 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: | + TARGET="aarch64-macos" + if [ `uname -s` = "Linux" ]; then + TARGET="x86_64-linux" + fi pkg-config --libs --cflags libpq mysqlclient zig fmt --check src/ - zig build -Dtarget=aarch64-macos - zig build run-all -Dtarget=aarch64-macos --summary all + zig build -Dtarget="${TARGET}" + zig build run-all -Dtarget="${TARGET}" --summary all - name: Run examples(Windows) if: matrix.os == 'windows-latest' From a9e73c70a22d249884ca4656bdd0cd4dfb922526 Mon Sep 17 00:00:00 2001 From: jiacai2050 Date: Wed, 15 May 2024 09:22:05 +0800 Subject: [PATCH 2/2] fix bad if --- .github/workflows/ci.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4232e77..da17a95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,18 +57,13 @@ jobs: 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: | - TARGET="aarch64-macos" - if [ `uname -s` = "Linux" ]; then - TARGET="x86_64-linux" - fi pkg-config --libs --cflags libpq mysqlclient zig fmt --check src/ - zig build -Dtarget="${TARGET}" - zig build run-all -Dtarget="${TARGET}" --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 + 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