This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
forked from Squirrel/Squirrel.Windows
-
Notifications
You must be signed in to change notification settings - Fork 39
163 lines (132 loc) · 4.81 KB
/
build.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Build Squirrel
on: [ push, pull_request ]
jobs:
build:
strategy:
matrix:
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Print dotnet version
run: dotnet --info
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-test-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-test-nuget-
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install NBGV
run: dotnet tool install -g nbgv
if: ${{ matrix.os == 'macos-latest' }}
- name: Install .Net Coverage
run: dotnet tool install -g dotnet-coverage
- name: Set Windows Feature
shell: pwsh
run: Add-Content -Path $env:GITHUB_ENV -Value "rust_features=--features windows"
if: ${{ matrix.os == 'windows-latest' }}
- name: Build Rust
working-directory: src/Rust
run: cargo build --release ${{ env.rust_features }}
- name: Test Rust
working-directory: src/Rust
run: cargo llvm-cov ${{ env.rust_features }} --cobertura --output-path ../../test/coverage.rust.${{ matrix.os }}.xml
- name: Rename OSX Binary
working-directory: src/Rust/target/release
run: mv update updatemac
if: ${{ matrix.os == 'macos-latest' }}
- name: Build .NET
run: dotnet build -c Release
- name: Test .NET Squirrel.Tests
run: dotnet test --no-build -c Release -l "console;verbosity=detailed" test/Squirrel.Tests/Squirrel.Tests.csproj
- name: Test .NET Squirrel.Packaging.Tests
run: dotnet test --no-build -c Release -l "console;verbosity=detailed" test/Squirrel.Packaging.Tests/Squirrel.Packaging.Tests.csproj
- name: Test .NET Squirrel.CommandLine.Tests
run: dotnet test --no-build -c Release -l "console;verbosity=detailed" test/Squirrel.CommandLine.Tests/Squirrel.CommandLine.Tests.csproj
- name: Upload Rust Artifacts
uses: actions/upload-artifact@v4
with:
name: rust-${{ matrix.os }}
path: |
src/Rust/target/release/updatemac
src/Rust/target/release/*.exe
# - name: Upload Coverage Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: coverage
# path: test/coverage*.xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: ./test
fail_ci_if_error: true
package:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
# - name: Install .NET 6
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 6.0.x
# - name: Install .NET 8
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8.0.x
- name: Print dotnet version
run: dotnet --info
- name: Download Rust Windows
uses: actions/download-artifact@v4
with:
name: rust-macos-latest
path: src/Rust/target/release
- name: Download Rust OSX
uses: actions/download-artifact@v4
with:
name: rust-windows-latest
path: src/Rust/target/release
# - name: Download Coverage Artifacts
# uses: actions/download-artifact@v4
# with:
# name: coverage
# path: ./coverage
- name: Build .NET
run: dotnet build -c Release /p:PackRustAssets=true
- name: Upload Package Artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: build/Release/*.nupkg
# - name: Upload Coverage to Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# directory: ./coverage
# fail_ci_if_error: true
- name: Publish to GitHub Packages
shell: pwsh
run: dotnet nuget push build/Release/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate