Skip to content

Commit

Permalink
feat: add CI (test/lint) action
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshack committed Jan 3, 2024
1 parent 9b17401 commit 0d996ef
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 3 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on:
push:
branches:
- main
pull_request:
branches:
- main

name: ci

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Login to Docker Hub
if: ${{ steps.release.outputs.release_created }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build
if: ${{ steps.release.outputs.release_created }}
uses: docker/build-push-action@v5
with:
push: true
tags: mdshack/shotshare:ci
cache-from: type=registry,ref=mdshack/shotshare:latest
file: ./.docker/Dockerfile
outputs: type=oci,dest=/tmp/image.tar

- name: Upload docker image
uses: actions/upload-artifact@v4
with:
name: docker-image
path: /tmp/image.tar

unit-tests:
runs-on: ubuntu-latest
steps:
- name: Download docker image
uses: actions/download-artifact@v4
with:
name: docker-image
path: /tmp/image.tar

- name: Load docker image
run: docker load --input /tmp/image.tar

- uses: addnab/docker-run-action@v3
with:
image: mdshack/shotshare:ci
run: /app/vendor/bin/pest

lint:
runs-on: ubuntu-latest
steps:
- name: Download docker image
uses: actions/download-artifact@v4
with:
name: docker-image
path: /tmp/image.tar

- name: Load docker image
run: docker load --input /tmp/image.tar

- uses: addnab/docker-run-action@v3
with:
image: mdshack/shotshare:ci
run: /app/vendor/bin/pint --test

# static-analysis:
# runs-on: ubuntu-latest
# steps:
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function register(): void
*/
public function boot(): void
{
if(config('app.force_https')) {
if (config('app.force_https')) {
URL::forceScheme('https');
}
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"nunomaduro/collision": "^7.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/phpstan": "^1.10",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
Expand Down
64 changes: 63 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,5 @@
// 'Example' => App\Facades\Example::class,
])->toArray(),

'force_https' => env("FORCE_HTTPS", false),
'force_https' => env('FORCE_HTTPS', false),
];

0 comments on commit 0d996ef

Please sign in to comment.