New pipelines and stuff

This commit is contained in:
Lilleman auf Larv 2024-02-04 04:15:44 +01:00
parent 80ebba33bc
commit 247b411011
5 changed files with 25 additions and 6 deletions

22
.gitea/test-and-build.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
curl \
--fail-with-body \
-H "Authorization: ${RUNNER_API_KEY}" \
-XPOST 192.168.1.186 \
-H 'Content-Type: application/json; charset=utf-8' \
--data-binary @- <<EOF
{
"commands": [
"git clone --single-branch --branch ${GITHUB_REF_NAME} --depth 1 ssh://git@gitea.larvit.se:21022/pwrpln/auth-api.git",
"cd auth-api",
"docker compose build",
"docker compose --profile tests build",
"docker compose run --rm tests",
"docker compose down -v --remove-orphans -t0",
"echo \"${DOCKER_PASSWORD}\" | docker login gitea.larvit.se --username ${DOCKER_USERNAME} --password-stdin",
"docker build -t gitea.larvit.se/pwrpln/auth-api:${GITHUB_REF_NAME} .",
"docker push gitea.larvit.se/pwrpln/auth-api:${GITHUB_REF_NAME}"
]
}
EOF

View File

View File

@ -1,4 +1,4 @@
Copyright 2022 Larv IT AB Copyright 2024 Larv IT AB
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: 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:

View File

@ -4,8 +4,6 @@ A tiny REST API for auth. Register accounts, auth with api-key or name/password,
## Quick start with docker compose ## Quick start with docker compose
Migrate database: `docker-compose run --rm db-migrations`
Start the API (on port 4000 by default): `docker-compose up -d` Start the API (on port 4000 by default): `docker-compose up -d`
Point your browser to `http://localhost:4000` to view the swagger API documentation. Point your browser to `http://localhost:4000` to view the swagger API documentation.
@ -20,7 +18,7 @@ The account field "role" is a bit special, in that if it contains "admin" as one
## Tests ## Tests
Run integration tests (Requires migrated database and started API): `docker-compose run --rm tests` Run integration tests: `docker-compose run --rm tests`
## Deploy a new version ## Deploy a new version

View File

@ -5,7 +5,6 @@ services:
image: postgres:15.2-alpine3.17 image: postgres:15.2-alpine3.17
user: postgres user: postgres
environment: environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=prutt - POSTGRES_PASSWORD=prutt
- POSTGRES_DB=auth - POSTGRES_DB=auth
# ports: # ports:
@ -26,7 +25,7 @@ services:
command: ["--wait", "up"] command: ["--wait", "up"]
depends_on: depends_on:
postgres: postgres:
condition: service_started condition: service_healthy
api: api:
build: . build: .