Skip to content

Merge branch 'main' into dependabot/nuget/Microsoft.NET.Test.Sdk-17.7.2 #169

Merge branch 'main' into dependabot/nuget/Microsoft.NET.Test.Sdk-17.7.2

Merge branch 'main' into dependabot/nuget/Microsoft.NET.Test.Sdk-17.7.2 #169

Workflow file for this run

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-11
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@v3
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@v3
with:
path: configcache
key: ${{ runner.os }}-configcache
- name: Initialize CodeQL
if: false
uses: github/codeql-action/init@v2
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@v2
- 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