Skip to content

Commit

Permalink
ci: #52 laravel 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkcup committed Jun 19, 2023
1 parent f149d17 commit 3df789f
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 0 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/laravel-10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
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 }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![codecov](https://codecov.io/gh/laravel-fans/laravel-docker/branch/main/graph/badge.svg)](https://codecov.io/gh/laravel-fans/laravel-docker)
[![Laravel 8](https://github.com/laravel-fans/laravel-docker/workflows/Laravel%208/badge.svg)](https://github.com/laravel-fans/laravel-docker/actions/workflows/laravel-8.yml)
[![Laravel 9](https://github.com/laravel-fans/laravel-docker/workflows/Laravel%209/badge.svg)](https://github.com/laravel-fans/laravel-docker/actions/workflows/laravel-9.yml)
[![Laravel 10](https://github.com/laravel-fans/laravel-docker/workflows/Laravel%2010/badge.svg)](https://github.com/laravel-fans/laravel-docker/actions/workflows/laravel-10.yml)

Full Laravel production environment for Docker.

Expand Down

0 comments on commit 3df789f

Please sign in to comment.