Feature/33 api fails when no pilots or logbook entries (#35)

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* api no longer fails when no pilots or logbook entries

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* refactoring

* refactoring

* refactoring

* refactoring

* adding test environment

* adding test environment
This commit was merged in pull request #35.
This commit is contained in:
2025-02-02 23:24:48 +00:00
committed by GitHub
parent 2199c6d016
commit 468837c985
97 changed files with 13360 additions and 27219 deletions

View File

@@ -1,62 +0,0 @@
name: 'API Build and Deploy'
on:
workflow_call:
inputs:
calling_workflow:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ inputs.calling_workflow }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: 'Setup Node'
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
- name: Install
run: |
npm install
- name: Build
shell: bash
run: |
npm run build -w api
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to registry
uses: docker/build-push-action@v6
with:
push: true
tags: noahspan/flying-api:${{ github.run_id }}
file: ./api/Dockerfile
context: ./api
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.calling_workflow }}
needs: build
steps:
- name: Log in to Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Update Container App
run: |
az container app update --name flying-api --resource-group noahspan --image noahspan-flying:${{ github.run_id }}

69
.github/workflows/api_build.yaml vendored Normal file
View File

@@ -0,0 +1,69 @@
name: 'API Build and Deploy'
on:
workflow_call:
inputs:
environment_name:
required: true
type: string
version_number:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ inputs.environment_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
api
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
run_install: false
- name: Install Nest CLI
run: |
npm install -g @nestjs/cli
- name: 'Setup Node'
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
- name: Install dependencies
run: |
pnpm install
- name: Build
run: |
pnpm --filter api build
- name: Deploy
if: ${{ github.event_name != 'pull_request' }}
run: |
pnpm --filter api --prod deploy ./.prod/api
- name: Log into Docker Hub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup Docker Buildx
if: ${{ github.event_name != 'pull_request' }}
uses: docker/setup-buildx-action@v3
- name: Build and push to registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v6
with:
push: true
tags: noahspan/flying-api:${{ inputs.version_number }}
context: .
target: api

View File

@@ -1,48 +0,0 @@
name: 'App Build and Deploy'
on:
workflow_call:
inputs:
calling_workflow:
required: true
type: string
deployment_environment:
required: true
type: string
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.calling_workflow }}
env:
VITE_API_URL: ${{ secrets.VITE_API_URL }}
VITE_CLIENT_ID: ${{ secrets.VITE_CLIENT_ID }}
VITE_TENANT_ID: ${{ secrets.VITE_TENANT_ID }}
VITE_REDIRECT_URL: ${{ secrets.VITE_REDIRECT_URL }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: 'Setup Node'
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
- name: Install
run: |
npm install
- name: Build
run: |
npm run build -w app
- name: Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: 'upload'
skip_app_build: true
app_location: ${{ vars.APP_LOCATION }}
deployment_environment: ${{ inputs.deployment_environment }}

69
.github/workflows/app_build.yaml vendored Normal file
View File

@@ -0,0 +1,69 @@
name: 'App Build and Deploy'
on:
workflow_call:
inputs:
calling_workflow:
required: true
type: string
version_number:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ inputs.calling_workflow }}
env:
VITE_API_URL: ${{ secrets.VITE_API_URL }}
VITE_CLIENT_ID: ${{ secrets.VITE_CLIENT_ID }}
VITE_TENANT_ID: ${{ secrets.VITE_TENANT_ID }}
VITE_REDIRECT_URL: ${{ secrets.VITE_REDIRECT_URL }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
app
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
run_install: false
- name: 'Setup Node'
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
- name: Install
run: |
pnpm install
- name: Build
run: |
pnpm --filter app build
- name: Deploy
if: ${{ github.event_name != 'pull_request' }}
run: |
pnpm --filter app --prod deploy ./.prod/app
- name: Setup Docker Buildx
if: ${{ github.event_name != 'pull_request' }}
uses: docker/setup-buildx-action@v3
- name: Log into Docker Hub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v6
with:
push: true
tags: noahspan/flying-app:${{ inputs.version_number }}
context: .
target: app

27
.github/workflows/deploy.yaml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Deploy
on:
workflow_call:
inputs:
app_name:
required: true
type: string
environment_name:
required: true
type: string
version_number:
required: true
type: string
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.environment_name }}
steps:
- name: Log in to Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Update Container App
run: |
az containerapp update --name ${{ inputs.app_name }}}}-${{ inputs.environment_name }} --revision-suffix ${{ inputs.version_number }} --resource-group noahspan --image docker.io/noahspan/${{ inputs.app_name }}:${{ inputs.version_number }}

View File

@@ -1,21 +0,0 @@
name: Dev
on:
push:
branches:
- feature/**
jobs:
build-deploy-api:
name: build-deploy-api
uses: ./.github/workflows/api.yaml
with:
calling_workflow: dev
secrets: inherit
build-deploy-app:
name: build-deploy-app
uses: ./.github/workflows/app.yaml
with:
calling_workflow: dev
deployment_environment: development
secrets: inherit

42
.github/workflows/main.yaml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Main
on:
push:
branches:
- main
jobs:
build-api:
name: build-api
uses: ./.github/workflows/api_build.yaml
with:
environment_name: test
version_number: ${{ github.run_id }}
secrets: inherit
deploy-api:
name: deploy-api
needs: build-api
uses: ./.github/workflows/deploy.yaml
with:
app_name: flying-app
environment_name: test
version_number: ${{ github.run_id }}
secrets: inherit
build-app:
name: build-app
uses: ./.github/workflows/app_build.yaml
with:
environment_name: test
version_number: ${{ github.run_id }}
secrets: inherit
deploy-app:
name: deploy-app
needs: build-app
uses: ./.github/workflows/deploy.yaml
with:
app_name: flying-app
environment_name: test
version_number: ${{ github.run_id }}
secrets: inherit

View File

@@ -2,36 +2,20 @@ name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
jobs:
build-deploy-api:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
name: build-deploy-api
uses: ./.github/workflows/api.yaml
build-api:
name: build-api
uses: ./.github/workflows/api_build.yaml
with:
calling_workflow: dev
environment_name: pull_request
version_number: ${{ github.run_id }}
secrets: inherit
build-deploy-app:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
name: build-deploy-app
uses: ./.github/workflows/app.yaml
build-app:
name: build-app
uses: ./.github/workflows/app_build.yaml
with:
calling_workflow: dev
deployment_environment: staging
environment_name: pull_request
version_number: ${{ github.run_id }}
secrets: inherit
close-pull-request-job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: 'close'

42
.github/workflows/tag.yaml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Tag
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build-api:
name: build-api
uses: ./.github/workflows/api_build.yaml
with:
environment_name: prod
version_number: ${{ github.run_id }}
secrets: inherit
deploy-api:
name: deploy-api
needs: build-api
uses: ./.github/workflows/deploy.yaml
with:
app_name: flying-api
environment_name: prod
version_number: ${{ github.run_id }}
secrets: inherit
build-app:
name: build-app
uses: ./.github/workflows/app_build.yaml
with:
environment_name: prod
version_number: ${{ github.run_id }}
secrets: inherit
deploy-app:
name: deploy-app
needs: build-app
uses: ./.github/workflows/deploy.yaml
with:
app_name: flying-app
environment_name: prod
version_number: ${{ github.run_id }}
secrets: inherit