Skip to content

Commit 8f04561

Browse files
committed
Attempt to download SPC and build PHP from actions
1 parent af4ad19 commit 8f04561

File tree

10 files changed

+289
-245
lines changed

10 files changed

+289
-245
lines changed

.github/workflows/CI.yml

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,22 @@ jobs:
2727
settings:
2828
- host: macos-13
2929
target: x86_64-apple-darwin
30+
os: macos
31+
arch: x86_64
3032
build: yarn build --target x86_64-apple-darwin
31-
# build: yarn build
33+
setup: |
34+
brew install autoconf automake libtool
3235
- host: macos-latest
3336
target: aarch64-apple-darwin
37+
os: macos
38+
arch: aarch64
3439
build: yarn build --target aarch64-apple-darwin
35-
# build: yarn build
40+
setup: |
41+
brew install autoconf automake libtool
3642
- host: ubuntu-latest
3743
target: x86_64-unknown-linux-gnu
44+
os: linux
45+
arch: x86_64
3846
# docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
3947
build: yarn build --target x86_64-unknown-linux-gnu
4048
# build: yarn build
@@ -54,6 +62,16 @@ jobs:
5462
# sudo apt-get update
5563
# sudo apt-get install gcc-arm-linux-gnueabihf libssl-dev -y
5664
# build: yarn build --target armv7-unknown-linux-gnueabihf
65+
- host: ubuntu-latest
66+
target: x86_64-unknown-linux-musl
67+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
68+
build: |-
69+
set -e &&
70+
rustup target add x86_64-unknown-linux-musl &&
71+
yarn build --target x86_64-unknown-linux-musl
72+
setup: |
73+
sudo apt-get update
74+
sudo apt-get install libssl-dev -y
5775
# - host: ubuntu-latest
5876
# target: armv7-unknown-linux-musleabihf
5977
# build: yarn build --target armv7-unknown-linux-musleabihf
@@ -81,15 +99,15 @@ jobs:
8199
# build: |
82100
# yarn build --target i686-pc-windows-msvc
83101
# yarn test
84-
name: stable - ${{ matrix.settings.target }} - node@20
102+
name: stable - ${{ matrix.settings.target }} - node@22
85103
runs-on: ${{ matrix.settings.host }}
86104
steps:
87105
- uses: actions/checkout@v4
88106
- name: Setup node
89107
uses: actions/setup-node@v4
90108
if: ${{ !matrix.settings.docker }}
91109
with:
92-
node-version: 20
110+
node-version: 22
93111
cache: yarn
94112
- name: Install
95113
uses: dtolnay/rust-toolchain@stable
@@ -115,19 +133,35 @@ jobs:
115133
run: ${{ matrix.settings.setup }}
116134
if: ${{ matrix.settings.setup }}
117135
shell: bash
118-
- name: Setup node x86
119-
if: matrix.settings.target == 'i686-pc-windows-msvc'
120-
run: yarn config set supportedArchitectures.cpu "ia32"
136+
- name: Fetch SPC
137+
shell: bash
138+
run: ./scripts/fetch-spc.sh
139+
- name: Cache PHP Download
140+
id: cache-php-download
141+
uses: actions/cache@v4
142+
with:
143+
path: downloads
144+
key: php-download-${{ matrix.settings.target }}-${{ matrix.settings.host }}
145+
- name: Fetch PHP and extensions
146+
if: steps.cache-php-download.outputs.cache-hit != 'true'
147+
shell: bash
148+
run: ./scripts/download-php.sh
149+
env:
150+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151+
- name: Cache PHP
152+
id: cache-php-build
153+
uses: actions/cache@v4
154+
with:
155+
path: |
156+
buildroot
157+
source
158+
key: php-build-${{ matrix.settings.target }}-${{ matrix.settings.host }}
159+
- name: Build PHP
160+
if: steps.cache-php-build.outputs.cache-hit != 'true'
121161
shell: bash
162+
run: ./scripts/build-php.sh
122163
- name: Install dependencies
123164
run: yarn install
124-
- name: Setup node x86
125-
uses: actions/setup-node@v4
126-
if: matrix.settings.target == 'i686-pc-windows-msvc'
127-
with:
128-
node-version: 20
129-
cache: yarn
130-
architecture: x86
131165
- name: Build in docker
132166
uses: addnab/docker-run-action@v3
133167
if: ${{ matrix.settings.docker }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,8 @@ Cargo.lock
200200
crates/php/buildroot
201201
crates/php/downloads
202202
crates/php/source
203+
204+
buildroot
205+
downloads
206+
source
207+
spc

crates/lang_handler/build.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ use std::path::PathBuf;
55

66
fn main() {
77
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
8-
let profile = env::var("PROFILE").unwrap();
98

10-
let target_str = format!("../../target/{}", profile);
11-
let header_path = PathBuf::from(crate_dir.clone())
12-
.join(target_str)
9+
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap())
10+
.join("../../..")
11+
.canonicalize()
12+
.unwrap();
13+
14+
let header_path = out_dir
1315
.join("lang_handler.h");
1416

1517
cbindgen::Builder::new()

0 commit comments

Comments
 (0)