Skip to content

Commit

Permalink
Merge pull request #195 from SCCapstone/192
Browse files Browse the repository at this point in the history
192: Workflows
  • Loading branch information
evan-scales authored Jan 23, 2024
2 parents 7c042c9 + 53298f6 commit b800faf
Show file tree
Hide file tree
Showing 24 changed files with 1,370 additions and 2,720 deletions.

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Builds, runs tests, publishes artifacts

name: Build ForcesUnite

on: push

jobs:
build-api:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
include-prerelease: true

- name: Build with .NET
run: |
cd FU.API
dotnet build
shell: pwsh

- name: Publish
run: |
cd FU.API
dotnet publish
shell: pwsh

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: .net-app
path: D:\a\PalmettoProgrammers\PalmettoProgrammers\FU.API\FU.API\bin

- name: Test
run: |
cd FU.API
dotnet test
shell: pwsh

build-spa:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '14'

- name: Install dependencies
run: |
cd FU.SPA
npm install
- name: Run linter
run: |
cd FU.SPA
npm run lint
- name: Check formatting
run: |
cd FU.SPA
npm run format-check
106 changes: 106 additions & 0 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Builds and deploys API and SPA to Azure

name: Release

on:
push:
branches:
- prod

jobs:
build-api:
name: Build API Job
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
include-prerelease: true

- name: Build with .NET
run: |
cd FU.API
dotnet build --configuration Release
shell: pwsh

- name: Publish
run: |
cd FU.API
dotnet publish -c Release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: .net-app
path: D:\a\PalmettoProgrammers\PalmettoProgrammers\FU.API\FU.API\bin

deploy-api:
name: Deploy API Job
runs-on: windows-latest
needs: build-api
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT

steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: .net-app

- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_87D22017AF9A4422BFA98ED1ADF7422D }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_1C7528FFBA32419CB7F9CE5531B3980E }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_1AD9A60BDBC9485E80D6B3728DDF6729 }}

- name: Deploy API
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'fuapi'
slot-name: 'Production'
package: .

build-and-deploy-spa:
name: Build & Deploy SPA Job
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false

- name: Build and Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_JOLLY_GLACIER_0AE92C40F }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/FU.SPA" # App source code path
output_location: "dist"

comment:
name: Comment on Merge Request
runs-on: ubuntu-latest
needs: [deploy-api, build-and-deploy-spa]

steps:
- uses: actions/checkout@v4

- name: Comment on Merge Request
run: |
branch_name=$(echo "${{ github.event.head_ref }}" | sed 's/refs\/heads\///')
gh pr comment $branch_name -b "Deployed to https://jolly-glacier-0ae92c40f.4.azurestaticapps.net/"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

24 changes: 0 additions & 24 deletions .github/workflows/tests-workflow.yml

This file was deleted.

4 changes: 3 additions & 1 deletion FU.SPA/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"sourceType": "module"
},
"plugins": ["react", "react-refresh"],
"rules": {},
"rules": {
"react/prop-types": "off"
},
"settings": {
"react": {
"version": "detect"
Expand Down
Loading

0 comments on commit b800faf

Please sign in to comment.