Updated Build system
This commit is contained in:
parent
9a4e537294
commit
a3049d3355
3 changed files with 123 additions and 17 deletions
83
.github/workflows/ncc_workflow.yml
vendored
83
.github/workflows/ncc_workflow.yml
vendored
|
@ -9,7 +9,9 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
|
|
||||||
|
build-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: php:8.3
|
image: php:8.3
|
||||||
|
@ -21,7 +23,7 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt update -yqq
|
apt update -yqq
|
||||||
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
apt install git libpq-dev libzip-dev zip make wget gnupg gcc -yqq
|
||||||
|
|
||||||
- name: Install phive
|
- name: Install phive
|
||||||
run: |
|
run: |
|
||||||
|
@ -49,16 +51,67 @@ jobs:
|
||||||
php "$NCC_DIR/INSTALL" --auto
|
php "$NCC_DIR/INSTALL" --auto
|
||||||
cd .. && rm -rf ncc
|
cd .. && rm -rf ncc
|
||||||
|
|
||||||
- name: Build project
|
- name: Compile Project
|
||||||
run: |
|
run: |
|
||||||
ncc build --config release --log-level debug
|
ncc build --config release --log-level debug
|
||||||
|
|
||||||
- name: Upload build artifacts
|
- name: Upload build artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: TgBotLib_build
|
name: release
|
||||||
path: build/release/net.nosial.tgbotlib.ncc
|
path: build/release/net.nosial.tgbotlib.ncc
|
||||||
|
|
||||||
|
build-release-compressed:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: php:8.3
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
apt update -yqq
|
||||||
|
apt install git libpq-dev libzip-dev zip make wget gnupg gcc -yqq
|
||||||
|
|
||||||
|
- name: Install phive
|
||||||
|
run: |
|
||||||
|
wget -O phive.phar https://phar.io/releases/phive.phar
|
||||||
|
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
||||||
|
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
||||||
|
gpg --verify phive.phar.asc phive.phar
|
||||||
|
chmod +x phive.phar
|
||||||
|
mv phive.phar /usr/local/bin/phive
|
||||||
|
|
||||||
|
- name: Install phab
|
||||||
|
run: |
|
||||||
|
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
||||||
|
|
||||||
|
- name: Install latest version of NCC
|
||||||
|
run: |
|
||||||
|
git clone https://git.n64.cc/nosial/ncc.git
|
||||||
|
cd ncc
|
||||||
|
make redist
|
||||||
|
NCC_DIR=$(find build/ -type d -name "ncc_*" | head -n 1)
|
||||||
|
if [ -z "$NCC_DIR" ]; then
|
||||||
|
echo "NCC build directory not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
php "$NCC_DIR/INSTALL" --auto
|
||||||
|
cd .. && rm -rf ncc
|
||||||
|
|
||||||
|
- name: Compile Project
|
||||||
|
run: |
|
||||||
|
ncc build --config release --log-level debug
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-compressed
|
||||||
|
path: build/release/net.nosial.tgbotlib.gz.ncc
|
||||||
|
|
||||||
|
|
||||||
check-phpunit:
|
check-phpunit:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -92,7 +145,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
generate_phpdoc:
|
generate_phpdoc:
|
||||||
needs: [build, check-phpdoc]
|
needs: [build-release, build-release-compressed, check-phpdoc]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: php:8.3
|
image: php:8.3
|
||||||
|
@ -119,11 +172,11 @@ jobs:
|
||||||
- name: Upload PHPDoc
|
- name: Upload PHPDoc
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: phpdoc
|
name: documentation
|
||||||
path: docs
|
path: docs
|
||||||
|
|
||||||
test:
|
test:
|
||||||
needs: [build, check-phpunit]
|
needs: [build-release, build-release-compressed, check-phpunit]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: php:8.3
|
image: php:8.3
|
||||||
|
@ -186,7 +239,7 @@ jobs:
|
||||||
php phpunit-11.3.phar --configuration phpunit.xml
|
php phpunit-11.3.phar --configuration phpunit.xml
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [build, test]
|
needs: [build-release, build-release-compressed, test]
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
|
@ -197,16 +250,22 @@ jobs:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download build artifacts
|
- name: Download release artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: TgBotLib_build
|
name: release
|
||||||
path: TgBotLib_build
|
path: release
|
||||||
|
|
||||||
|
- name: Download release-compressed artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-compressed
|
||||||
|
|
||||||
- name: Upload to GitHub Release
|
- name: Upload to GitHub Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
TgBotLib_build/net.nosial.tgbotlib.ncc
|
release/net.nosial.tgbotlib.ncc
|
||||||
|
release-compressed/net.nosial.tgbotlib.gz.ncc
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
22
Makefile
22
Makefile
|
@ -1,20 +1,32 @@
|
||||||
# Variables
|
# Variables
|
||||||
CONFIG ?= release
|
DEFAULT_CONFIG ?= release
|
||||||
LOG_LEVEL = debug
|
LOG_LEVEL = debug
|
||||||
OUTDIR = build/$(CONFIG)
|
PACKAGE = build/$(CONFIG)/net.nosial.tgbotlib.ncc
|
||||||
PACKAGE = $(OUTDIR)/net.nosial.tgbotlib.ncc
|
|
||||||
|
|
||||||
# Default Target
|
# Default Target
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
# Build Steps
|
# Build Steps
|
||||||
build:
|
release:
|
||||||
ncc build --config=$(CONFIG) --log-level $(LOG_LEVEL)
|
ncc build --config=release --log-level $(LOG_LEVEL)
|
||||||
|
release-compressed:
|
||||||
|
ncc build --config=release-compressed --log-level $(LOG_LEVEL)
|
||||||
|
release-executable:
|
||||||
|
ncc build --config=release-executable --log-level $(LOG_LEVEL)
|
||||||
|
release-executable-compressed:
|
||||||
|
ncc build --config=release-executable-compressed --log-level $(LOG_LEVEL)
|
||||||
|
debug:
|
||||||
|
ncc build --config=debug --log-level $(LOG_LEVEL)
|
||||||
|
debug-compressed:
|
||||||
|
ncc build --config=debug-compressed --log-level $(LOG_LEVEL)
|
||||||
|
|
||||||
|
build: release release-compressed release-executable release-executable-compressed debug debug-compressed
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
ncc package install --package=$(PACKAGE) --skip-dependencies --build-source --reinstall -y --log-level $(LOG_LEVEL)
|
ncc package install --package=$(PACKAGE) --skip-dependencies --build-source --reinstall -y --log-level $(LOG_LEVEL)
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
|
[ -f phpunit.xml ] || { echo "phpunit.xml not found"; exit 1; }
|
||||||
phpunit
|
phpunit
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
35
project.json
35
project.json
|
@ -38,6 +38,30 @@
|
||||||
"build_type": "ncc",
|
"build_type": "ncc",
|
||||||
"output": "build/release/%ASSEMBLY.PACKAGE%.ncc"
|
"output": "build/release/%ASSEMBLY.PACKAGE%.ncc"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "release-compressed",
|
||||||
|
"build_type": "ncc",
|
||||||
|
"output": "build/release/%ASSEMBLY.PACKAGE%.gz.ncc",
|
||||||
|
"options": {
|
||||||
|
"compression": "high"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "release-executable",
|
||||||
|
"build_type": "executable",
|
||||||
|
"output": "build/release/%ASSEMBLY.NAME%",
|
||||||
|
"options": {
|
||||||
|
"ncc_configuration": "release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "release-executable-compressed",
|
||||||
|
"build_type": "executable",
|
||||||
|
"output": "build/release/%ASSEMBLY.NAME%.gz",
|
||||||
|
"options": {
|
||||||
|
"ncc_configuration": "release-compressed"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "debug",
|
"name": "debug",
|
||||||
"build_type": "ncc",
|
"build_type": "ncc",
|
||||||
|
@ -45,6 +69,17 @@
|
||||||
"define_constants": {
|
"define_constants": {
|
||||||
"DEBUG": "1"
|
"DEBUG": "1"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "debug-compressed",
|
||||||
|
"build_type": "ncc",
|
||||||
|
"output": "build/debug/%ASSEMBLY.PACKAGE%.gz.ncc",
|
||||||
|
"define_constants": {
|
||||||
|
"DEBUG": "1"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"compression": "high"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue