|
| 1 | +name: Debug Build and Test |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build-debug: |
| 7 | + runs-on: windows-2022 |
| 8 | + |
| 9 | + env: |
| 10 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout and Initialise |
| 14 | + uses: actions/checkout@v3 |
| 15 | + |
| 16 | + # Get Date and time |
| 17 | + - name: Set Date Output |
| 18 | + id: date |
| 19 | + shell: pwsh |
| 20 | + run: | |
| 21 | + echo "date-month=$(Get-Date -Format 'yyyy-MM')" >> $GITHUB_ENV |
| 22 | + echo "date-time=$(Get-Date -Format 'yyyy-MM-dd_HH-mm')" >> $GITHUB_ENV |
| 23 | +
|
| 24 | + # Get Dalamud version from project file |
| 25 | + - name: Extract Project Dalamud Version |
| 26 | + id: project-dalamud-version |
| 27 | + shell: pwsh |
| 28 | + run: | |
| 29 | + [xml]$xml = Get-Content "./DelvCD/DelvCD.csproj" |
| 30 | + $dalamudVersion = $xml.Project.PropertyGroup.DalamudCIDist |
| 31 | + echo "dalamud-version=$dalamudVersion" >> $GITHUB_ENV |
| 32 | +
|
| 33 | + # Set Dalamud Version Normalised URL Env |
| 34 | + - name: Set Dalamud Version Normalised URL Env |
| 35 | + id: dalamud-norm-url |
| 36 | + shell: pwsh |
| 37 | + run: | |
| 38 | + $url = if ('${{ env.dalamud-version }}' -eq 'release') { '' } else { '${{ env.dalamud-version }}' } |
| 39 | + echo "url=$url" >> $GITHUB_ENV |
| 40 | +
|
| 41 | + # Request the version information from Dalamud |
| 42 | + - name: Get Dalamud Version JSON |
| 43 | + id: request-dalamud-version |
| 44 | + shell: pwsh |
| 45 | + run: | |
| 46 | + $DALAMUD_VER_INFO = Invoke-RestMethod -Uri https://goatcorp.github.io/dalamud-distrib/${{ env.url }}/version |
| 47 | + echo $DALAMUD_VER_INFO |
| 48 | + $DALAMUD_VER_INFO | ConvertTo-Json | Set-Content dalamud-version.json |
| 49 | +
|
| 50 | + # Cache the nuget packages and Dalamud build |
| 51 | + - name: Cache Dependencies |
| 52 | + id: cache-dependencies |
| 53 | + uses: actions/cache@v3 |
| 54 | + with: |
| 55 | + path: | |
| 56 | + ./dalamud |
| 57 | + ~/.nuget/packages |
| 58 | + key: ${{ runner.os }}-${{ hashFiles('**/*.csproj') }}-${{ hashFiles('dalamud-version.json') }} |
| 59 | + |
| 60 | + # If the cache didn't hit, download and extract Dalamud |
| 61 | + - name: Setup Dalamud |
| 62 | + if: steps.cache-dependencies.outputs.cache-hit != 'true' |
| 63 | + shell: pwsh |
| 64 | + run: | |
| 65 | + mkdir ./dalamud |
| 66 | + Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/${{ env.url }}/latest.zip -OutFile ./dalamud/latest.zip |
| 67 | + Expand-Archive -Path ./dalamud/latest.zip ./dalamud |
| 68 | +
|
| 69 | + # Restore, Build and Test |
| 70 | + - name: Restore project dependencies |
| 71 | + run: dotnet restore --verbosity normal |
| 72 | + |
| 73 | + - name: Build Debug |
| 74 | + run: dotnet build --no-restore --verbosity normal --configuration Debug |
| 75 | + |
| 76 | + - name: Test Debug |
| 77 | + run: dotnet test --no-build --verbosity normal --configuration Debug |
| 78 | + |
| 79 | + # Upload build artifact |
| 80 | + - name: Upload Artifact |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: DelvCD-debug-${{ github.sha }} |
| 84 | + path: | |
| 85 | + DelvCD/bin/x64/Debug |
| 86 | + !DelvCD/bin/x64/Debug/DelvCD |
0 commit comments