You've already forked Php-Template
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b1e5470a07
|
|||
|
5f9ee939d6
|
|||
|
e9a3a5885f
|
|||
|
f12559d2c3
|
|||
|
b466495ae1
|
|||
|
4eb21ace55
|
|||
|
a3e54ce989
|
|||
|
403cb4c12e
|
|||
|
9f048e408c
|
|||
|
be570a3173
|
|||
|
6353a4f19e
|
|||
|
59bcf4d2a7
|
|||
|
89bc3e75ec
|
|||
|
fb04e9c390
|
|||
|
77d66abbe0
|
|||
|
52aa7abc2d
|
|||
|
b6256a7e1d
|
|||
|
59fa57d643
|
|||
|
199921fb83
|
|||
|
aaf772dc6d
|
|||
|
89fd169067
|
|||
|
a01a0c590b
|
|||
|
dfccf9ca4f
|
|||
|
011a1e77c0
|
|||
|
7c7b538616
|
|||
|
71fa18bc17
|
|||
|
7308f33de4
|
|||
|
d0d18fd603
|
|||
|
f57406f981
|
|||
|
e46bf5a6ec
|
|||
|
02acc9afbe
|
|||
|
cdb2b28cb7
|
|||
|
118e83414d
|
|||
|
d013641191
|
|||
|
a2d500d398
|
|||
|
7694f29f78
|
|||
|
c56a77d32c
|
@@ -7,8 +7,7 @@ name: 🏗️✨ Build Workflow
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
name: 🖥️🔨 Build
|
||||
name: 🖥️ 🔨 Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🛡️ 🔒 Add Siteworx CA Certificates
|
||||
@@ -28,10 +27,10 @@ jobs:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: 🏗️🔧 Set up Docker Buildx
|
||||
- name: 🏗️ 🔧 Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: 🐳🔨 Build Backend Container
|
||||
- name: 🐳 🔨 Build Backend Container
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
on:
|
||||
push: {}
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
name: 🧪✨ Tests Workflow
|
||||
|
||||
jobs:
|
||||
|
||||
LicenseCheck:
|
||||
name: License Check
|
||||
DatabaseMigrations:
|
||||
name: 🧪 ✨ Database Migrations
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -27,7 +29,68 @@ jobs:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Install Composer Libraries
|
||||
- name: 🏎️ 🏁 Start Support Containers
|
||||
run: |
|
||||
echo "Starting Support Containers"
|
||||
docker run --rm \
|
||||
--network "${{ env.JOB_CONTAINER_NAME }}-${{ gitea.job }}-network" \
|
||||
--name ${{ gitea.job }}-${{ gitea.run_id }}-postgres \
|
||||
-e POSTGRES_USER=postgres \
|
||||
-e POSTGRES_PASSWORD=postgres \
|
||||
-e POSTGRES_DB=postgres \
|
||||
-p 5432 \
|
||||
-d postgres:17
|
||||
|
||||
echo "Waiting for Postgres to start"
|
||||
sleep 10
|
||||
|
||||
- name: 💽 ⬆️ Run Migrations
|
||||
run: |
|
||||
docker run \
|
||||
--name ${{ gitea.run_id }}-migrate \
|
||||
--rm \
|
||||
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||
--network "${{ env.JOB_CONTAINER_NAME }}-${{ gitea.job }}-network" \
|
||||
-w ${{ github.workspace }} \
|
||||
siteworxpro/migrate:v4.18.3 -database "postgres://postgres:postgres@${{ gitea.job }}-${{ gitea.run_id }}-postgres:5432/postgres?sslmode=disable" -path db/migrations up
|
||||
|
||||
- name: 💽 ⬇️ Rollback Migrations
|
||||
run: |
|
||||
docker run \
|
||||
--name ${{ gitea.run_id }}-migrate \
|
||||
--rm \
|
||||
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||
--network "${{ env.JOB_CONTAINER_NAME }}-${{ gitea.job }}-network" \
|
||||
-w ${{ github.workspace }} \
|
||||
siteworxpro/migrate:v4.18.3 -database "postgres://postgres:postgres@${{ gitea.job }}-${{ gitea.run_id }}-postgres:5432/postgres?sslmode=disable" -path db/migrations down --all
|
||||
|
||||
- name: 🧨 💥 Tear Down Support Containers
|
||||
if: always()
|
||||
run: |
|
||||
docker stop ${{ gitea.job }}-${{ gitea.run_id }}-postgres
|
||||
|
||||
LibraryAudit:
|
||||
name: 🛡️ 🔒 Library Audit
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🛡️ 🔒 Add Siteworx CA Certificates
|
||||
run: |
|
||||
apt update && apt install -yq ca-certificates curl
|
||||
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
|
||||
update-ca-certificates
|
||||
|
||||
- name: 📖 🔍 Checkout Repository Code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: 🔑 🔐 Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: 📖 ✨ Install Composer Libraries
|
||||
run: |
|
||||
docker run --rm \
|
||||
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||
@@ -35,7 +98,45 @@ jobs:
|
||||
siteworxpro/composer \
|
||||
install --ignore-platform-reqs --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Run License Check
|
||||
- name: Run Library Audit
|
||||
run: |
|
||||
docker run --rm \
|
||||
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||
-w ${{ github.workspace }} \
|
||||
siteworxpro/composer \
|
||||
audit
|
||||
|
||||
LicenseCheck:
|
||||
name: 🛡️ 🔒 License Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: 🛡️ 🔒 Add Siteworx CA Certificates
|
||||
run: |
|
||||
apt update && apt install -yq ca-certificates curl
|
||||
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
|
||||
update-ca-certificates
|
||||
|
||||
- name: 📖 🔍 Checkout Repository Code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: 🔑 🔐 Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: 📖 ✨ Install Composer Libraries
|
||||
run: |
|
||||
docker run --rm \
|
||||
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||
-w ${{ github.workspace }} \
|
||||
siteworxpro/composer \
|
||||
install --ignore-platform-reqs --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: 🎟️ 🔬 Run License Check
|
||||
run: |
|
||||
docker run --rm \
|
||||
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||
@@ -44,7 +145,7 @@ jobs:
|
||||
run tests:license
|
||||
|
||||
CodeLint:
|
||||
name: Code Lint
|
||||
name: 📝 ✨ Code Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🛡️ 🔒 Add Siteworx CA Certificates
|
||||
@@ -64,7 +165,7 @@ jobs:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Install Composer Libraries
|
||||
- name: 📖 ✨ Install Composer Libraries
|
||||
run: |
|
||||
docker run --rm \
|
||||
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||
@@ -81,7 +182,7 @@ jobs:
|
||||
run tests:lint
|
||||
|
||||
CodeSniffer:
|
||||
name: Code Sniffer
|
||||
name: 🐙 🔍 Code Sniffer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🛡️ 🔒 Add Siteworx CA Certificates
|
||||
@@ -118,7 +219,7 @@ jobs:
|
||||
run tests:phpstan
|
||||
|
||||
UnitTests:
|
||||
name: Unit Tests
|
||||
name: 🧪 ✅ Unit Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🛡️ 🔒 Add Siteworx CA Certificates
|
||||
|
||||
63
README.md
63
README.md
@@ -1,13 +1,14 @@
|
||||
# Template
|
||||
|
||||
```shell
|
||||
export PHP_IDE_CONFIG=serverName=localhost
|
||||
```
|
||||
[](https://git.siteworxpro.com/rrise/php-template/-/commits/master)
|
||||
[](https://git.siteworxpro.com/rrise/php-template/-/commits/master)
|
||||
[](https://git.siteworxpro.com/rrise/php-template/-/releases)
|
||||
|
||||
## Dev Environment
|
||||
|
||||
```shell
|
||||
docker run --rm -v $(PWD):/app siteworxpro/composer run tests:all
|
||||
```
|
||||
### Prerequisites
|
||||
- Docker
|
||||
- Docker Compose
|
||||
|
||||
### migrations
|
||||
|
||||
@@ -16,11 +17,59 @@ create a new migration
|
||||
docker run --rm -v $(PWD):/app siteworxpro/migrate:v4.18.3 create -ext sql -dir /app/db/migrations -seq create_users_table
|
||||
```
|
||||
|
||||
|
||||
```text
|
||||
postgres://siteworxpro:password@localhost:5432/siteworxpro?sslmode=disable
|
||||
```
|
||||
|
||||
```shell
|
||||
docker run --rm -v $(PWD):/app siteworxpro/migrate:v4.18.3 -database "postgres://siteworxpro:password@localhost:5432/siteworxpro?sslmode=disable" -path /app/db/migrations up
|
||||
```
|
||||
|
||||
### Starting the Runtime
|
||||
```shell
|
||||
docker-compose up -d
|
||||
```
|
||||
### Start the server
|
||||
```shell
|
||||
docker exec -it template-dev-runtime-1 rr serve
|
||||
```
|
||||
|
||||
You can access the api at `http://localhost:9501/`
|
||||
|
||||
### Xdebug
|
||||
|
||||
xdebug needs to be built into the container before it will work
|
||||
```shell
|
||||
docker exec -it template-runtime-1 bin/xdebug.sh
|
||||
```
|
||||
|
||||
### Install the dependencies
|
||||
```shell
|
||||
docker run --rm -v $(PWD):/app siteworxpro/composer install --ignore-platform-reqs
|
||||
```
|
||||
|
||||
### Running all tests
|
||||
```shell
|
||||
docker run --rm -v $(PWD):/app siteworxpro/composer run tests:all
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
```text
|
||||
Copyright (c)2025 Siteworx Professionals, LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||
documentation
|
||||
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
|
||||
the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
```
|
||||
Reference in New Issue
Block a user