Skip to content

Commit d5a6c87

Browse files
committed
Reuse workflow
1 parent 0a8bcd8 commit d5a6c87

File tree

3 files changed

+50
-68
lines changed

3 files changed

+50
-68
lines changed

.github/workflows/test-core.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Test Core
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
main-repo:
7+
required: true
8+
type: boolean
9+
fix-404:
10+
required: true
11+
type: boolean
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v4
21+
with:
22+
dotnet-version: 8.0.x
23+
- name: GitHub Pages Blazor WASM
24+
uses: ./
25+
with:
26+
project-path: Test/Test.csproj
27+
main-repo: ${{ inputs.main-repo }}
28+
fix-404: ${{ inputs.fix-404 }}
29+
- name: Verify
30+
run: Test/Verify.sh --main-repo=${{ inputs.main-repo }} --fix-404=${{ inputs.fix-404 }} ${{ github.event.repository.name }}

.github/workflows/test.yml

+16-64
Original file line numberDiff line numberDiff line change
@@ -8,73 +8,25 @@ on:
88

99
jobs:
1010
test-non-main-repo-fix-404:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v4
15-
- name: Setup .NET
16-
uses: actions/setup-dotnet@v4
17-
with:
18-
dotnet-version: 8.0.x
19-
- name: GitHub Pages Blazor WASM
20-
uses: ./
21-
with:
22-
project-path: Test/Test.csproj
23-
main-repo: false
24-
fix-404: true
25-
- name: Verify
26-
run: Test/Verify.sh --non-main-repo --fix-404 ${{ github.event.repository.name }}
11+
uses: ./.github/workflows/test-core.yml
12+
with:
13+
main-repo: false
14+
fix-404: true
2715

2816
test-main-repo-fix-404:
29-
runs-on: ubuntu-latest
30-
steps:
31-
- name: Checkout
32-
uses: actions/checkout@v4
33-
- name: Setup .NET
34-
uses: actions/setup-dotnet@v4
35-
with:
36-
dotnet-version: 8.0.x
37-
- name: GitHub Pages Blazor WASM
38-
uses: ./
39-
with:
40-
project-path: Test/Test.csproj
41-
main-repo: true
42-
fix-404: true
43-
- name: Verify
44-
run: Test/Verify.sh --main-repo --fix-404 ${{ github.event.repository.name }}
17+
uses: ./.github/workflows/test-core.yml
18+
with:
19+
main-repo: true
20+
fix-404: true
4521

4622
test-non-main-repo-no-fix-404:
47-
runs-on: ubuntu-latest
48-
steps:
49-
- name: Checkout
50-
uses: actions/checkout@v4
51-
- name: Setup .NET
52-
uses: actions/setup-dotnet@v4
53-
with:
54-
dotnet-version: 8.0.x
55-
- name: GitHub Pages Blazor WASM
56-
uses: ./
57-
with:
58-
project-path: Test/Test.csproj
59-
main-repo: false
60-
fix-404: false
61-
- name: Verify
62-
run: Test/Verify.sh --non-main-repo --no-fix-404 ${{ github.event.repository.name }}
23+
uses: ./.github/workflows/test-core.yml
24+
with:
25+
main-repo: false
26+
fix-404: false
6327

6428
test-main-repo-no-fix-404:
65-
runs-on: ubuntu-latest
66-
steps:
67-
- name: Checkout
68-
uses: actions/checkout@v4
69-
- name: Setup .NET
70-
uses: actions/setup-dotnet@v4
71-
with:
72-
dotnet-version: 8.0.x
73-
- name: GitHub Pages Blazor WASM
74-
uses: ./
75-
with:
76-
project-path: Test/Test.csproj
77-
main-repo: true
78-
fix-404: false
79-
- name: Verify
80-
run: Test/Verify.sh --main-repo --no-fix-404 ${{ github.event.repository.name }}
29+
uses: ./.github/workflows/test-core.yml
30+
with:
31+
main-repo: true
32+
fix-404: false

Test/Verify.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/usr/bin/bash
22

3-
if [ $1 == "--non-main-repo" ]; then
3+
if [ $1 == "--main-repo=false" ]; then
44
MAINREPO=false;
5-
elif [ $1 == "--main-repo" ]; then
5+
elif [ $1 == "--main-repo=true" ]; then
66
MAINREPO=true;
77
else
88
echo Unknown Argument.
99
exit 1
1010
fi
1111

12-
if [ $2 == "--no-fix-404" ]; then
12+
if [ $2 == "--fix-404=false" ]; then
1313
FIX404=false;
14-
elif [ $2 == "--fix-404" ]; then
14+
elif [ $2 == "--fix-404=true" ]; then
1515
FIX404=true;
1616
else
1717
echo Unknown Argument.

0 commit comments

Comments
 (0)