feat: add OpenAPI support #11
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
on: | |
workflow_call: | |
secrets: | |
GCP_CREDENTIALS: | |
required: true | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '.github/**' | |
- 'kubernetes/**' | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
extract-version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.extract-version.outputs.VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set short git commit SHA | |
id: extract-version | |
run: | | |
echo ${{ github.sha }} | |
VERSION=$(git rev-parse --short ${{ github.sha }}) | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- name: Confirm git commit SHA output | |
run: echo ${{ steps.extract-version.outputs.VERSION }} | |
test: | |
runs-on: ubuntu-latest | |
if: ${{ !github.event.act }} | |
services: | |
postgres: | |
image: postgres:16 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: hypolia_api_test | |
options: >- | |
--health-cmd="pg_isready -U postgres" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Setup Node.JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.14.0' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run tests | |
run: pnpm run test | |
build: | |
if: ${{ !github.event.act }} | |
needs: [ extract-version, test ] | |
uses: hypolia/infrastructure/.github/workflows/gcp-cloud-build.yaml@main | |
with: | |
registry: europe-west1-docker.pkg.dev/nathael-dev | |
ref: main | |
repository: hypolia/api | |
tag: ${{ needs.extract-version.outputs.version }} | |
worker_pool: projects/nathael-dev/locations/europe-west1/workerPools/cicd-pool | |
secrets: | |
PAT: ${{ secrets.GITHUB_TOKEN }} | |
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} |