Skip to content

Commit

Permalink
Merge pull request #31 from FusionAuth/feature/improve-readme-add-wor…
Browse files Browse the repository at this point in the history
…kflow

Improving README and adding workflow to test the library
  • Loading branch information
vcampitelli authored Mar 19, 2024
2 parents 4693272 + 4a4943e commit c31f8da
Show file tree
Hide file tree
Showing 8 changed files with 350 additions and 42 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "docker"
directory: "/.github/fusionauth"
schedule:
interval: "weekly"
6 changes: 6 additions & 0 deletions .github/fusionauth/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DATABASE_USERNAME=fusionauth
DATABASE_PASSWORD=hkaLBM3RVnyYeYeqE3WI1w2e4Avpy0Wd5O3s3
FUSIONAUTH_APP_MEMORY=256M
FUSIONAUTH_APP_RUNTIME_MODE=development
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
53 changes: 53 additions & 0 deletions .github/fusionauth/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '3'

services:
db:
image: postgres:16.0-alpine
environment:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
networks:
- db_net
restart: unless-stopped
volumes:
- db_data:/var/lib/postgresql/data

fusionauth:
image: fusionauth/fusionauth-app:latest
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: jdbc:postgresql://db:5432/fusionauth
DATABASE_ROOT_USERNAME: ${POSTGRES_USER}
DATABASE_ROOT_PASSWORD: ${POSTGRES_PASSWORD}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
FUSIONAUTH_APP_MEMORY: ${FUSIONAUTH_APP_MEMORY}
FUSIONAUTH_APP_RUNTIME_MODE: ${FUSIONAUTH_APP_RUNTIME_MODE}
FUSIONAUTH_APP_SILENT_MODE: true
FUSIONAUTH_APP_URL: http://fusionauth:9011
FUSIONAUTH_APP_KICKSTART_FILE: /usr/local/fusionauth/kickstart.json
SEARCH_TYPE: database
networks:
- db_net
restart: unless-stopped
ports:
- 9011:9011
volumes:
- fusionauth_config:/usr/local/fusionauth/config
- ./kickstart.json:/usr/local/fusionauth/kickstart.json

networks:
db_net:
driver: bridge

volumes:
db_data:
fusionauth_config:
46 changes: 46 additions & 0 deletions .github/fusionauth/kickstart.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"variables": {
"applicationid": "e9fdb985-9173-4e01-9d73-ac2d60d1dc8e",
"apiKey": "72a8c464b86c3c9098c33da73f471b8a0352f6e14087ddc3",
"asymmetricKeyId": "#{UUID()}",
"defaultTenantId": "d7d09513-a3f5-401c-9685-34ab6c552453",
"adminEmail": "[email protected]",
"adminPassword": "password"
},
"apiKeys": [
{
"key": "#{apiKey}",
"description": "Unrestricted API key"
}
],
"requests": [
{
"method": "POST",
"url": "/api/key/generate/#{asymmetricKeyId}",
"tenantId": "#{defaultTenantId}",
"body": {
"key": {
"algorithm": "RS256",
"name": "For GitHub Actions",
"length": 2048
}
}
},
{
"method": "POST",
"url": "/api/user/registration",
"body": {
"user": {
"email": "#{adminEmail}",
"password": "#{adminPassword}"
},
"registration": {
"applicationId": "#{FUSIONAUTH_APPLICATION_ID}",
"roles": [
"admin"
]
}
}
}
]
}
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test Library

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

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

- name: Set up FusionAuth
working-directory: .github/fusionauth
run: docker compose up -d

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Waiting for FusionAuth App
run: timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9011)" != "200" ]]; do sleep 5; done' || false

- name: Run test suite
run: composer run test
Loading

0 comments on commit c31f8da

Please sign in to comment.