Skip to content

Commit f70d63a

Browse files
committed
Run workflows on PRs
Signed-off-by: Ilya Leoshkevich <[email protected]>
1 parent 3701296 commit f70d63a

File tree

6 files changed

+57
-9
lines changed

6 files changed

+57
-9
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Do not edit this file. It is generated from dotnet.yml.j2.
22

3-
name: Build dotnet
4-
53
on:
64
push:
75
branches:
86
- main
7+
pull_request:
98

109
jobs:
1110
runtime:

.github/workflows/dotnet.yml.j2

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
{#-
2-
Workflow template. Use the following command after updating this file:
3-
jinja2 -o .github/workflows/dotnet.yml .github/workflows/dotnet.yml.j2
2+
Workflow template. Regenerate the workflow using the ./update script.
43
-#}
54

65
# Do not edit this file. It is generated from dotnet.yml.j2.
76

8-
name: Build dotnet
9-
107
on:
118
push:
129
branches:
1310
- main
11+
pull_request:
1412

1513
{%- set projects = ['runtime', 'msbuild', 'roslyn', 'sdk', 'aspnetcore', 'installer'] %}
1614

.github/workflows/toolchain.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and push a toolchain image
1+
# Do not edit this file. It is generated from toolchain.yml.j2.
22

33
on:
44
push:
@@ -7,6 +7,10 @@ on:
77
paths:
88
- 'docker/**'
99
- '.github/workflows/toolchain.yml'
10+
pull_request:
11+
paths:
12+
- 'docker/**'
13+
- '.github/workflows/toolchain.yml'
1014

1115
jobs:
1216
toolchain:
@@ -19,6 +23,9 @@ jobs:
1923
- name: Build
2024
run: ARCH=${{ matrix.arch }} docker/build -t ghcr.io/ibm/dotnet-${{ matrix.arch }}-toolchain:latest
2125
- name: Login
22-
run: echo ${{ secrets.GHCR_PASSWORD }} | docker login ghcr.io --username=${{ secrets.GHCR_USERNAME }} --password-stdin
26+
run: echo ${{ secrets.GHCR_PASSWORD }} |
27+
docker login ghcr.io --username=${{ secrets.GHCR_USERNAME }} --password-stdin
28+
if: ${{ github.event_name == 'push' }}
2329
- name: Push
2430
run: docker push ghcr.io/ibm/dotnet-${{ matrix.arch }}-toolchain:latest
31+
if: ${{ github.event_name == 'push' }}

.github/workflows/toolchain.yml.j2

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{#-
2+
Workflow template. Regenerate the workflow using the ./update script.
3+
-#}
4+
5+
# Do not edit this file. It is generated from toolchain.yml.j2.
6+
7+
{%- set paths %}
8+
paths:
9+
- 'docker/**'
10+
- '.github/workflows/toolchain.yml'
11+
{%- endset %}
12+
13+
on:
14+
push:
15+
branches:
16+
- main
17+
{{- paths }}
18+
pull_request:
19+
{{- paths }}
20+
21+
jobs:
22+
toolchain:
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
arch: [ppc64le, s390x, x64]
27+
steps:
28+
- uses: actions/checkout@v4
29+
{%- set image = 'ghcr.io/ibm/dotnet-${{ matrix.arch }}-toolchain:latest' %}
30+
- name: Build
31+
run: ARCH={% raw %}${{ matrix.arch }}{% endraw %} docker/build -t {{ image }}
32+
- name: Login
33+
run: echo {% raw %}${{ secrets.GHCR_PASSWORD }}{% endraw %} |
34+
docker login ghcr.io --username={% raw %}${{ secrets.GHCR_USERNAME }}{% endraw %} --password-stdin
35+
if: {% raw %}${{ github.event_name == 'push' }}{% endraw %}
36+
- name: Push
37+
run: docker push {{ image }}
38+
if: {% raw %}${{ github.event_name == 'push' }}{% endraw %}

.github/workflows/update

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
# A script for generating workflow files from templates.
3+
set -e -u -x
4+
cd "$(dirname "$0")"
5+
jinja2 -o dotnet.yml dotnet.yml.j2
6+
jinja2 -o toolchain.yml toolchain.yml.j2

dotnet-cleanup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e -u x
2+
set -e -u -x
33
cd "$(dirname "$0")"
44
git clean -dfx
55
git submodule foreach --recursive 'git clean -dfx && git reset --hard'

0 commit comments

Comments
 (0)