diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e69de29..ba8faff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -0,0 +1,92 @@ +name: CI Pipeline + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: mbstring, ctype, common, zip + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y git libpq-dev libzip-dev zip make wget gnupg + + - 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 + sudo mv phive.phar /usr/local/bin/phive + + - name: Install PHPAB + run: phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C + + - name: Build project + run: make redist + + - name: Find NCC build directory + id: find-ncc-dir + run: echo "NCC_DIR=$(find build/ -type d -name 'ncc_*' | head -n 1)" >> $GITHUB_ENV + + - name: Upload NCC build directory + uses: actions/upload-artifact@v3 + with: + name: ncc-build + path: ${{ env.NCC_DIR }} + + - name: Build Debian package + run: make deb + + - name: Find Debian package + id: find-deb + run: echo "DEB_FILE=$(find build/ -type f -name '*.deb' | head -n 1)" >> $GITHUB_ENV + + - name: Upload Debian package + uses: actions/upload-artifact@v3 + with: + name: ncc-deb + path: ${{ env.DEB_FILE }} + + test: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Download NCC build directory + uses: actions/download-artifact@v3 + with: + name: ncc-build + path: build + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: mbstring, ctype, common, zip + + - name: Test NCC installation + run: | + 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 \ No newline at end of file