Skip to content

Commit

Permalink
build on multiple versions of PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
mindplay-dk committed May 28, 2024
1 parent 61712a4 commit e0047f0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php_version: [8.1, 8.2, 8.3]

steps:
- name: Checkout code
Expand All @@ -14,4 +17,4 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y docker-compose

- name: Run tests
run: ./test.sh
run: ./test.sh ${{ matrix.php_version }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Dockerfile
FROM php:8.1-cli
ARG php_version=8.3
FROM php:${php_version}-cli

# Install dependencies
RUN apt-get update && apt-get install -y \
Expand Down
8 changes: 5 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# Ensure the script exits on any error
set -e

# Uncomment this while changing the Dockerfile
#docker compose down
#docker compose build
# If a PHP version is passed as an argument, rebuild with the new PHP version
if [ -n "$1" ]; then
docker compose down
docker compose build --build-arg php_version=$1
fi

# Start the Docker services if not already running
docker compose up -d
Expand Down

0 comments on commit e0047f0

Please sign in to comment.