2024-09-17 13:09:31 -04:00
name : CI
on :
push :
branches :
2024-09-17 13:29:40 -04:00
- 'master'
2024-09-17 13:24:47 -04:00
release :
types : [ created]
2024-09-17 13:09:31 -04:00
workflow_dispatch :
jobs :
build :
runs-on : ubuntu-latest
container :
image : php:8.3
steps :
- name : Checkout repository
2024-09-17 13:24:47 -04:00
uses : actions/checkout@v4
2024-09-17 13:09:31 -04:00
- name : Install dependencies
run : |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -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
2024-09-17 13:18:20 -04:00
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 --install-composer
2024-09-17 13:09:31 -04:00
cd .. && rm -rf ncc
- name : Build project
run : |
ncc build --config release --log-level debug
2024-09-17 13:36:25 -04:00
- name : Upload build artifacts
uses : actions/upload-artifact@v4
with :
name : ncc-build
2024-09-17 13:46:33 -04:00
path : build/release/net.nosial.configlib.ncc
2024-09-17 13:36:25 -04:00
2024-09-17 14:21:28 -04:00
test :
2024-09-17 13:36:25 -04:00
needs : build
2024-09-17 14:21:28 -04:00
runs-on : ubuntu-latest
container :
image : php:8.3
steps :
- name : Checkout repository
uses : actions/checkout@v4
- name : Download build artifacts
uses : actions/download-artifact@v4
with :
name : ncc-build
2024-09-17 14:27:59 -04:00
path : ncc-build # Adjust this to download the artifact directly under 'ncc-build'
2024-09-17 14:21:28 -04:00
2024-09-17 14:24:15 -04:00
- name : Install dependencies
run : |
apt update -yqq
apt install git libpq-dev libzip-dev zip make wget gnupg -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 --install-composer
cd .. && rm -rf ncc
2024-09-17 14:21:28 -04:00
- name : Install NCC package
run : |
2024-09-17 14:27:59 -04:00
ncc package install --package="ncc-build/net.nosial.configlib.ncc" --skip-dependencies --reinstall -y --log-level # Use the correct path to the downloaded package
2024-09-17 14:21:28 -04:00
- name : Install project dependencies
run : |
composer install
- name : Run PHPUnit tests
run : |
./vendor/bin/phpunit --configuration phpunit.xml
release :
needs : [ build, test]
2024-09-17 14:15:11 -04:00
permissions : write-all
2024-09-17 13:09:31 -04:00
runs-on : ubuntu-latest
container :
image : php:8.3
2024-09-17 13:29:40 -04:00
if : github.event_name == 'release'
2024-09-17 13:09:31 -04:00
steps :
- name : Checkout repository
2024-09-17 13:24:47 -04:00
uses : actions/checkout@v4
2024-09-17 13:09:31 -04:00
2024-09-17 13:36:25 -04:00
- name : Download build artifacts
uses : actions/download-artifact@v4
with :
name : ncc-build
2024-09-17 14:06:39 -04:00
path : ncc-build
2024-09-17 13:09:31 -04:00
2024-09-17 14:09:22 -04:00
- name : Upload to GitHub Release
uses : softprops/action-gh-release@v1
with :
files : |
ncc-build/net.nosial.configlib.ncc
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}