-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions workflow for automating builds
- Loading branch information
1 parent
58fc228
commit 3458b98
Showing
7 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: 'Build' | ||
|
||
inputs: | ||
solution: | ||
required: true | ||
configuration: | ||
required: false | ||
default: Release | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Restore Nuget | ||
id: restore | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
shell: pwsh | ||
run: msbuild ${{inputs.solution}} /t:Restore /p:Configuration=${{inputs.configuration}} /p:ContinuousIntegrationBuild=true | ||
|
||
- name: Build Solution | ||
id: msbuild | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
shell: pwsh | ||
run: msbuild ${{inputs.solution}} /m /t:Build /p:Configuration=${{inputs.configuration}} /p:ContinuousIntegrationBuild=true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: 'Build Changelog' | ||
|
||
inputs: | ||
project-path: | ||
required: false | ||
default: Directory.Build.props | ||
|
||
outputs: | ||
version: | ||
value: ${{steps.get-version.outputs.version}} | ||
version-prefix: | ||
value: ${{steps.get-version.outputs.version-prefix}} | ||
changelog: | ||
value: ${{env.CHANGELOG}} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get Build Version | ||
id: get-version | ||
uses: naminodarie/get-net-sdk-project-versions-action@v1.1.1 | ||
with: | ||
proj-path: ${{inputs.project-path}} | ||
|
||
- name: Generate Changelog | ||
id: changelog | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
shell: bash | ||
run: | | ||
tag=`git describe --tags --abbrev=0` | ||
changelog="`git log --oneline --no-decorate --pretty=tformat:"- %h %s" --no-merges $tag..HEAD`" | ||
echo "$changelog" > changelog.md | ||
echo "CHANGELOG<<EOF" >> $GITHUB_ENV | ||
echo "$changelog" >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
- uses: actions/upload-artifact@v2 | ||
name: Publish Changelog | ||
id: artifact-changelog | ||
with: | ||
name: changelog | ||
path: changelog.md | ||
if-no-files-found: warn | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: 'Setup environment for build' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Add MSBuild to PATH | ||
id: detect-msbuild | ||
uses: microsoft/setup-msbuild@v1.0.2 | ||
with: | ||
vs-version: '[15.7,)' | ||
|
||
- name: Add VSTest to Path | ||
id: vstest-detect | ||
uses: darenm/Setup-VSTest@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: 'Test' | ||
|
||
inputs: | ||
package: | ||
required: true | ||
settings: | ||
required: false | ||
default: Tests\test.runsettings | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run Tests | ||
id: test | ||
working-directory: ${{env.GITHUB_WORKSPACE}} | ||
shell: pwsh | ||
run: vstest.console ${{inputs.package}} /Settings:${{inputs.settings}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
name: Publish Release | ||
|
||
# Controls when the workflow will run | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
configuration: | ||
description: "Build configuration" | ||
required: false | ||
default: "Release" | ||
draft: | ||
description: "Create as draft" | ||
required: false | ||
default: "true" | ||
prerelease: | ||
description: "Create as pre-release" | ||
required: false | ||
default: "true" | ||
|
||
env: | ||
# Path to the solution file relative to the root of the project. | ||
SOLUTION_FILE_PATH: WorkshopTool.sln | ||
|
||
BUILD_CONFIGURATION: ${{ github.event.inputs.configuration || 'Release' }} | ||
BUILD_FRAMEWORK: net461 | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
name: Checkout Sources | ||
id: checkout | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup | ||
name: Setup Environment | ||
|
||
- uses: ./.github/actions/build | ||
name: Build Solution | ||
with: | ||
solution: ${{env.SOLUTION_FILE_PATH}} | ||
configuration: ${{env.BUILD_CONFIGURATION}} | ||
|
||
- uses: ./.github/actions/test | ||
name: Run Tests | ||
with: | ||
package: Tests\bin\${{env.BUILD_CONFIGURATION}}\${{env.BUILD_FRAMEWORK}}\Phoenix.WorkshopTool.Tests.dll | ||
settings: Tests\tests.runsettings | ||
|
||
- uses: ./.github/actions/changelog | ||
name: Generate Changelog | ||
id: changelog | ||
with: | ||
project-path: Directory.Build.props | ||
|
||
- uses: actions/upload-artifact@v2 | ||
name: Publish SEWT Artifacts | ||
id: artifact-sewt | ||
with: | ||
name: SEWT | ||
path: SEWorkshopTool/bin/${{env.BUILD_CONFIGURATION}}/${{env.BUILD_FRAMEWORK}}/SEWorkshopTool*.zip | ||
|
||
- uses: actions/upload-artifact@v2 | ||
name: Publish MEWT Artifacts | ||
id: artifact-mewt | ||
with: | ||
name: MEWT | ||
path: MEWorkshopTool/bin/${{env.BUILD_CONFIGURATION}}/${{env.BUILD_FRAMEWORK}}/MEWorkshopTool*.zip | ||
|
||
- uses: ncipollo/release-action@v1 | ||
name: Publish Release | ||
id: publish-release | ||
with: | ||
artifacts: "**/*WorkshopTool*.zip" | ||
token: ${{secrets.GITHUB_TOKEN}} | ||
name: Workshop Tool v${{steps.changelog.outputs.version-prefix}} | ||
tag: v${{steps.changelog.outputs.version}} | ||
commit: master | ||
draft: ${{github.event.inputs.draft}} | ||
prerelease: ${{github.event.inputs.prerelease}} | ||
allowUpdates: true | ||
body: | | ||
Changelog: | ||
${{env.CHANGELOG}} | ||
To Install: Read the installation instructions listed on the [readme](https://github.com/Gwindalmir/SEWorkshopTool/tree/master#installation). | ||
PLEASE NOTE: This is a command-line (terminal) application. You cannot just double-click it to run it. | ||
To run this, from the Bin64 folder, *Shift+Right* click in an empty area off to the side, then select **Open Powershell window here**. After the blue window appears, type the command with arguments you need, such as `.\SEWorkshopTool.exe --help` and then press the ENTER key. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
tags-ignore: | ||
- '**' | ||
paths-ignore: | ||
- '**.md' | ||
|
||
pull_request: | ||
branches: | ||
- 'master' | ||
tags-ignore: | ||
- '**' | ||
paths-ignore: | ||
- '**.md' | ||
|
||
workflow_dispatch: | ||
inputs: | ||
configuration: | ||
description: "Build configuration" | ||
required: false | ||
default: "Release" | ||
|
||
env: | ||
# Path to the solution file relative to the root of the project. | ||
SOLUTION_FILE_PATH: WorkshopTool.sln | ||
|
||
BUILD_CONFIGURATION: ${{ github.event.inputs.configuration || 'Release' }} | ||
BUILD_FRAMEWORK: net461 | ||
MANUAL_TRIGGER: ${{ github.event.workflow != null }} | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
name: Checkout Sources | ||
id: checkout | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup | ||
name: Setup Environment | ||
|
||
- uses: ./.github/actions/build | ||
name: Build Solution | ||
with: | ||
solution: ${{env.SOLUTION_FILE_PATH}} | ||
configuration: ${{env.BUILD_CONFIGURATION}} | ||
|
||
- uses: ./.github/actions/test | ||
name: Run Tests | ||
with: | ||
package: Tests\bin\${{env.BUILD_CONFIGURATION}}\${{env.BUILD_FRAMEWORK}}\Phoenix.WorkshopTool.Tests.dll | ||
settings: Tests\tests.runsettings | ||
|
||
- uses: ./.github/actions/changelog | ||
name: Generate Changelog | ||
with: | ||
project-path: Directory.Build.props | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters