|
| 1 | +name: Test Build on Push |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + |
| 6 | +defaults: |
| 7 | + run: |
| 8 | + shell: powershell |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: windows-latest |
| 13 | + permissions: write-all |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - name: Convert tag to version |
| 20 | + id: convert_tag |
| 21 | + run: | |
| 22 | + $version = "${{ github.ref }}" |
| 23 | + $version = $version.Replace('refs/tags/', '') |
| 24 | + echo "version=$version" >> "$env:GITHUB_ENV" |
| 25 | + echo "version=$version" |
| 26 | +
|
| 27 | + - name: Configure PowerShell |
| 28 | + run: | |
| 29 | + Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force |
| 30 | +
|
| 31 | + - name: Install ps2exe module to compile PowerShell scripts |
| 32 | + run: | |
| 33 | + Install-Module -Name ps2exe -Scope CurrentUser -Force |
| 34 | +
|
| 35 | + - name: Install Scoop, Nim and Nim dependencies |
| 36 | + run: | |
| 37 | + iex "& {$(irm get.scoop.sh)} -RunAsAdmin" |
| 38 | + echo "$env:USERPROFILE\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 39 | + scoop install 7zip git nim |
| 40 | + nimble update -y |
| 41 | + nimble install -y puppy |
| 42 | +
|
| 43 | + - name: Compile Nim applications |
| 44 | + run: | |
| 45 | + nim c --cc:vcc -d:release -d:static -o:bin\wsl-perf.exe wslperf.nim |
| 46 | +
|
| 47 | + - name: Compile PowerShell scripts |
| 48 | + run: | |
| 49 | + echo "Compile version ${{ env.version }}" |
| 50 | + Get-ChildItem -Path . -Filter '*.ps1' -Recurse -Exclude build-wslinternals.ps1,sched-wsl-dist-update.ps1 | ForEach-Object { |
| 51 | + Invoke-ps2exe -inputFile $_.Name -verbose |
| 52 | + } |
| 53 | +
|
| 54 | + - name: Create archive |
| 55 | + run: | |
| 56 | + Compress-Archive -Path .\*.exe, .\sched-wsl-dist-update.ps1 -DestinationPath "test-build.zip" |
0 commit comments