-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from brettt89/feature/php7.4-future-proofing
Restructure tags and add PHP 7.4
- Loading branch information
Showing
25 changed files
with
1,034 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
name: Test Silverstripe installation | ||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the master branch | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
# Also trigger on page_build, as well as release created events | ||
page_build: | ||
release: | ||
types: # This configuration does not affect the page_build event above | ||
- created | ||
jobs: | ||
build: | ||
# Job name is Greeting | ||
name: Build & Test | ||
# This job runs on Linux | ||
runs-on: ubuntu-latest | ||
env: | ||
distro: apache | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [stretch, buster] | ||
php: [7.2, 7.3, 7.4] | ||
framework: [3, 4] | ||
exclude: | ||
- os: stretch | ||
php: 7.4 | ||
framework: 3 | ||
- os: stretch | ||
php: 7.4 | ||
framework: 4 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Pull Docker images | ||
run: docker-compose -f docker-compose.test.yml pull | ||
|
||
- name: Docker Caching | ||
uses: satackey/[email protected] | ||
with: | ||
key: docker-cache-v2-${{ matrix.php }}-${{ env.distro }}-${{ matrix.os }}-{hash} | ||
restore-keys: | | ||
docker-cache-v2-${{ matrix.php }}-${{ env.distro }}-${{ matrix.os }}- | ||
- name: Build Images | ||
env: | ||
BUILD_DIR: ./src/${{ matrix.php }}/${{ env.distro }}/${{ matrix.os }} | ||
IMAGE: brettt89/silverstripe-web:${{ matrix.php }}-${{ env.distro }}-${{ matrix.os }} | ||
run: docker-compose -f docker-compose.test.yml build | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-data | ||
run: | | ||
echo "::set-output name=dir::$(composer config --global data-dir)" | ||
- name: Cache Composer Downloads | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-data.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ matrix.framework }}-${{ matrix.php }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ matrix.framework }} | ||
- name: Create Silverstripe ${{ matrix.framework }} test project | ||
env: | ||
FRAMEWORK: ${{ matrix.framework }} | ||
COMPOSER_HOME: ${{ steps.composer-data.outputs.dir }} | ||
run: docker-compose -f docker-compose.test.yml run create-project | ||
|
||
- name: Install Silverstripe test project | ||
env: | ||
COMPOSER_HOME: ${{ steps.composer-data.outputs.dir }} | ||
run: docker-compose -f docker-compose.test.yml run install-project | ||
|
||
- name: Run tests | ||
env: | ||
BUILD_DIR: ./src/${{ matrix.php }}/${{ env.distro }}/${{ matrix.os }} | ||
IMAGE: brettt89/silverstripe-web:${{ matrix.php }}-${{ env.distro }}-${{ matrix.os }} | ||
DISTRO: ${{ env.distro }} | ||
run: docker-compose -f docker-compose.test.yml run sut | ||
|
||
# Legacy PHP 5.6 and 7.1 tests | ||
build_legacy: | ||
# Job name is Greeting | ||
name: Legacy Build & Test | ||
# This job runs on Linux | ||
runs-on: ubuntu-latest | ||
env: | ||
distro: apache | ||
strategy: | ||
matrix: | ||
os: [jessie, stretch, buster] | ||
php: [5.6, 7.1] | ||
framework: [3, 4] | ||
exclude: | ||
- os: buster | ||
php: 5.6 | ||
- php: 5.6 | ||
framework: 4 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Pull Docker images | ||
run: docker-compose -f docker-compose.test.yml pull | ||
|
||
- name: Docker Caching | ||
uses: satackey/[email protected] | ||
with: | ||
key: docker-cache-v2-${{ matrix.php }}-${{ env.distro }}-${{ matrix.os }}-{hash} | ||
restore-keys: | | ||
docker-cache-v2-${{ matrix.php }}-${{ env.distro }}-${{ matrix.os }}- | ||
- name: Build Images | ||
env: | ||
BUILD_DIR: ./src/${{ matrix.php }}/${{ env.distro }}/${{ matrix.os }} | ||
IMAGE: brettt89/silverstripe-web:${{ matrix.php }}-${{ env.distro }}-${{ matrix.os }} | ||
run: docker-compose -f docker-compose.test.yml build | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-data | ||
run: | | ||
echo "::set-output name=dir::$(composer config --global data-dir)" | ||
- name: Cache Composer Downloads | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-data.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ matrix.framework }}-${{ matrix.php }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ matrix.framework }} | ||
- name: Create Silverstripe ${{ matrix.framework }} test project | ||
env: | ||
FRAMEWORK: ${{ matrix.framework }} | ||
COMPOSER_HOME: ${{ steps.composer-data.outputs.dir }} | ||
run: docker-compose -f docker-compose.test.yml run create-project | ||
|
||
- name: Install Silverstripe test project | ||
env: | ||
COMPOSER_HOME: ${{ steps.composer-data.outputs.dir }} | ||
run: docker-compose -f docker-compose.test.yml run install-project | ||
|
||
- name: Run tests | ||
env: | ||
BUILD_DIR: ./src/${{ matrix.php }}/${{ env.distro }}/${{ matrix.os }} | ||
IMAGE: brettt89/silverstripe-web:${{ matrix.php }}-${{ env.distro }}-${{ matrix.os }} | ||
DISTRO: ${{ env.distro }} | ||
run: docker-compose -f docker-compose.test.yml run sut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build.log |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
language: php | ||
dist: xenial | ||
os: linux | ||
services: | ||
- docker | ||
|
||
env: | ||
- FRAMEWORK=3 DISTRO=apache PHP=5.6 PLATFORM=jessie | ||
- FRAMEWORK=3 DISTRO=apache PHP=5.6 PLATFORM=stretch | ||
|
||
- FRAMEWORK=3 DISTRO=fpm PHP=5.6 PLATFORM=jessie | ||
- FRAMEWORK=3 DISTRO=fpm PHP=5.6 PLATFORM=stretch | ||
|
||
- FRAMEWORK=3 DISTRO=cli PHP=5.6 PLATFORM=jessie | ||
- FRAMEWORK=3 DISTRO=cli PHP=5.6 PLATFORM=stretch | ||
|
||
- FRAMEWORK=3 DISTRO=apache PHP=7.1 PLATFORM=jessie | ||
- FRAMEWORK=3 DISTRO=apache PHP=7.1 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=apache PHP=7.1 PLATFORM=buster | ||
|
||
- FRAMEWORK=3 DISTRO=fpm PHP=7.1 PLATFORM=jessie | ||
- FRAMEWORK=3 DISTRO=fpm PHP=7.1 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=fpm PHP=7.1 PLATFORM=buster | ||
|
||
- FRAMEWORK=3 DISTRO=cli PHP=7.1 PLATFORM=jessie | ||
- FRAMEWORK=3 DISTRO=cli PHP=7.1 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=cli PHP=7.1 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=apache PHP=7.1 PLATFORM=jessie | ||
- FRAMEWORK=4 DISTRO=apache PHP=7.1 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=apache PHP=7.1 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=fpm PHP=7.1 PLATFORM=jessie | ||
- FRAMEWORK=4 DISTRO=fpm PHP=7.1 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=fpm PHP=7.1 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=cli PHP=7.1 PLATFORM=jessie | ||
- FRAMEWORK=4 DISTRO=cli PHP=7.1 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=cli PHP=7.1 PLATFORM=buster | ||
|
||
- FRAMEWORK=3 DISTRO=apache PHP=7.2 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=apache PHP=7.2 PLATFORM=buster | ||
|
||
- FRAMEWORK=3 DISTRO=fpm PHP=7.2 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=fpm PHP=7.2 PLATFORM=buster | ||
|
||
- FRAMEWORK=3 DISTRO=cli PHP=7.2 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=cli PHP=7.2 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=apache PHP=7.2 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=apache PHP=7.2 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=fpm PHP=7.2 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=fpm PHP=7.2 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=cli PHP=7.2 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=cli PHP=7.2 PLATFORM=buster | ||
|
||
- FRAMEWORK=3 DISTRO=apache PHP=7.3 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=apache PHP=7.3 PLATFORM=buster | ||
|
||
- FRAMEWORK=3 DISTRO=fpm PHP=7.3 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=fpm PHP=7.3 PLATFORM=buster | ||
|
||
- FRAMEWORK=3 DISTRO=cli PHP=7.3 PLATFORM=stretch | ||
- FRAMEWORK=3 DISTRO=cli PHP=7.3 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=apache PHP=7.3 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=apache PHP=7.3 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=fpm PHP=7.3 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=fpm PHP=7.3 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=cli PHP=7.3 PLATFORM=stretch | ||
- FRAMEWORK=4 DISTRO=cli PHP=7.3 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=apache PHP=7.4 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=fpm PHP=7.4 PLATFORM=buster | ||
|
||
- FRAMEWORK=4 DISTRO=cli PHP=7.4 PLATFORM=buster | ||
|
||
cache: | ||
directories: | ||
- ~/docker_images | ||
- $HOME/.composer/cache/files | ||
|
||
before_install: | ||
- docker load -i ~/docker_images/images-${PHP}-${DISTRO}-${PLATFORM}.tar || true | ||
|
||
before_cache: | ||
- docker save -o ~/docker_images/images-${PHP}-${DISTRO}-${PLATFORM}.tar $(docker images brettt89/silverstripe-web -q) | ||
|
||
install: | ||
- docker run -d --name database --health-cmd='mysqladmin ping --silent' --env MYSQL_ALLOW_EMPTY_PASSWORD=true mysql:5.7 | ||
- composer create-project silverstripe/installer ~/site ^${FRAMEWORK} | ||
- cp examples/_ss_environment.php ~/site/_ss_environment.php | ||
- cp examples/.env ~/site/.env | ||
|
||
before_script: | ||
- env | sort | ||
- cd "src/${PHP}/${DISTRO}/${PLATFORM}" | ||
- image="brettt89/silverstripe-web:${PHP}-${DISTRO}-${PLATFORM}" | ||
|
||
script: | ||
- travis_retry docker build -t "$image" . | ||
- docker run -d --name web -p 80:80 --link database "$image" | ||
- docker cp ~/site/. web:/var/www/html | ||
- docker exec web chown -R www-data:www-data /var/www/html | ||
- while [ "$(docker inspect -f '{{.State.Health.Status}}' database)" != "healthy" ]; do sleep 1; done | ||
- travis_retry wget "http://localhost/dev/build" | ||
- docker logs web | ||
|
||
after_script: | ||
- docker images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export LOG_LEVEL := $(findstring s,$(word 1, $(MAKEFLAGS))) | ||
ARG=$(filter-out $@,$(MAKECMDGOALS)) | ||
|
||
.PHONY: all build clean $(ARG) | ||
all: | ||
@echo "Silverstripe Web - Docker image" | ||
@echo | ||
@echo "Basic Commands" | ||
@echo " build <regex> Build and tag all images. Filter using <regex> on tag structure." | ||
@echo " e.g. "7.4" for php7.4 builds, or "buster" for all buster builds." | ||
@echo " clean Delete all image tags / cache using." | ||
@echo | ||
|
||
build: | ||
@./build.sh $(filter-out $@,$(MAKECMDGOALS)) | ||
|
||
clean: | ||
@docker rmi $(docker images | grep 'silversripe-web') $a |
Oops, something went wrong.