Monorepo project #508

Merged
Sirherobrine23 merged 3 commits from monorepo into main 2023-02-22 04:21:43 +00:00
4 changed files with 360 additions and 1 deletions
Showing only changes of commit 1f27b70062 - Show all commits

23
.github/uploadToBucket.mjs vendored Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env node
import { createReadStream } from "fs";
import { oracleBucket } from "@sirherobrine23/cloud";
import extendsFS from "@sirherobrine23/extends";
import path from "node:path";
const [,, remote, local] = process.argv;
const bucket = await oracleBucket.oracleBucket({
region: "sa-saopaulo-1",
namespace: "grwodtg32n4d",
name: "bdsFiles",
auth: {
type: "preAuthentication",
// Public auth (No write enabled).
PreAuthenticatedKey: process.env.OCI_AUTHKEY
}
});
for await (const file of await extendsFS.readdir(path.resolve(process.cwd(), local))) {
console.log("Uploading %O", file);
await bucket.uploadFile(path.posix.resolve("/", remote ?? "", path.basename(file)), createReadStream(file));
console.log("Success %O", file);
}

221
.github/workflows/phpBuild.yaml vendored Normal file
View File

@ -0,0 +1,221 @@
name: PHP build
on:
workflow_dispatch:
schedule:
- cron: "0 0 */2 * 0"
jobs:
# Android Build arm64
android:
runs-on: ubuntu-latest
name: Android
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
repository: pmmp/php-build-scripts
submodules: true
- name: Cache musl
uses: actions/cache@v3
with:
key: ${{ runner.os }}-android_musl
path: muslCrossMake
- name: Build musl to android
env:
DEBIAN_FRONTEND: "noninteractive"
run: |
set -ex
sudo apt update
sudo apt -y install build-essential curl make autoconf automake libtool m4 wget gzip bzip2 bison g++ git cmake pkg-config re2c libtool* unzip zip tar
# Build musl
if ! [[ -d muslCrossMake ]];then
mkdir muslCrossMake
INITIAL_PATH="$(pwd)"
cd muslCrossMake
git clone https://github.com/pmmp/musl-cross-make.git ./
(echo "TARGET = aarch64-linux-musl"; echo "OUTPUT = /usr/local") > config.mak
make
sudo make install -j$(nproc)
else
cd muslCrossMake
sudo make install -j$(nproc)
fi
- name: "Building php bin"
continue-on-error: true
timeout-minutes: 40
run: |
./compile.sh -t android-aarch64 -x -f -g -j$(nproc)
# Compress files
cd bin/php*/
pwd
# ZIP
zip -r "${{ github.workspace }}/android_arm64.zip" *
# tar
tar -czf "${{ github.workspace }}/android_arm64.tar.gz" *
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: android_arm64
path: "*.tar.gz"
# Linux Build
linux:
strategy:
fail-fast: false
matrix:
target:
- ubuntu-latest
- arm64
name: "Linux - ${{ matrix.target }}"
runs-on: ${{ matrix.target }}
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
repository: pmmp/php-build-scripts
submodules: true
- name: Install tools and dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake pkg-config make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c zip tar
- name: Compile PHP
continue-on-error: true
timeout-minutes: 40
run: |
set -ex
./compile.sh -j 4 -f -g -s
# Compress files
cd bin/php*/
pwd
# ZIP
zip -r "${{ github.workspace }}/linux_${{ runner.arch }}.zip" *
# tar
tar -czf "${{ github.workspace }}/linux_${{ runner.arch }}.tar.gz" *
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: linux_${{ runner.arch }}
path: |
*.tar.gz
*.zip
# MacOS Build
macos:
runs-on: macos-11
name: MacOS
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
repository: pmmp/php-build-scripts
submodules: true
- name: Install dependecies
run: brew install libtool autoconf automake pkg-config bison re2c
- name: "Building php"
continue-on-error: true
timeout-minutes: 40
run: |
export PATH="/usr/local/opt/bison/bin:$PATH"
set -ex
trap "exit 1" ERR
./compile.sh -j4 -f -g || (cat *.log && exit 1)
- name: Create tarballs
run: |
cd bin/*/
pwd
# ZIP
zip -r "${{ github.workspace }}/darwin_${{ runner.arch }}.zip" *
# tar
tar -czf "${{ github.workspace }}/darwin_${{ runner.arch }}.tar.gz" *
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: darwin_${{ runner.arch }}
path: |
*.tar.gz
*.zip
# Windows build
win32:
runs-on: windows-2019
name: Windows
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
repository: pmmp/php-build-scripts
submodules: true
- name: Windows Depencies Install
run: choco install --no-progress wget
- name: "Building php bin"
run: .\windows-compile-vs.bat
env:
VS_EDITION: Enterprise
SOURCES_PATH: ${{ github.workspace }}\pocketmine-php-sdk
- name: show log
run: type compile.log
- name: Rename files
shell: node {0}
run: |
const fs = require("fs");
const path = require("path");
const files = fs.readdirSync(process.cwd()).filter(file => file.endsWith(".zip"));
for (const zip of files) {
console.log("File:", path.join(process.cwd(), zip));
if (/debug/i.test(zip)) fs.rmSync(path.join(process.cwd(), zip));
else fs.renameSync(path.join(process.cwd(), zip), path.join(process.cwd(), "win32_x64.zip"));
}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Windows
path: "*.zip"
# Upload to bucket
upload:
runs-on: ubuntu-latest
needs:
- win32
- macos
- linux
- android
steps:
- uses: actions/checkout@v3
name: Code checkout
- uses: actions/setup-node@v3.6.0
name: Setup node.js
with:
node-version: latest
- name: Install node depencies
run: npm install --no-save
- name: Download tarbals
uses: actions/download-artifact@v3
with:
path: ./phpOutput
- name: Upload to bucket
run: node .github/uploadphp/index.mjs php_bin phpOutput
timeout-minutes: 25
env:
OCI_AUTHKEY: ${{ secrets.OCI_AUTHKEY }}

112
.github/workflows/spigotBuild.yaml vendored Normal file
View File

@ -0,0 +1,112 @@
name: Spigot Build
on:
workflow_dispatch:
schedule:
- cron: "0 0 */2 * 0"
push:
branches:
- main
paths:
- ".github/workflows/spigotBuild.yaml"
- ".github/spigotBuilld/**/*"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version:
- latest
- "1.19.2"
- "1.19.1"
- "1.19"
- "1.18.2"
- "1.18.1"
- "1.18-rc3"
- "1.18-pre8"
- "1.18-pre5"
- "1.18"
- "1.17.1"
- "1.17"
- "1.16.5"
- "1.16.4"
- "1.16.3"
- "1.16.2"
- "1.16.1"
- "1.15.2"
- "1.15.1"
- "1.15"
- "1.14.4"
- "1.14.3-pre4"
- "1.14.3"
- "1.14.2"
- "1.14.1"
- "1.14-pre5"
- "1.14"
- "1.13.2"
- "1.13.1"
- "1.13-pre7"
- "1.13"
- "1.12.2"
- "1.12.1"
- "1.12"
- "1.11.2"
- "1.11.1"
- "1.11"
- "1.10.2"
- "1.10"
- "1.9.4"
- "1.9.2"
- "1.9"
- "1.8.8"
- "1.8.7"
- "1.8.6"
- "1.8.5"
- "1.8.4"
- "1.8.3"
- "1.8"
steps:
- name: Install ${{ startsWith(matrix.version, 'latest') && '19' || (startsWith(matrix.version, '1.19')||startsWith(matrix.version, '1.18')) && '17' || startsWith(matrix.version, '1.17') && '16' || '8' }} java
uses: actions/setup-java@v3
continue-on-error: true
with:
distribution: liberica
java-version: ${{ (startsWith(matrix.version, 'latest')||startsWith(matrix.version, '1.19')||startsWith(matrix.version, '1.18')) && '17' || startsWith(matrix.version, '1.17') && '16' || '8' }}
- name: Build
continue-on-error: true
run: |
wget -qO build.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar build.jar --rev "${{ matrix.version || 'latest' }}"
- name: Upload to actifial
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.version || 'latest' }}
path: "*.jar"
# Upload
upload:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
name: Code checkout
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: latest
- name: Install node depencies
run: npm install --no-save
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Upload to actifial
run: node .github/uploadToBucket.ts SpigotBuild artifacts
env:
OCI_AUTHKEY: ${{ secrets.OCI_AUTHKEY }}

5
.gitignore vendored
View File

@ -3,4 +3,7 @@ node_modules/
# Typescript
packages/**/*.js
packages/**/*.d.ts
packages/**/*.d.ts
# PHP Pre builds
phpOutput/