Skip to content

Commit

Permalink
feat: add restaurant, spa, excursion
Browse files Browse the repository at this point in the history
  • Loading branch information
skanin committed Aug 20, 2023
1 parent 7ed438f commit 42a5d12
Show file tree
Hide file tree
Showing 253 changed files with 36,719 additions and 76 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-and-deploy-api-excursion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and deploy excursion api
run-name: Build and deploy excursion api

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'excursion/api/**'

env:
DOTNET_APP_LOCATION: excursion/api
DOTNET_APP_NAME: Explore.Excursion
OUTPUT_LOCATION: ${{ github.workspace }}/outputs/api

jobs:
build:
name: Build function app
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Build function app
uses: ./.github/actions/build-dotnet-app
with:
app_location: ${{ env.DOTNET_APP_LOCATION }}
app_name: ${{ env.DOTNET_APP_NAME }}
output_location: ${{ env.OUTPUT_LOCATION }}

deploy-dev:
needs: [build]
runs-on: ubuntu-latest
environment: dev

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Deploy function app
uses: ./.github/actions/deploy-azure-function-app
with:
app_location: ${{ env.OUTPUT_LOCATION }}
app_artifact_name: ${{ env.DOTNET_APP_NAME }}
app_name: ${{ vars.API_FUNCTION_APP_NAME_EXCURSION }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
47 changes: 47 additions & 0 deletions .github/workflows/build-and-deploy-api-restaurant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and deploy restaurant api
run-name: Build and deploy restaurant api

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'restaurant/api/**'

env:
DOTNET_APP_LOCATION: restaurant/api
DOTNET_APP_NAME: Explore.Restaurant
OUTPUT_LOCATION: ${{ github.workspace }}/outputs/api

jobs:
build:
name: Build function app
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Build function app
uses: ./.github/actions/build-dotnet-app
with:
app_location: ${{ env.DOTNET_APP_LOCATION }}
app_name: ${{ env.DOTNET_APP_NAME }}
output_location: ${{ env.OUTPUT_LOCATION }}

deploy-dev:
needs: [build]
runs-on: ubuntu-latest
environment: dev

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Deploy function app
uses: ./.github/actions/deploy-azure-function-app
with:
app_location: ${{ env.OUTPUT_LOCATION }}
app_artifact_name: ${{ env.DOTNET_APP_NAME }}
app_name: ${{ vars.API_FUNCTION_APP_NAME_RESTAURANT }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Build and deploy api
run-name: Build and deploy api
name: Build and deploy spa api
run-name: Build and deploy spa api

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'project/api/**'
- 'spa/api/**'

env:
DOTNET_APP_LOCATION: project/api
DOTNET_APP_NAME: Company.Api
DOTNET_APP_LOCATION: spa/api
DOTNET_APP_NAME: Explore.Spa
OUTPUT_LOCATION: ${{ github.workspace }}/outputs/api

jobs:
Expand Down Expand Up @@ -43,5 +43,5 @@ jobs:
with:
app_location: ${{ env.OUTPUT_LOCATION }}
app_artifact_name: ${{ env.DOTNET_APP_NAME }}
app_name: ${{ vars.API_FUNCTION_APP_NAME }}
app_name: ${{ vars.API_FUNCTION_APP_NAME_SPA }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
62 changes: 62 additions & 0 deletions .github/workflows/build-and-deploy-webapp-excursion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and deploy excursion web
run-name: Build and deploy excursion web

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'excursion/web/**'

env:
WEB_APP_LOCATION: excursion/web
WEB_APP_ARTIFACT_LOCATION: dist # relative to WEB_APP_LOCATION

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3

- name: Install dependencies
shell: bash
working-directory: ${{ env.WEB_APP_LOCATION }}
run: |
npm ci
- name: Build project
shell: bash
working-directory: ${{ env.WEB_APP_LOCATION }}
run: |
npm run build
deploy-dev:
needs: [build]
runs-on: ubuntu-latest
environment: dev

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.azure_credentials }}

- name: Build and Deploy web app
uses: Azure/static-web-apps-deploy@v1
env:
VITE_AUTH_CLIENT_ID: ${{ vars.VITE_AUTH_CLIENT_ID_EXCURSION }}
VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL_EXCURSION }}
VITE_API_SCOPE: ${{ vars.VITE_API_SCOPE_EXCURSION }}
with:
azure_static_web_apps_api_token: ${{ secrets.WEBAPP_DEPLOYMENT_TOKEN_EXCURSION }}
repo_token: ${{ secrets.github_token }}
action: "upload"
app_location: ${{ env.WEB_APP_LOCATION }}
app_artifact_location: ${{ env.WEB_APP_ARTIFACT_LOCATION }}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build and deploy web app
run-name: Build and deploy web app
name: Build and deploy restaurant web
run-name: Build and deploy restaurant web

