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:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
|
||||
build-release:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: php:8.3
|
||||
|
@ -21,7 +23,7 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: |
|
||||
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
|
||||
run: |
|
||||
|
@ -49,16 +51,67 @@ jobs:
|
|||
php "$NCC_DIR/INSTALL" --auto
|
||||
cd .. && rm -rf ncc
|
||||
|
||||
- name: Build project
|
||||
- name: Compile Project
|
||||
run: |
|
||||
ncc build --config release --log-level debug
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: TgBotLib_build
|
||||
name: release
|
||||
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:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
|
@ -92,7 +145,7 @@ jobs:
|
|||
fi
|
||||
|
||||
generate_phpdoc:
|
||||
needs: [build, check-phpdoc]
|
||||
needs: [build-release, build-release-compressed, check-phpdoc]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: php:8.3
|
||||
|
@ -119,11 +172,11 @@ jobs:
|
|||
- name: Upload PHPDoc
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: phpdoc
|
||||
name: documentation
|
||||
path: docs
|
||||
|
||||
test:
|
||||
needs: [build, check-phpunit]
|
||||
needs: [build-release, build-release-compressed, check-phpunit]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: php:8.3
|
||||
|
@ -186,7 +239,7 @@ jobs:
|
|||
php phpunit-11.3.phar --configuration phpunit.xml
|
||||
|
||||
release:
|
||||
needs: [build, test]
|
||||
needs: [build-release, build-release-compressed, test]
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
|
@ -197,16 +250,22 @@ jobs:
|
|||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download build artifacts
|
||||
- name: Download release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: TgBotLib_build
|
||||
path: TgBotLib_build
|
||||
name: release
|
||||
path: release
|
||||
|
||||
- name: Download release-compressed artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-compressed
|
||||
|
||||
- name: Upload to GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
TgBotLib_build/net.nosial.tgbotlib.ncc
|
||||
release/net.nosial.tgbotlib.ncc
|
||||
release-compressed/net.nosial.tgbotlib.gz.ncc
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
22
Makefile
22
Makefile
|
@ -1,20 +1,32 @@
|
|||
# Variables
|
||||
CONFIG ?= release
|
||||
DEFAULT_CONFIG ?= release
|
||||
LOG_LEVEL = debug
|
||||
OUTDIR = build/$(CONFIG)
|
||||
PACKAGE = $(OUTDIR)/net.nosial.tgbotlib.ncc
|
||||
PACKAGE = build/$(CONFIG)/net.nosial.tgbotlib.ncc
|
||||
|
||||
# Default Target
|
||||
all: build
|
||||
|
||||
# Build Steps
|
||||
build:
|
||||
ncc build --config=$(CONFIG) --log-level $(LOG_LEVEL)
|
||||
release:
|
||||
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
|
||||
ncc package install --package=$(PACKAGE) --skip-dependencies --build-source --reinstall -y --log-level $(LOG_LEVEL)
|
||||
|
||||
test: build
|
||||
[ -f phpunit.xml ] || { echo "phpunit.xml not found"; exit 1; }
|
||||
phpunit
|
||||
|
||||
clean:
|
||||
|
|
35
project.json
35
project.json
|
@ -38,6 +38,30 @@
|
|||
"build_type": "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",
|
||||
"build_type": "ncc",
|
||||
|
@ -45,6 +69,17 @@
|
|||
"define_constants": {
|
||||
"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