feat(ci): add GitHub Actions workflow for testing and Docker builds #17
+30
-15
@@ -7,7 +7,7 @@ on:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
build-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -22,18 +22,19 @@ jobs:
|
||||
context: .
|
||||
file: Dockerfile.dev
|
||||
target: dev
|
||||
load: true
|
||||
outputs: type=docker,dest=/tmp/graph-dev.tar
|
||||
tags: graph-dev:ci
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Run PHPUnit
|
||||
run: docker run --rm graph-dev:ci vendor/bin/phpunit --testdox
|
||||
|
||||
- name: Run PHPStan
|
||||
run: docker run --rm graph-dev:ci composer phpstan
|
||||
|
||||
docker-build:
|
||||
- name: Upload dev image
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: graph-dev-image
|
||||
path: /tmp/graph-dev.tar
|
||||
retention-days: 1
|
||||
build-prod:
|
||||
needs: build-dev
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -50,10 +51,24 @@ jobs:
|
||||
target: final
|
||||
push: false
|
||||
|
||||
- name: Build dev image (dev target)
|
||||
uses: docker/build-push-action@v5
|
||||
test:
|
||||
needs: build-dev
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download dev image
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.dev
|
||||
target: dev
|
||||
push: false
|
||||
name: graph-dev-image
|
||||
path: /tmp
|
||||
|
||||
- name: Load dev image
|
||||
run: docker load --input /tmp/graph-dev.tar
|
||||
|
||||
- name: Run PHPUnit
|
||||
run: docker run --rm graph-dev:ci vendor/bin/phpunit --testdox
|
||||
|
||||
- name: Run PHPStan
|
||||
run: docker run --rm graph-dev:ci composer phpstan
|
||||
|
||||
Reference in New Issue
Block a user