-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
4,167 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: tests_keycloak | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
python-version: | ||
default: "3.10.4" | ||
type: string | ||
poetry-version: | ||
default: "1.8.5" | ||
type: string | ||
mint-database: | ||
default: "" | ||
type: string | ||
os: | ||
default: "ubuntu-latest" | ||
type: string | ||
|
||
jobs: | ||
poetry: | ||
name: Run tests with Keycloak (db ${{ inputs.mint-database }}) | ||
runs-on: ${{ inputs.os }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Start PostgreSQL service | ||
if: contains(inputs.mint-database, 'postgres') | ||
run: | | ||
docker run -d --name postgres \ | ||
-e POSTGRES_USER=cashu \ | ||
-e POSTGRES_PASSWORD=cashu \ | ||
-e POSTGRES_DB=cashu \ | ||
-p 5432:5432 postgres:16.4 | ||
until docker exec postgres pg_isready; do sleep 1; done | ||
- name: Prepare environment | ||
uses: ./.github/actions/prepare | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
poetry-version: ${{ inputs.poetry-version }} | ||
|
||
- name: Start Keycloak with Backup | ||
run: | | ||
docker compose -f keycloak/docker-compose-restore.yml up -d postgres | ||
docker compose -f keycloak/docker-compose-restore.yml up -d keycloak | ||
until curl -s http://localhost:8080/realms/master; do sleep 1; done | ||
- name: Verify Keycloak Import | ||
run: | | ||
docker logs $(docker ps -q --filter "ancestor=quay.io/keycloak/keycloak:25.0.6") | grep "Imported" | ||
- name: Run tests | ||
env: | ||
MINT_BACKEND_BOLT11_SAT: FakeWallet | ||
WALLET_NAME: test_wallet | ||
MINT_HOST: localhost | ||
MINT_PORT: 3337 | ||
MINT_TEST_DATABASE: ${{ inputs.mint-database }} | ||
TOR: false | ||
MINT_REQUIRE_AUTH: TRUE | ||
MINT_AUTH_OICD_DISCOVERY_URL: http://localhost:8080/realms/nutshell/.well-known/openid-configuration | ||
MINT_AUTH_OICD_CLIENT_ID: cashu-client | ||
run: | | ||
poetry run pytest tests/test_wallet_auth.py -v --cov=mint --cov-report=xml | ||
- name: Stop and clean up Docker Compose | ||
run: | | ||
docker compose -f keycloak/docker-compose-restore.yml down | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
services: | ||
postgres: | ||
image: postgres:16.4 | ||
volumes: | ||
- ./postgres_data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_DB: ${POSTGRES_DB} | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
networks: | ||
- keycloak_network | ||
|
||
keycloak: | ||
image: quay.io/keycloak/keycloak:25.0.6 | ||
command: start --import-realm | ||
volumes: | ||
- ./keycloak-export:/opt/keycloak/data/import | ||
environment: | ||
KC_HOSTNAME: localhost | ||
KC_HOSTNAME_PORT: 8080 | ||
KC_HOSTNAME_STRICT_BACKCHANNEL: false | ||
KC_HTTP_ENABLED: true | ||
KC_HOSTNAME_STRICT_HTTPS: false | ||
KC_HEALTH_ENABLED: true | ||
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN} | ||
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD} | ||
KC_DB: postgres | ||
KC_DB_URL: jdbc:postgresql://postgres/${POSTGRES_DB} | ||
KC_DB_USERNAME: ${POSTGRES_USER} | ||
KC_DB_PASSWORD: ${POSTGRES_PASSWORD} | ||
ports: | ||
- 8080:8080 | ||
restart: always | ||
depends_on: | ||
- postgres | ||
networks: | ||
- keycloak_network | ||
|
||
volumes: | ||
postgres_data: | ||
driver: local | ||
|
||
networks: | ||
keycloak_network: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.