Skip to content

add windows tests and build #14

add windows tests and build

add windows tests and build #14

Workflow file for this run

name: Build and Test FastCSV
on:
push:
pull_request:
types: [opened, synchronize, reopened]
jobs:
test_basic:
name: basic PHP ${{ matrix.php }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
php: [ 8.4 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Initialize submodules
run: |
git submodule update --init --recursive
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Verify submodule files
run: |
echo "Checking if lib directory and files exist:"
ls -la lib/
echo "Checking specific source files:"
test -f "lib/arena.c" && echo "arena.c exists" || echo "arena.c missing"
test -f "lib/csv_config.c" && echo "csv_config.c exists" || echo "csv_config.c missing"
test -f "lib/csv_reader.c" && echo "csv_reader.c exists" || echo "csv_reader.c missing"
test -f "lib/csv_writer.c" && echo "csv_writer.c exists" || echo "csv_writer.c missing"
test -f "lib/csv_parser.c" && echo "csv_parser.c exists" || echo "csv_parser.c missing"
test -f "lib/csv_utils.c" && echo "csv_utils.c exists" || echo "csv_utils.c missing"
- name: Validate package.xml if it exists
run: |
if [ -f package.xml ]; then
echo "Found package.xml, validating structure..."
php -l package.xml && echo "package.xml is valid XML"
if [ -d tests ]; then
for file in tests/*.phpt; do
if [ -f "$file" ]; then
grep $(basename $file) package.xml >/dev/null || echo "Warning: $file not found in package.xml"
fi
done
fi
else
echo "No package.xml found, skipping PECL validation"
fi
- name: Configure and build FastCSV extension
run: |
export NO_INTERACTION=1
export REPORT_EXIT_STATUS=1
export SKIP_SLOW_TESTS=1
phpize
./configure
make
- name: Run FastCSV tests
run: |
export NO_INTERACTION=1
export REPORT_EXIT_STATUS=1
export SKIP_SLOW_TESTS=1
make test
get-windows-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.extension-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get the extension matrix
id: extension-matrix
uses: php/php-windows-builder/extension-matrix@v1
test_windows:
name: Windows PHP ${{ matrix.php-version }} ${{ matrix.arch }} ${{ matrix.ts }}
needs: get-windows-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJson(needs.get-windows-matrix.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Verify submodule files
run: |
echo "Checking if lib directory and files exist:"
dir lib\
echo "Checking specific source files:"
if (Test-Path "lib\arena.c") { echo "arena.c exists" } else { echo "arena.c missing" }
if (Test-Path "lib\csv_config.c") { echo "csv_config.c exists" } else { echo "csv_config.c missing" }
if (Test-Path "lib\csv_reader.c") { echo "csv_reader.c exists" } else { echo "csv_reader.c missing" }
if (Test-Path "lib\csv_writer.c") { echo "csv_writer.c exists" } else { echo "csv_writer.c missing" }
if (Test-Path "lib\csv_parser.c") { echo "csv_parser.c exists" } else { echo "csv_parser.c missing" }
if (Test-Path "lib\csv_utils.c") { echo "csv_utils.c exists" } else { echo "csv_utils.c missing" }
- name: Build and test extension
uses: php/php-windows-builder/extension@v1
with:
php-version: ${{ matrix.php-version }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}
test: true
test_all:
name: Full PHP ${{ matrix.php }}
needs: test_basic
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
php: [8.4, 8.3, 8.2]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Initialize submodules
run: |
git submodule update --init --recursive
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Verify submodule files
run: |
echo "Checking if lib directory and files exist:"
ls -la lib/
echo "Checking specific source files:"
test -f "lib/arena.c" && echo "arena.c exists" || echo "arena.c missing"
test -f "lib/csv_config.c" && echo "csv_config.c exists" || echo "csv_config.c missing"
test -f "lib/csv_reader.c" && echo "csv_reader.c exists" || echo "csv_reader.c missing"
test -f "lib/csv_writer.c" && echo "csv_writer.c exists" || echo "csv_writer.c missing"
test -f "lib/csv_parser.c" && echo "csv_parser.c exists" || echo "csv_parser.c missing"
test -f "lib/csv_utils.c" && echo "csv_utils.c exists" || echo "csv_utils.c missing"
- name: Validate package.xml if it exists
run: |
if [ -f package.xml ]; then
echo "Found package.xml, validating structure..."
php -l package.xml && echo "package.xml is valid XML"
if [ -d tests ]; then
for file in tests/*.phpt; do
if [ -f "$file" ]; then
grep $(basename $file) package.xml >/dev/null || echo "Warning: $file not found in package.xml"
fi
done
fi
else
echo "No package.xml found, skipping PECL validation"
fi
- name: Configure and build FastCSV extension
run: |
phpize
./configure
make
- name: Run FastCSV tests
run: |
export NO_INTERACTION=1
export REPORT_EXIT_STATUS=1
export SKIP_SLOW_TESTS=1
make test