Skip to content

Commit

Permalink
Polish workflows a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
joelverhagen committed Dec 31, 2023
1 parent 50825d3 commit 32d51b0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 28 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: Continuous integration

on:
push:
branches: ['main']
branches:
- "*"
pull_request:
branches: ['main']
branches:
- "*"
workflow_dispatch:

env:
Expand All @@ -25,7 +27,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache: "npm"
cache-dependency-path: ${{ env.BUILD_PATH }}/package-lock.json

- name: Setup Pages
Expand All @@ -35,16 +37,16 @@ jobs:
- name: Restore dependencies
run: npm install
working-directory: ${{ env.BUILD_PATH }}

- name: Build
run: npm run build
working-directory: ${{ env.BUILD_PATH }}
env:
BASE_PATH: '${{ steps.pages.outputs.base_path }}'
BASE_PATH: "${{ steps.pages.outputs.base_path }}"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '${{ env.BUILD_PATH }}/dist'
path: "${{ env.BUILD_PATH }}/dist"

build-dotnet:
name: Build and deploy
Expand All @@ -59,21 +61,27 @@ jobs:
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json

- name: Restore workloads
run: dotnet workload restore

- name: Restore dependencies
run: dotnet restore

- name: Build debug
run: dotnet build --configuration Debug

- name: Test
run: dotnet test --no-build --logger "console;verbosity=normal"


- name: Build debug, no shared instances
run: dotnet build --configuration Debug /p:NoSharedInstances=true

- name: Build debug, no grid ToString
run: dotnet build --configuration Debug /p:EnableGridToString=false

- name: Build debug, dynamic FLUTE degree
run: dotnet build --configuration Debug /p:AllowDynamicFluteDegree=true

- name: Build release
run: dotnet build --configuration Release

- name: Publish for Windows
run: dotnet publish src/WebApp --configuration Release --output src/WebApp/bin/Release/publish --runtime win-x64 --no-self-contained /p:PublishReadyToRun=true
- name: Test
run: dotnet test --no-build --configuration Release --logger "console;verbosity=normal"

- name: Publish
run: dotnet publish src/WebApp --configuration Release --output src/WebApp/bin/publish --runtime linux-x64 --no-self-contained /p:PublishReadyToRun=true
34 changes: 23 additions & 11 deletions .github/workflows/deploy-azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:
contents: read

jobs:
build:
build-dotnet:
name: Build and deploy
runs-on: ubuntu-latest
environment: azure
Expand All @@ -26,27 +26,39 @@ jobs:
with:
submodules: recursive

- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json

- name: Restore workloads
run: dotnet workload restore

- name: Restore dependencies
run: dotnet restore

- name: Build release
run: dotnet build --configuration Release

- name: Test
run: dotnet test --no-build --configuration Release --logger "console;verbosity=normal"

- name: Publish
run: dotnet publish src/WebApp --configuration Release --output src/WebApp/bin/Release/publish --runtime linux-x64 --no-self-contained /p:PublishReadyToRun=true
run: dotnet publish src/WebApp --configuration Release --output src/WebApp/bin/publish --runtime linux-x64 --no-self-contained /p:PublishReadyToRun=true

- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Deploy staging
id: deploy-staging
uses: azure/webapps-deploy@v2
with:
app-name: factoriotools-staging
package: src/WebApp/bin/Release/publish
package: src/WebApp/bin/publish

- name: Send test request
run: |
Expand All @@ -69,7 +81,7 @@ jobs:
uses: azure/webapps-deploy@v2
with:
app-name: factoriotools
package: src/WebApp/bin/Release/publish
package: src/WebApp/bin/publish

- name: Send test request
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') }}
Expand Down

0 comments on commit 32d51b0

Please sign in to comment.