Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 52 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ jobs:
build-mode: manual
- 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/
mkdir -p LibArchive.Net/runtimes/osx-x64/native LibArchive.Net/runtimes/osx-arm64/native LibArchive.Net/runtimes/linux-x64/native LibArchive.Net/runtimes/linux-musl-x64/native
mv libarchive.so LibArchive.Net/runtimes/linux-x64/native/
cp LibArchive.Net/runtimes/linux-x64/native/libarchive.so LibArchive.Net/runtimes/linux-musl-x64/native/
mv libarchive.dylib LibArchive.Net/runtimes/osx-x64/native/
cp LibArchive.Net/runtimes/osx-x64/native/libarchive.dylib LibArchive.Net/runtimes/osx-arm64/native/
touch libarchive.dylib
dotnet build --configuration Release
dotnet test --nologo
Expand Down Expand Up @@ -125,3 +127,50 @@ jobs:
- 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

mono-test:
name: Test .NET Standard 2.0 with Mono
needs: [linux]
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Install Mono
run: |
sudo apt-get update
sudo apt-get install -y mono-complete mono-devel
mono --version

- name: Setup .NET Core
uses: actions/setup-dotnet@v5.0.0

- name: Retrieve build artifacts
uses: actions/download-artifact@v5
with:
name: dist

- name: Extract and setup libraries
run: |
# Extract the nupkg to get the native libraries
unzip -q *.nupkg -d extracted
mkdir -p LibArchive.Net/runtimes
cp -r extracted/runtimes/* LibArchive.Net/runtimes/
ls -laR LibArchive.Net/runtimes/

- name: Build test project for .NET Framework
run: |
dotnet restore Test.LibArchive.Net/Test.LibArchive.Net.csproj
dotnet build Test.LibArchive.Net/Test.LibArchive.Net.csproj --configuration Release --framework net462 --no-restore

- name: Run tests with Mono (.NET Standard 2.0)
run: |
# Run tests targeting net462 which uses the netstandard2.0 library
dotnet test Test.LibArchive.Net/Test.LibArchive.Net.csproj --configuration Release --framework net462 --no-build --verbosity normal

- name: Display test results
if: always()
run: |
echo "Mono version used:"
mono --version
echo "Test completed for .NET Standard 2.0 compatibility"
50 changes: 50 additions & 0 deletions .github/workflows/check-native-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Check Native Dependencies

on:
schedule:
# Run weekly on Mondays at 9:00 AM UTC
- cron: '0 9 * * 1'
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (no PR creation)'
required: false
default: 'false'

permissions:
contents: write
pull-requests: write

jobs:
check-updates:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl jq

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Check for updates
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: ${{ github.event.inputs.dry_run == 'true' && '1' || '0' }}
run: |
bash scripts/check-native-updates.sh

- name: Summary
if: always()
run: |
echo "### Native Dependency Check Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Check the job logs for details on any updates found." >> $GITHUB_STEP_SUMMARY
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,9 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml

# Claude Code / Claude Flow
.claude/
.claude-flow/
.swarm/
CLAUDE.md
20 changes: 16 additions & 4 deletions LibArchive.Net/LibArchive.Net.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;osx-arm64</RuntimeIdentifiers>
<!-- Allow unsafe code for UTF-8 string handling in .NET Standard 2.0 -->
<AllowUnsafeBlocks Condition="'$(TargetFramework)' == 'netstandard2.0'">true</AllowUnsafeBlocks>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-musl-x64;osx-x64;osx-arm64</RuntimeIdentifiers>

<!-- AOT and Trimming Support (for .NET 6+) -->
<IsAotCompatible Condition="!$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETStandard'">true</IsAotCompatible>
<IsTrimmable Condition="!$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETStandard'">true</IsTrimmable>
<EnableTrimAnalyzer Condition="!$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETStandard'">true</EnableTrimAnalyzer>
<EnableAotAnalyzer Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">true</EnableAotAnalyzer>

<!-- Package Metadata -->
<PackageLicenseExpression>BSD-2-Clause</PackageLicenseExpression>
<PackageId>LibArchive.Net</PackageId>
<PackageTags>Compression;Libarchive;Tar;Zip;7Zip;Rar</PackageTags>
<Description>This package provides access to the native libarchive compression library (included) on 64 bit Linux, Windows and MacOS platforms (x86-64 for all three, plus arm64/M1 for Mac)</Description>
<PackageTags>Compression;Libarchive;Tar;Zip;7Zip;Rar;AOT;NativeAOT;Trimming</PackageTags>
<Description>This package provides access to the native libarchive compression library (included) on Linux (x64, musl-x64), Windows (x86, x64, arm64), and macOS (x64, arm64) platforms. Supports Native AOT and trimming for .NET 6+.</Description>
<Authors>James A Sutherland</Authors>
<Copyright>Copyright 2022-2024</Copyright>
<Title>LibArchive.Net</Title>
Expand All @@ -23,6 +33,8 @@
</Content>
</ItemGroup>
<ItemGroup>
<!-- Add System.Text.Encoding.CodePages for frameworks that don't have built-in UTF-8 guarantees -->
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.1'))" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>
</Project>
Loading
Loading