|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ master ] |
| 6 | + |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Release version to create' |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build_and_test: |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - vm: windows-latest |
| 19 | + runs-on: ${{ matrix.vm }} |
| 20 | + name: Build and test ${{ matrix.vm }} |
| 21 | + steps: |
| 22 | + - name: Checkout repo |
| 23 | + uses: actions/checkout@v3 |
| 24 | + - name: Setup dotnet |
| 25 | + uses: actions/setup-dotnet@v2 |
| 26 | + with: |
| 27 | + dotnet-version: '8.0.x' |
| 28 | + include-prerelease: true |
| 29 | + - name: Setup zig |
| 30 | + if: ${{ github.event.inputs.version == '' }} |
| 31 | + uses: goto-bus-stop/setup-zig@v2 |
| 32 | + - name: Build (CI) |
| 33 | + if: ${{ github.event.inputs.version == '' }} |
| 34 | + run: | |
| 35 | + dotnet build -t:Pack src/PublishAotCross.nuproj |
| 36 | + dotnet publish -r linux-x64 -c Release test/Hello.csproj -p:StripSymbols=false |
| 37 | + - name: Upload test binary |
| 38 | + if: ${{ github.event.inputs.version == '' }} |
| 39 | + uses: actions/upload-artifact@v2 |
| 40 | + with: |
| 41 | + name: Hello |
| 42 | + path: test/bin/Release/net8.0/linux-x64/publish/Hello |
| 43 | + - name: Build (CD) |
| 44 | + if: ${{ github.event.inputs.version != '' }} |
| 45 | + run: dotnet build -t:Pack src/PublishAotCross.nuproj -p:Version=${{ github.event.inputs.version }} |
| 46 | + - name: Archive NuGet |
| 47 | + if: ${{ github.event.inputs.version != '' }} |
| 48 | + uses: actions/upload-artifact@v2 |
| 49 | + with: |
| 50 | + name: PublishAotCross.${{ github.event.inputs.version }}.nupkg |
| 51 | + path: src/bin/Debug/PublishAotCross.${{ github.event.inputs.version }}.nupkg |
| 52 | + - name: Create tag |
| 53 | + if: ${{ github.event.inputs.version != '' && github.actor == 'MichalStrehovsky' }} |
| 54 | + run: | |
| 55 | + git tag v${{ github.event.inputs.version }} |
| 56 | + git push origin v${{ github.event.inputs.version }} |
| 57 | +
|
| 58 | + validate: |
| 59 | + needs: build_and_test |
| 60 | + runs-on: ubuntu-latest |
| 61 | + name: Try launching |
| 62 | + steps: |
| 63 | + - name: Download all artifacts |
| 64 | + uses: actions/download-artifact@v3 |
| 65 | + - name: Launch |
| 66 | + run: | |
| 67 | + chmod +x ./Hello/Hello |
| 68 | + ./Hello/Hello |
0 commit comments