-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (120 loc) · 4.03 KB
/
web-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: web-ci
on:
workflow_call:
inputs:
runs-on:
type: string
default: self-hosted
sparse-checkout:
type: string
required: false
dotnet-version:
type: string
default: 8.0.x
dotnet-project-path:
type: string
required: false
default: .
dotnet-project-file:
type: string
required: false
bun-version:
type: string
required: false
default: 1.x
nodejs-version:
type: string
required: false
default: 20.x
nodejs-project-path:
type: string
required: false
default: .
env:
DOTNET_INSTALL_DIR: "./.dotnet"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
jobs:
build-nodejs:
runs-on: ${{ inputs.runs-on }}
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: ${{ inputs.sparse-checkout }}
- name: 🧪 Test for NodeJS
id: test
uses: andstor/file-existence-action@v3
with:
files: "**/package.json"
ignore_case: true
- name: ⚙️ Setup NodeJS
if: steps.test.outputs.files_exists == 'true'
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ inputs.bun-version }}
# - name: 🏦 Cache dependencies
# if: steps.test.outputs.files_exists == 'true'
# id: cache-bun
# uses: actions/cache@v4
# with:
# path: ~/.bun/install/cache
# key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
# restore-keys: |
# ${{ runner.os }}-bun-
- name: 📦 Install dependencies
if: steps.test.outputs.files_exists == 'true' #&& steps.cache-npm.outputs.cache-hit != 'true'
working-directory: ${{ inputs.nodejs-project-path }}
run: bun install --frozen-lockfile
- name: 🚀 Bun run
if: steps.test.outputs.files_exists == 'true' #&& steps.cache-npm.outputs.cache-hit != 'true'
working-directory: ${{ inputs.nodejs-project-path }}
run: bunx --bun vite build
build-dotnet-core:
runs-on: ${{ inputs.runs-on }}
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: ${{ inputs.sparse-checkout }}
- name: 🧪 Test for Dotnet Core
id: test
uses: andstor/file-existence-action@v3
with:
files: "**/*.csproj, **/appSettings.json"
ignore_case: true
- name: ⚙️ Setup Dotnet
if: steps.test.outputs.files_exists == 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet-version }}
- name: 🚀 Dotnet build
if: steps.test.outputs.files_exists == 'true'
working-directory: ${{ inputs.dotnet-project-path }}
run: dotnet build --nologo --configuration Release
build-dotnet-framework:
runs-on: ${{ inputs.runs-on }}
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: ${{ inputs.sparse-checkout }}
- name: 🧪 Test for Dotnet Framework
id: test
uses: andstor/file-existence-action@v3
with:
files: "**/*.csproj, **/Web.config"
ignore_case: true
- name: ⚙️ Setup MSBuild
if: steps.test.outputs.files_exists == 'true'
uses: microsoft/setup-msbuild@v2
- name: ⚙️ Setup Nuget
if: steps.test.outputs.files_exists == 'true'
uses: nuget/setup-nuget@v2
- name: 📦 Restore packages
if: steps.test.outputs.files_exists == 'true'
working-directory: ${{ inputs.dotnet-project-path }}
run: nuget restore ${{ inputs.dotnet-project-file }}
- name: 🚀 Dotnet build
if: steps.test.outputs.files_exists == 'true'
working-directory: ${{ inputs.dotnet-project-path }}
run: msbuild.exe ${{ inputs.dotnet-project-file }} /nologo /nr:false /p:platform="Any CPU" /p:configuration="Release"