on:
workflow_dispatch:
Expand Down Expand Up @@ -51,9 +51,9 @@ jobs:
- name: Build and Deploy web app
uses: Azure/static-web-apps-deploy@v1
env:
VITE_AUTH_CLIENT_ID: ${{ secrets.VITE_AUTH_CLIENT_ID }}
VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }}
VITE_API_SCOPE: ${{ secrets.VITE_API_SCOPE }}
VITE_AUTH_CLIENT_ID: ${{ vars.VITE_AUTH_CLIENT_ID_RESTAURANT }}
VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL_RESTAURANT }}
VITE_API_SCOPE: ${{ vars.VITE_API_SCOPE_RESTAURANT }}
with:
azure_static_web_apps_api_token: ${{ secrets.WEBAPP_DEPLOYMENT_TOKEN }}
repo_token: ${{ secrets.github_token }}
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/build-and-deploy-webapp-spa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and deploy spa web
run-name: Build and deploy spa web

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'restaurant/web/**'

env:
WEB_APP_LOCATION: restaurant/web
WEB_APP_ARTIFACT_LOCATION: dist # relative to WEB_APP_LOCATION

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3

- name: Install dependencies
shell: bash
working-directory: ${{ env.WEB_APP_LOCATION }}
run: |
npm ci
- name: Build project
shell: bash
working-directory: ${{ env.WEB_APP_LOCATION }}
run: |
npm run build
deploy-dev:
needs: [build]
runs-on: ubuntu-latest
environment: dev

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.azure_credentials }}

- name: Build and Deploy web app
uses: Azure/static-web-apps-deploy@v1
env:
VITE_AUTH_CLIENT_ID: ${{ vars.VITE_AUTH_CLIENT_ID_SPA }}
VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL_SPA }}
VITE_API_SCOPE: ${{ vars.VITE_API_SCOPE_SPA }}
with:
azure_static_web_apps_api_token: ${{ secrets.WEBAPP_DEPLOYMENT_TOKEN_RESTAURANT }}
repo_token: ${{ secrets.github_token }}
action: "upload"
app_location: ${{ env.WEB_APP_LOCATION }}
app_artifact_location: ${{ env.WEB_APP_ARTIFACT_LOCATION }}
40 changes: 40 additions & 0 deletions .github/workflows/build-and-test-api-excursion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and test excursion api
run-name: Build and test excursion api

on:
workflow_dispatch:
pull_request:
branches: [main]
paths:
- 'excursion/api/**'

env:
DOTNET_APP_LOCATION: excursion/api
DOTNET_APP_NAME: Explore.Excursion
OUTPUT_LOCATION: ${{ github.workspace }}/outputs/api

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build api
uses: ./.github/actions/build-dotnet-app
with:
app_location: ${{ env.DOTNET_APP_LOCATION }}
app_name: ${{ env.DOTNET_APP_NAME }}
output_location: ${{ env.OUTPUT_LOCATION }}

test:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Run tests
uses: ./.github/actions/test-dotnet-app
with:
app_location: ${{ env.DOTNET_APP_LOCATION }}
40 changes: 40 additions & 0 deletions .github/workflows/build-and-test-api-restaurant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and test restaurant api
run-name: Build and test restaurant api

on:
workflow_dispatch:
pull_request:
branches: [main]
paths:
- 'restaurant/api/**'

env:
DOTNET_APP_LOCATION: restaurant/api
DOTNET_APP_NAME: Explore.Restaurant
OUTPUT_LOCATION: ${{ github.workspace }}/outputs/api

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build api
uses: ./.github/actions/build-dotnet-app
with:
app_location: ${{ env.DOTNET_APP_LOCATION }}
app_name: ${{ env.DOTNET_APP_NAME }}
output_location: ${{ env.OUTPUT_LOCATION }}

test:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Run tests
uses: ./.github/actions/test-dotnet-app
with:
app_location: ${{ env.DOTNET_APP_LOCATION }}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Build and test api
run-name: Build and test api
name: Build and test spa api
run-name: Build and test spa api

on:
workflow_dispatch:
pull_request:
branches: [main]
paths:
- 'project/api/**'
- 'spa/api/**'

env:
DOTNET_APP_LOCATION: project/api
DOTNET_APP_NAME: Company.Api
DOTNET_APP_LOCATION: spa/api
DOTNET_APP_NAME: Explore.Spa
OUTPUT_LOCATION: ${{ github.workspace }}/outputs/api

jobs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Build and test web app
run-name: Build and test web app
name: Build and test excursion web
run-name: Build and test excursion web

on:
workflow_dispatch:
pull_request:
branches: [main]
paths:
- 'project/web/**'
- .github/workflows/build-and-test-webapp.yaml
- 'excursion/web/**'
- .github/workflows/build-and-test-webapp-excursion.yaml
- .github/actions/build-web-app/**

env:
Expand Down
Loading

0 comments on commit 42a5d12

Please sign in to comment.