Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #13
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
name: "Build and Test" | |
on: | |
push: | |
branches-ignore: | |
- master | |
jobs: | |
# Build a docker image for a specific version and using a given target | |
build_docker_image: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [ base, behat ] | |
php-version: [7.2, 7.3] | |
steps: | |
- | |
name: "Checkout Sourcecode" | |
uses: actions/checkout@v2 | |
- | |
name: "Set up Docker Buildx" | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: "Cache Docker layers" | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-test-buildx-${{ matrix.php-version }}-${{ matrix.target }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-test-buildx-${{ matrix.php-version }}-${{ matrix.target }}- | |
${{ runner.os }}-test-buildx-${{ matrix.php-version }}- | |
- | |
name: "Build Image for php ${{ matrix.php-version }} (${{ matrix.target }})" | |
uses: docker/build-push-action@v2 | |
with: | |
load: true | |
tags: ci/croneu/neos:${{ matrix.php-version }}-${{ matrix.target }} | |
target: ${{ matrix.target }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max | |
- | |
name: "Save Docker Image" | |
run: docker save ci/croneu/neos:${{ matrix.php-version }}-${{ matrix.target }} | gzip > docker-neos-${{ matrix.target }}.tar.gz | |
- name: "Upload Docker Image as Artifact" | |
uses: actions/upload-artifact@v2 | |
with: | |
name: docker-neos-${{ matrix.php-version }}-${{ matrix.target }} | |
path: docker-neos-${{ matrix.target }}.tar.gz | |
test_docker_image: | |
needs: build_docker_image | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: [7.2, 7.3] | |
# php version <> neos version compatibility | |
include: | |
- php-version: 7.2 | |
# patched with fluid fix (pin fluid to older version): | |
neos-version: 3.3-cron | |
base-distribution-url: "https://github.com/cron-eu/neos-development-distribution" | |
composer-version: 1 | |
- php-version: 7.3 | |
neos-version: 4.3 | |
base-distribution-url: "https://github.com/neos/neos-development-distribution" | |
composer-version: 2 | |
steps: | |
- | |
name: "Download artifacts" | |
uses: actions/[email protected] | |
with: | |
name: docker-neos-${{ matrix.php-version }}-base | |
- | |
name: "Load docker image" | |
run: docker load -i docker-neos-base.tar.gz | |
- | |
name: "Run the docker DB container (mariadb:10.3)" | |
# use the official mariadb image using default values (user/pass etc.) | |
run: | | |
docker run -d --name=db \ | |
--env="MYSQL_DATABASE=db" \ | |
--env="MYSQL_USER=admin" \ | |
--env="MYSQL_PASSWORD=pass" \ | |
--env="MYSQL_RANDOM_ROOT_PASSWORD=yes" \ | |
--env="MYSQL_ROOT_PASSWORD=password" \ | |
mariadb:10.3 | |
- | |
name: "Run docker image (background)" | |
# note: this requires a bash shell | |
run: | | |
docker run --name=web --link=db:db \ | |
--env="REPOSITORY_URL=${{ matrix.base-distribution-url }}" \ | |
--env="COMPOSER_INSTALL_PARAMS=--prefer-dist --no-dev --no-progress" \ | |
--env="COMPOSER_MAJOR_VERSION=${{ matrix.composer-version }}" \ | |
--env="VERSION=${{ matrix.neos-version }}" \ | |
--env="SITE_PACKAGE=Neos.Demo" \ | |
ci/croneu/neos:${{ matrix.php-version }}-base & | |
- | |
name: "Wait for Neos provisioning (max. 240 seconds)" | |
run: | | |
i=0; while [ "$i" -le 24 ]; do | |
if docker logs web 2>&1 | grep "ready to handle connections" | |
then | |
break | |
else | |
echo "Waiting for web container to finish provisioning .." $(( i++ )) | |
sleep 10 | |
fi | |
done | |
- | |
name: "Output Docker logs before tests" | |
run: docker logs web | |
- | |
name: "Test if the Neos DemoSite renders OK" | |
run: | | |
docker run --rm --volumes-from=web --link=web alpine /bin/sh -c 'apk add curl -q \ | |
&& curl -s -L --head http://web | grep "HTTP/1.1 200 OK" \ | |
&& curl -s -L --head http://web | grep "X-Flow-Powered" \ | |
&& curl -s -L http://web | grep "This website is powered by Neos"' | |
- | |
name: "Store Docker output after tests" | |
run: docker logs web &> docker-run.out.txt | |
- | |
name: "Upload Docker output after tests as an artifact" | |
uses: actions/upload-artifact@v2 | |
with: | |
name: docker-run-output-${{ matrix.php-version }} | |
path: docker-run.out.txt | |
- | |
name: "Cleanup: Stop running docker containers" | |
run: docker stop web db | |
test_docker_behat_image: | |
needs: build_docker_image | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: [7.2, 7.3] | |
# php version <> neos version compatibility | |
include: | |
- php-version: 7.2 | |
# patched with fluid fix (pin fluid to older version): | |
neos-version: 3.3-cron | |
base-distribution-url: "https://github.com/cron-eu/neos-development-distribution" | |
composer-version: 1 | |
- php-version: 7.3 | |
neos-version: 4.3 | |
base-distribution-url: "https://github.com/neos/neos-development-distribution" | |
composer-version: 2 | |
steps: | |
- | |
name: "Download artifacts" | |
uses: actions/[email protected] | |
with: | |
name: docker-neos-${{ matrix.php-version }}-behat | |
- | |
name: "Load docker image" | |
run: docker load -i docker-neos-behat.tar.gz | |
- | |
name: "Run the docker DB container (mariadb:10.3)" | |
# use the official mariadb image using default values (user/pass etc.) | |
run: | | |
docker run -d --name=db \ | |
--env="MYSQL_DATABASE=db_behat" \ | |
--env="MYSQL_USER=admin" \ | |
--env="MYSQL_PASSWORD=pass" \ | |
--env="MYSQL_RANDOM_ROOT_PASSWORD=yes" \ | |
--env="MYSQL_ROOT_PASSWORD=password" \ | |
mariadb:10.3 | |
- | |
name: "Run a single behat test from the Neos.Neos package" | |
run: | | |
docker run --rm --link=db:db \ | |
--env="REPOSITORY_URL=${{ matrix.base-distribution-url }}" \ | |
--env="VERSION=${{ matrix.neos-version }}" \ | |
--env="COMPOSER_INSTALL_PARAMS=--prefer-dist --no-progress" \ | |
--env="COMPOSER_MAJOR_VERSION=${{ matrix.composer-version }}" \ | |
--env="SITE_PACKAGE=Neos.Demo" \ | |
ci/croneu/neos:${{ matrix.php-version }}-behat sh -c 's6-svwait -U /var/run/s6/services/selenium ; sudo -u www-data cd /data/www/Packages/Neos/Neos.Neos/Tests/Behavior /data/www/bin/behat Features/ExportImport.feature' | |
- | |
name: "Cleanup: Stop running docker containers" | |
run: docker stop db |