-
-
Notifications
You must be signed in to change notification settings - Fork 4
121 lines (117 loc) · 3.78 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
name: Build
# Run this workflow every time a new commit pushed to your repository
on: push
env:
DOTNET_NOLOGO: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
CCACHE_COMPILERCHECK: none
jobs:
macos:
name: Build MacOS dylib (x86-64 and arm64)
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}-${{ matrix.os }}
- name: Cache autoconf
uses: actions/cache@v4
with:
path: configcache
key: ${{ runner.os }}-configcache
- name: Build
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
./native/build-macos.sh
- name: Archive MacOS library
uses: actions/upload-artifact@v3
with:
name: dist
path: |
libarchive.dylib
linux:
needs: [macos]
name: Build Linux x86-64 code and wrapper
runs-on: ubuntu-22.04
steps:
- name: Ubuntu packages
run: sudo apt-get install -y libeatmydata1
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine versioning
uses: gittools/actions/gitversion/[email protected]
- name: Retrieve MacOS library
uses: actions/download-artifact@v3
with:
name: dist
path: libarchive.dylib
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}-${{ matrix.os }}
- name: Cache autoconf
uses: actions/cache@v4
with:
path: configcache
key: ${{ runner.os }}-configcache
- name: Initialize CodeQL
if: false
uses: github/codeql-action/init@v3
with:
languages: 'csharp'
- name: Build native library
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
./native/build-linux.sh
- name: Built .Net package and test
run: |
mkdir -p LibArchive.Net/runtimes/osx-any64 LibArchive.Net/runtimes/linux-x64
mv libarchive.so LibArchive.Net/runtimes/linux-x64/
mv libarchive.dylib LibArchive.Net/runtimes/osx-any64/
touch libarchive.dylib
dotnet test --nologo
dotnet pack LibArchive.Net/LibArchive.Net.csproj -o . -p:PackageVersion=$GitVersion_NuGetVersion --nologo
ls -lh *.nupkg
- name: Perform CodeQL Analysis
if: false
uses: github/codeql-action/analyze@v3
- name: Upload built packages
uses: svenstaro/[email protected]
if: contains(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: '*.nupkg'
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
*.nupkg
libarchive.dylib
- name: Upload built packages
uses: svenstaro/[email protected]
if: contains(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: '*.nupkg'
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload Nuget package
if: contains(github.ref, 'refs/tags/v')
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json