Skip to content

Commit

Permalink
init actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed May 26, 2024
1 parent ec13147 commit 26aa1d0
Show file tree
Hide file tree
Showing 4 changed files with 773 additions and 2 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build

on:
push:
branches:
- master
workflow_dispatch:

env:
FRAMEWORK: net8.0
RUNTIME: linux-x64
CONFIGURATION: Release
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build ZXing-C++ (Linux x64)
run: |
cmake -S zxing-cpp -B zxing-cpp.linux-x64 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DZXING_READERS=ON \
-DZXING_WRITERS=OFF \
-DCMAKE_CXX_STANDARD=20 \
-DZXING_C_API=ON
cmake --build zxing-cpp.linux-x64 --config Release
mkdir -p AuthenticatorPro.ZXing/runtimes/linux-x64
cp zxing-cpp.linux-x64/core/libZXing.so AuthenticatorPro.ZXing/runtimes/linux-x64/libZXing.so
strip --strip-debug AuthenticatorPro.ZXing/runtimes/linux-x64/libZXing.so
cp AuthenticatorPro.ZXing/runtimes/linux-x64/libZXing.so AuthenticatorPro.ZXing/libZXing.so
- name: Build ZXing-C++ (Android)
run: |
for abi in armeabi-v7a arm64-v8a x86 x86_64 ; do
cmake -S zxing-cpp -B "zxing-cpp.android-$abi" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DZXING_READERS=ON \
-DZXING_WRITERS=OFF \
-DCMAKE_CXX_STANDARD=20 \
-DZXING_C_API=ON \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=$abi
cmake --build "zxing-cpp.android-$abi" --config Release
mkdir -p "AuthenticatorPro.ZXing/runtimes/android-$abi"
cp "zxing-cpp.android-$abi/core/libZXing.so" "AuthenticatorPro.ZXing/runtimes/android-$abi/libZXing.so"
$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip "AuthenticatorPro.ZXing/runtimes/android-$abi/libZXing.so"
done
- name: Build
run: |
dotnet build --configuration $CONFIGURATION AuthenticatorPro.ZXing.sln
- name: Test
run: |
dotnet test --configuration $CONFIGURATION AuthenticatorPro.ZXing.Test/AuthenticatorPro.ZXing.Test.csproj
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: authenticatorpro-zxing
path: AuthenticatorPro.ZXing/bin/**/AuthenticatorPro.ZXing*.nupkg

- name: Publish package
run: |
pkg=$(find AuthenticatorPro.ZXing/bin/$CONFIGURATION/ -name '*.nupkg')
dotnet nuget push $pkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json
19 changes: 17 additions & 2 deletions AuthenticatorPro.ZXing/AuthenticatorPro.ZXing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,26 @@
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<PackageId>AuthenticatorPro.ZXing</PackageId>
<Version>1.0.0</Version>
<Authors>jamie-mh</Authors>
<Copyright>Copyright (c) jamie-mh 2024</Copyright>
<ProjectUrl>https://authenticatorpro.jmh.me</ProjectUrl>
<RepositoryUrl>https://github.com/jamie-mh/AuthenticatorProZXing</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<Description>Build of ZXing-C++ for Authenticator Pro</Description>
</PropertyGroup>

<ItemGroup>
<None Include="../zxing-cpp.release/core/libZXing.so" PackagePath="runtimes/linux-x64/native/" Pack="true" />
<None Update="../zxing-cpp.release/core/libZXing.so">
<None Include="runtimes/linux-x64/libZXing.so" PackagePath="runtimes/linux-x64/native/" Pack="true" />
<None Include="runtimes/android-armeabi-v7a/libZXing.so" PackagePath="runtimes/android-arm/native/" Pack="true" />
<None Include="runtimes/android-arm64-v8a/libZXing.so" PackagePath="runtimes/android-arm64/native/" Pack="true" />
<None Include="runtimes/android-x86/libZXing.so" PackagePath="runtimes/android-x86/native/" Pack="true" />
<None Include="runtimes/android-x86_64/libZXing.so" PackagePath="runtimes/android-x64/native/" Pack="true" />

<None Update="libZXing.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down
Loading

0 comments on commit 26aa1d0

Please sign in to comment.