-
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 #42 from brettt89/feature/new-builds
Add FPM and CLI builds
- Loading branch information
Showing
34 changed files
with
428 additions
and
1,403 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 |
---|---|---|
|
@@ -8,6 +8,7 @@ on: | |
pull_request: | ||
branches: | ||
- master | ||
- release/** | ||
# Also trigger on page_build, as well as release created events | ||
page_build: | ||
release: | ||
|
@@ -19,14 +20,13 @@ jobs: | |
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] | ||
distro: [apache, fpm, cli] | ||
exclude: | ||
- os: stretch | ||
php: 7.4 | ||
|
@@ -39,20 +39,10 @@ jobs: | |
uses: actions/checkout@v2 | ||
|
||
- name: Pull Docker images | ||
run: docker-compose -f docker-compose.test.yml pull | ||
run: docker-compose 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: Build Image | ||
run: ./build/build-image.sh ${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-data | ||
|
@@ -71,33 +61,35 @@ jobs: | |
env: | ||
FRAMEWORK: ${{ matrix.framework }} | ||
COMPOSER_HOME: ${{ steps.composer-data.outputs.dir }} | ||
run: docker-compose -f docker-compose.test.yml run create-project | ||
run: docker-compose 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 | ||
run: docker-compose 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 | ||
TAG: ${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | ||
run: docker-compose run sut | ||
|
||
- name: The job has failed | ||
if: ${{ failure() }} | ||
run: | | ||
docker-compose logs | ||
# 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] | ||
distro: [apache, fpm, cli] | ||
exclude: | ||
- os: buster | ||
php: 5.6 | ||
|
@@ -108,20 +100,10 @@ jobs: | |
uses: actions/checkout@v2 | ||
|
||
- name: Pull Docker images | ||
run: docker-compose -f docker-compose.test.yml pull | ||
run: docker-compose 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: Build Image | ||
run: ./build/build-image.sh ${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-data | ||
|
@@ -134,22 +116,25 @@ jobs: | |
path: ${{ steps.composer-data.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ matrix.framework }}-${{ matrix.php }} | ||
restore-keys: | | ||
${{ runner.os }}-composer-${{ matrix.framework }} | ||
${{ 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 | ||
run: docker-compose 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 | ||
run: docker-compose 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 | ||
TAG: ${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.os }} | ||
run: docker-compose run sut | ||
|
||
- name: The job has failed | ||
if: ${{ failure() }} | ||
run: | | ||
docker-compose logs |
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
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 |
---|---|---|
@@ -1,18 +1,66 @@ | ||
export LOG_LEVEL := $(findstring s,$(word 1, $(MAKEFLAGS))) | ||
ARG=$(filter-out $@,$(MAKECMDGOALS)) | ||
ARG = $(filter-out $@,$(MAKECMDGOALS)) | ||
TAG = $(if $(filter %,$(ARG)),$(ARG),7.4-apache-buster) | ||
|
||
.PHONY: all build clean $(ARG) | ||
ifndef FRAMEWORK | ||
FRAMEWORK = 4 | ||
endif | ||
|
||
.PHONY: all build build-image new-test create-project install-project test-build-image test clean $(ARG) | ||
all: | ||
@echo "Silverstripe Web - Docker image" | ||
@echo "Silverstripe Web - Docker image builder" | ||
@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 <regex> Build and tag all images. Filter using <regex> on tag structure." | ||
@echo " build-image <tag> Build and tag specific image." | ||
@echo | ||
@echo "Test Commands" | ||
@echo " new-test <tag> Start a new test using <tag>, Default: 7.4-apache-buster." | ||
@echo " test <tag> Execute tests, assumes project has been build." | ||
@echo " clean Delete all test data." | ||
@echo | ||
@echo "Advanced Test Commands" | ||
@echo " create-project <tag> Create new Silverstripe Project". | ||
@echo " Environment variable FRAMEWORK=3 to change version" | ||
@echo " install-project <tag> Install project dependancies" | ||
@echo " test-build-image <tag> Test the image has been built locally" | ||
@echo " build-test Build 'sut' test image, used for running tests" | ||
@echo | ||
@echo "Parameters" | ||
@echo " <regex> Regex for matching against tag. e.g. '7.4'" | ||
@echo " <tag> Tag to build/test. e.g. '5.6-apache-jessie'" | ||
|
||
build: | ||
@./build.sh $(filter-out $@,$(MAKECMDGOALS)) | ||
./build/build-regex.sh $(ARG) | ||
|
||
build-image: | ||
./build/build-image.sh $(TAG) | ||
|
||
new-test: | ||
@echo "Running new test" | ||
@echo " Tag: $(TAG)" | ||
@echo | ||
@$(MAKE) --quiet clean | ||
@$(MAKE) --quiet build-image $(TAG) | ||
@$(MAKE) --quiet test-build-image $(TAG) | ||
@FRAMEWORK=$(FRAMEWORK) $(MAKE) --quiet create-project $(TAG) | ||
@$(MAKE) --quiet install-project $(TAG) | ||
@$(MAKE) --quiet test $(TAG) | ||
|
||
create-project: | ||
TAG=$(TAG) FRAMEWORK=$(FRAMEWORK) docker-compose run create-project | ||
|
||
install-project: | ||
TAG=$(TAG) docker-compose run install-project | ||
|
||
test-build-image: | ||
TAG=${TAG} docker-compose build | ||
|
||
build-test: | ||
TAG=$(TAG) docker-compose build sut | ||
|
||
test: | ||
TAG=$(TAG) docker-compose run sut | ||
|
||
clean: | ||
@docker rmi $(docker images | grep 'silversripe-web') $a | ||
docker-compose down --volume |
Oops, something went wrong.