Skip to content

Commit 0fa5476

Browse files
committed
Update GH Actions workflows
- Split non-PR and main branch nightly build PRs - Use PR HEAD instead of merge commit
1 parent ffb592d commit 0fa5476

File tree

4 files changed

+83
-21
lines changed

4 files changed

+83
-21
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Build Phobos'
2+
inputs:
3+
sln-path:
4+
description: 'Path to the solution file relative to the root of the project'
5+
required: false
6+
default: '.'
7+
build-config:
8+
description: 'Configuration to build'
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Add MSBuild to PATH
14+
uses: microsoft/setup-msbuild@v1
15+
16+
- name: Restore NuGet packages
17+
working-directory: ${{env.GITHUB_WORKSPACE}}
18+
run: nuget restore ${{inputs.sln-path}}
19+
20+
- uses: ammaraskar/msvc-problem-matcher@master
21+
- name: Build
22+
working-directory: ${{env.GITHUB_WORKSPACE}}
23+
# Add additional options to the MSBuild command line here (like platform or verbosity level).
24+
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
25+
run: msbuild /m /p:Configuration=${{inputs.build-config}} /p:GitCommit=${{github.sha}} /p:GitBranch=${{github.ref}} ${{inputs.sln-path}}
26+

.github/workflows/nightly.yml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Nightly Build
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
- develop
49

510
env:
611
# Path to the solution file relative to the root of the project.
@@ -18,24 +23,15 @@ jobs:
1823
runs-on: windows-2019
1924

2025
steps:
21-
- uses: actions/checkout@v2
22-
23-
- name: Checkout submodules
24-
run: git submodule update --init --recursive
25-
26-
- name: Add MSBuild to PATH
27-
uses: microsoft/setup-msbuild@v1
28-
29-
- name: Restore NuGet packages
30-
working-directory: ${{env.GITHUB_WORKSPACE}}
31-
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
26+
- uses: actions/checkout@v3
27+
with:
28+
submodules: recursive
3229

33-
- uses: ammaraskar/msvc-problem-matcher@master
34-
- name: Build
35-
working-directory: ${{env.GITHUB_WORKSPACE}}
36-
# Add additional options to the MSBuild command line here (like platform or verbosity level).
37-
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
38-
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:GitCommit=${{github.sha}} /p:GitBranch=${{github.ref}} ${{env.SOLUTION_FILE_PATH}}
30+
- name: Build Phobos
31+
uses: ./.github/actions/build-phobos # Build steps are reused
32+
with:
33+
sln-path: ${{env.SOLUTION_FILE_PATH}}
34+
build-config: ${{env.BUILD_CONFIGURATION}}
3935

4036
- name: Upload Artifact
4137
if: ${{success()}}
@@ -44,4 +40,4 @@ jobs:
4440
name: compiled-dll-${{github.sha}}
4541
path: |
4642
${{env.SOLUTION_FILE_PATH}}/${{env.BUILD_CONFIGURATION}}/Phobos.dll
47-
${{env.SOLUTION_FILE_PATH}}/${{env.BUILD_CONFIGURATION}}/IntDir/Phobos.pdb
43+
${{env.SOLUTION_FILE_PATH}}/${{env.BUILD_CONFIGURATION}}/IntDir/Phobos.pdb

.github/workflows/pr-nightly-comment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: Nightly Build comment on pull request
1+
name: Nightly Build Comment on Pull Request
22
on:
33
workflow_run:
4-
workflows: ['Nightly Build']
4+
workflows: ['Pull Request Nightly Build']
55
types: [completed]
66
jobs:
77
pr_comment:

.github/workflows/pr-nightly.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Pull Request Nightly Build
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
# Path to the solution file relative to the root of the project.
8+
SOLUTION_FILE_PATH: .
9+
10+
# Configuration type to build.
11+
# You can convert this to a build matrix if you need coverage of multiple configuration types.
12+
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
13+
BUILD_CONFIGURATION: DevBuild
14+
# GIT_COMMIT: $(git rev-parse --short "$GITHUB_SHA")
15+
# GIT_BRANCH: ${GITHUB_REF#refs/heads/}
16+
17+
jobs:
18+
build:
19+
runs-on: windows-2019
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
submodules: recursive
25+
ref: ${{ github.event.pull_request.head.sha }}
26+
27+
- name: Build Phobos
28+
uses: ./.github/actions/build-phobos # Setup steps are reused
29+
with:
30+
sln-path: ${{env.SOLUTION_FILE_PATH}}
31+
build-config: ${{env.BUILD_CONFIGURATION}}
32+
33+
- name: Upload Artifact
34+
if: ${{success()}}
35+
uses: actions/upload-artifact@v2
36+
with:
37+
name: compiled-dll-${{github.sha}}
38+
path: |
39+
${{input.sln-path}}/${{input.build-config}}/Phobos.dll
40+
${{input.sln-path}}/${{input.build-config}}/IntDir/Phobos.pdb

0 commit comments

Comments
 (0)