Skip to content

Commit 1d5cd72

Browse files
authored
Implement build workflows
1 parent e720b60 commit 1d5cd72

File tree

10 files changed

+631
-1
lines changed

10 files changed

+631
-1
lines changed

.github/workflows/release.yml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Release desktop binaries
2+
on:
3+
release:
4+
types:
5+
- published
6+
jobs:
7+
github-release:
8+
name: Create GitHub release
9+
runs-on: ubuntu-latest
10+
needs: build-package
11+
steps:
12+
- name: Download Windows x64 package
13+
uses: actions/download-artifact@v3
14+
with:
15+
name: windows-package
16+
path: win-pkg/
17+
- name: Download macOS x64 package
18+
uses: actions/download-artifact@v3
19+
with:
20+
name: mac-package
21+
path: mac-pkg/
22+
- name: Download Linux x64 package
23+
uses: actions/download-artifact@v3
24+
with:
25+
name: linux-package
26+
path: lnx-pkg/
27+
- name: Rename output files
28+
run: |
29+
mv win-pkg/cosmos-migrate.exe cosmos-migrate-${{ github.ref_name }}-win-x64.exe
30+
mv mac-pkg/cosmos-migrate cosmos-migrate-${{ github.ref_name }}-mac-x64
31+
mv lnx-pkg/cosmos-migrate cosmos-migrate-${{ github.ref_name }}-linux-x64
32+
- name: Create GitHub release
33+
uses: softprops/action-gh-release@v1
34+
with:
35+
files: |
36+
cosmos-migrate-${{ github.ref_name }}-win-x64.exe
37+
cosmos-migrate-${{ github.ref_name }}-mac-x64
38+
cosmos-migrate-${{ github.ref_name }}-linux-x64
39+
build-package:
40+
name: Build self-contained executables
41+
runs-on: ubuntu-latest
42+
container: mcr.microsoft.com/dotnet/sdk:7.0
43+
steps:
44+
- name: Check .NET version
45+
run: dotnet --version
46+
- name: Checkout source code
47+
uses: actions/checkout@v3
48+
- name: Build Windows x64 package
49+
run: |
50+
dotnet publish \
51+
Core/Microsoft.DataTransfer.Core/Microsoft.DataTransfer.Core.csproj \
52+
--configuration release \
53+
--output win \
54+
--self-contained true \
55+
--runtime win-x64 \
56+
-p:PublishSingleFile=true \
57+
-p:DebugType=embedded \
58+
-p:EnableCompressionInSingleFile=true \
59+
-p:PublishReadyToRun=true \
60+
-p:PublishTrimmed=true \
61+
-p:Version=${{ github.ref_name }} \
62+
-p:AssemblyName=cosmos-migrate
63+
- name: Upload Windows package
64+
uses: actions/upload-artifact@v3
65+
with:
66+
name: windows-package
67+
path: win/cosmos-migrate.exe
68+
- name: Build macOS x64 package
69+
run: |
70+
dotnet publish \
71+
Core/Microsoft.DataTransfer.Core/Microsoft.DataTransfer.Core.csproj \
72+
--configuration release \
73+
--output mac \
74+
--self-contained true \
75+
--runtime osx-x64 \
76+
-p:PublishSingleFile=true \
77+
-p:DebugType=embedded \
78+
-p:EnableCompressionInSingleFile=true \
79+
-p:PublishReadyToRun=true \
80+
-p:PublishTrimmed=true \
81+
-p:Version=${{ github.ref_name }} \
82+
-p:AssemblyName=cosmos-migrate
83+
- name: Upload macOS package
84+
uses: actions/upload-artifact@v3
85+
with:
86+
name: mac-package
87+
path: mac/cosmos-migrate
88+
- name: Build Linux x64 package
89+
run: |
90+
dotnet publish \
91+
Core/Microsoft.DataTransfer.Core/Microsoft.DataTransfer.Core.csproj \
92+
--configuration release \
93+
--output linux \
94+
--self-contained true \
95+
--runtime linux-x64 \
96+
-p:PublishSingleFile=true \
97+
-p:DebugType=embedded \
98+
-p:EnableCompressionInSingleFile=true \
99+
-p:PublishReadyToRun=true \
100+
-p:PublishTrimmed=true \
101+
-p:Version=${{ github.ref_name }} \
102+
-p:AssemblyName=cosmos-migrate
103+
- name: Upload Linux package
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: linux-package
107+
path: linux/cosmos-migrate

.github/workflows/validate.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Validate all .NET projects
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
jobs:
7+
build-test:
8+
name: Build and test .NET projects
9+
runs-on: ubuntu-latest
10+
container: mcr.microsoft.com/dotnet/sdk:7.0
11+
steps:
12+
- name: Check .NET version
13+
run: dotnet --version
14+
- name: Checkout source code
15+
uses: actions/checkout@v2
16+
- name: Build project
17+
run: dotnet build
18+
- name: Run unit tests
19+
run: dotnet test --logger "console;verbosity=detailed"

0 commit comments

Comments
 (0)