Skip to content

Commit

Permalink
Enable GitHub Actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensley committed Jan 30, 2021
1 parent d17a8b6 commit 5df0611
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 3 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Build

on:
push:
branches: [ main ]
tags: [ '*' ]
pull_request:
branches: [ main ]

env:
DotNetVersion: "5.0.x"
BuildConfiguration: "Release"
BuildParameters: "Source/PabloDraw/PabloDraw.csproj /clp:NoSummary /p:Configuration=Release /p:BuildVersion=${{ github.run_id }} /p:BuildBranch=${{ github.ref }}"

jobs:
build-windows:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}

- run: dotnet publish ${{ env.BuildParameters }} -f net5.0-windows -r win-x64

- uses: actions/upload-artifact@v2
with:
name: pablodraw-windows
path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0-windows/win-x64/publish/*

build-linux:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}

- run: dotnet publish ${{ env.BuildParameters }} -f net5.0 -r linux-x64

- uses: actions/upload-artifact@v2
with:
name: pablodraw-linux
path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0/linux-x64/publish/*

build-mac:

runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}

- uses: maxim-lobanov/setup-xamarin@v1
with:
mono-version: latest
xamarin-mac-version: latest
xcode-version: latest

# - name: Import code signing certificate
# if: github.event_name != 'pull_request'
# uses: apple-actions/import-codesign-certs@v1
# with:
# p12-file-base64: ${{ secrets.DEVID_CERTIFICATE_P12 }}
# p12-password: ${{ secrets.DEVID_CERTIFICATE_P12_PASSWORD }}

# - name: Enable code signing
# if: github.event_name != 'pull_request'
# run: echo "BuildParameters=${{ env.BuildParameters }} /p:EnableCodeSignBuild=True" >> $GITHUB_ENV

# - name: Set notarization credentials
# if: startsWith(github.ref, 'refs/tags/')
# run: |
# xcrun altool --store-password-in-keychain-item "AC_PASSWORD" -u "${{ secrets.AC_USERNAME }}" -p "${{ secrets.AC_PASSWORD }}"
# echo "BuildParameters=${{ env.BuildParameters }} /p:EnableNotarizationBuild=True" >> $GITHUB_ENV

- run: dotnet build ${{ env.BuildParameters }} -f net5.0 -r osx-x64

- uses: actions/upload-artifact@v2
with:
name: pablodraw-mac
path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0/osx-x64/PabloDraw.dmg

update-release:
needs: [ build-windows, build-mac ]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
steps:
- id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- id: get_release
uses: bruceadams/get-release@v1.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/download-artifact@v2
with:
name: pablodraw

# - uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.get_release.outputs.upload_url }}
# asset_path:
# asset_name:
# asset_content_type: application/octet-stream
33 changes: 33 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"args": [
"build",
"${workspaceFolder}/Source/PabloDraw/PabloDraw.csproj",
// "/p:BuildTarget=Linux",
"/p:Configuration=${config:var.BuildConfiguration}",
"/p:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
Expand All @@ -37,6 +38,38 @@
"clear": true
},
"problemMatcher": "$msCompile"
},
{
"label": "publish-pablodraw",
"command": "dotnet",
"type": "shell",
"args": [
"publish",
"${workspaceFolder}/Source/PabloDraw/PabloDraw.csproj",
// "/p:BuildTarget=Linux",
"/p:Configuration=Release",
"/p:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"clear": true
},
"problemMatcher": "$msCompile"
},
{
"label": "run-published",
"type": "shell",
"osx": {
"command": "${workspaceFolder}/artifacts/bin/Release/net5.0/osx-x64/PabloDraw.app/Contents/MacOS/PabloDraw",
},
"windows": {
"command": "${workspaceFolder}/artifacts/bin/Release/net5.0-windows/win-x64/publish/PabloDraw.exe",
},
"linux": {
"command": "${workspaceFolder}/artifacts/bin/Release/net5.0/linux-x64/publish/PabloDraw",
},
"problemMatcher": [ ]
}
]
}
13 changes: 10 additions & 3 deletions Source/PabloDraw/PabloDraw.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,34 @@
<PropertyGroup Condition="$(BuildTarget) == 'Windows'">
<TargetFramework>net5.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<IncludeNativeLibrariesForSelfExtract>True</IncludeNativeLibrariesForSelfExtract>
<!-- <PublishReadyToRun>True</PublishReadyToRun> -->
<DefineConstants>WINDOWS</DefineConstants>
<IncludeNativeLibrariesForSelfExtract>True</IncludeNativeLibrariesForSelfExtract>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
</PropertyGroup>

<PropertyGroup Condition="$(BuildTarget) == 'Linux'">
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<DefineConstants>LINUX</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="$(BuildTarget) == 'Mac'">
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<DefineConstants>MAC</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(BuildTarget) == 'Mac' and $(Configuration) == 'Release'">
<EnableDmgBuild>True</EnableDmgBuild>
<!-- <EnableCodeSigning>True</EnableCodeSigning> -->
<!-- <EnableNotarization>True</EnableNotarization> -->
</PropertyGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="$(Configuration) == 'Release' and !$(TargetFramework.StartsWith('net4'))">
<PropertyGroup Condition="$(Configuration) == 'Release'">
<PublishSingleFile>True</PublishSingleFile>
<SelfContained>True</SelfContained>
<PublishTrimmed>True</PublishTrimmed>
Expand All @@ -61,7 +68,7 @@
<ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.5.10" />
<PackageReference Include="Eto.Platform.Gtk" Version="2.5.10" Condition="$(BuildTarget) == 'Linux'" />
<!-- <PackageReference Include="Eto.Platform.Gtk2" Version="2.5.8" Condition="$(RuntimeIdentifier.StartsWith('linux-'))" /> -->
<!-- <PackageReference Include="Eto.Platform.Gtk2" Version="2.5.8" Condition="$(BuildTarget) == 'Linux'" /> -->
<PackageReference Include="Eto.Platform.Mac64" Version="2.5.10" Condition="$(BuildTarget) == 'Mac'" />
<PackageReference Include="Eto.Platform.Windows" Version="2.5.10" Condition="$(BuildTarget) == 'Windows'" />
<!-- <PackageReference Include="Eto.Platform.Wpf" Version="2.5.10" Condition="$(BuildTarget) == 'Windows'" /> -->
Expand Down

0 comments on commit 5df0611

Please sign in to comment.