Skip to content

Laravel 10

Laravel 10 #50

Workflow file for this run

name: Laravel 10
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '7 3 * * *'
jobs:
test:
name: Test
runs-on: ubuntu-latest
container:
image: php:8.1-cli
steps:
- name: Checkout
uses: actions/checkout@v2
- name: GitHub Environment Variables Action
uses: FranzDiebold/[email protected]
- name: PHPUnit
run: |
apt update
apt install -y libzip-dev unzip
pecl install xdebug
docker-php-ext-enable xdebug
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
composer require orchestra/testbench:^v8 --dev
composer run test
- name: Lint
run: composer run lint
- name: Lint Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: src/stubs/Dockerfile
- name: codecov
uses: codecov/codecov-action@v1
with:
name: laravel-10
- name: install in real Laravel project
run: |
rm -rf laravel-demo
composer create-project --prefer-dist laravel/laravel laravel-demo "10.*"
cd laravel-demo && composer require --dev laravel-fans/docker:dev-${CI_ACTION_REF_NAME} && php artisan docker:publish
php artisan --version | awk '{print $3}' > .version
- name: Create Tar
run: tar -cvf laravel-demo.tar laravel-demo
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: laravel-demo
path: laravel-demo.tar
publish:
name: Publish Code and Docker
if: ${{ github.ref == 'refs/heads/main' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: laravel-demo
- name: Extract Tar
run: tar -xvf laravel-demo.tar
- name: Push code
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: laravel-demo
publish_branch: laravel-10
destination_dir: demo
allow_empty_commit: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Get Laravel version
working-directory: ./laravel-demo
run: |
echo "LARAVEL_VERSION=$(cat .version)" >> $GITHUB_ENV
echo "DOCKER_MANIFEST=$((DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect laravelfans/laravel:$(cat .version) > /dev/null && echo 'json') || echo '')" >> $GITHUB_ENV
echo "DOCKER_MANIFEST_DEV=$((DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect laravelfans/laravel:$(cat .version)-dev > /dev/null && echo 'json') || echo '')" >> $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
if: ${{ env.DOCKER_MANIFEST == '' || github.event_name == 'push' }}
with:
context: laravel-demo
platforms: linux/amd64,linux/arm64
push: true
tags: laravelfans/laravel:latest,laravelfans/laravel:10,laravelfans/laravel:${{ env.LARAVEL_VERSION }}
- name: Image digest
if: steps.docker_build.conclusion == 'success'
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Build and push dev
id: docker_build_dev
uses: docker/build-push-action@v3
if: ${{ env.DOCKER_MANIFEST_DEV == '' || github.event_name == 'push' }}
with:
context: laravel-demo
file: laravel-demo/Dockerfile.dev
platforms: linux/amd64,linux/arm64
push: true
tags: laravelfans/laravel:10-dev,laravelfans/laravel:${{ env.LARAVEL_VERSION }}-dev
- name: Image digest dev
if: steps.docker_build_dev.conclusion == 'success'
run: echo ${{ steps.docker_build_dev.outputs.digest }}