Build #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| env: | |
| FRAMEWORK: net10.0 | |
| CONFIGURATION: Release | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| MIN_SDK: 21 | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| toolchain: | |
| - aarch64-linux-android | |
| - armv7a-linux-androideabi | |
| - x86_64-linux-android | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Build OpenSSL | |
| run: | | |
| declare -A TARGETS | |
| TARGETS["aarch64-linux-android"]=android-arm64 | |
| TARGETS["armv7a-linux-androideabi"]=android-arm | |
| TARGETS["x86_64-linux-android"]=android-x86_64 | |
| TARGETS["i686-linux-android"]=android-x86 | |
| TOOLCHAIN="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64" | |
| export PATH="$TOOLCHAIN/bin:$PATH" | |
| cd openssl | |
| ./Configure ${TARGETS[${{ matrix.toolchain }}]} -D__ANDROID_API__=$MIN_SDK -static -fpic -no-shared -no-fuzz-afl -no-fuzz-libfuzzer -no-tests -no-apps -ffunction-sections -fdata-sections '-Wno-macro-redefined' | |
| make -j 4 | |
| - name: Build SQLCipher | |
| run: | | |
| TOOLCHAIN="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64" | |
| TARGET="${{ matrix.toolchain }}$MIN_SDK" | |
| OPENSSL_HEADERS=$(realpath openssl/include) | |
| OPENSSL_LIB=$(realpath openssl/libcrypto.a) | |
| export CC="$TOOLCHAIN/bin/clang --target=$TARGET" | |
| export CXX="$TOOLCHAIN/bin/clang++ --target=$TARGET" | |
| export LD="$TOOLCHAIN/bin/ld" | |
| cd sqlcipher | |
| ./configure --with-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown -D__ANDROID_API__=$MIN_SDK -I$OPENSSL_HEADERS" LDFLAGS="$OPENSSL_LIB -llog -Wl,-z,max-page-size=16384,--gc-sections" | |
| make -j 4 | |
| "$TOOLCHAIN/bin/llvm-strip" libsqlite3.so | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sqlcipher-${{ matrix.toolchain }} | |
| path: sqlcipher/libsqlite3.so | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Build OpenSSL | |
| run: | | |
| cd openssl | |
| ./Configure -static -fpic -no-shared -no-fuzz-afl -no-fuzz-libfuzzer -no-tests -no-apps -ffunction-sections -fdata-sections | |
| make -j 4 | |
| - name: Build SQLCipher | |
| run: | | |
| OPENSSL_HEADERS=$(realpath openssl/include) | |
| OPENSSL_LIB=$(realpath openssl/libcrypto.a) | |
| cd sqlcipher | |
| ./configure --with-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown -I$OPENSSL_HEADERS" LDFLAGS="$OPENSSL_LIB" | |
| make -j 4 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sqlcipher-linux | |
| path: sqlcipher/libsqlite3.so | |
| build-mac: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Build OpenSSL | |
| run: | | |
| cd openssl | |
| ./Configure -static -fpic -no-shared -no-fuzz-afl -no-fuzz-libfuzzer -no-tests -no-apps -ffunction-sections -fdata-sections | |
| make -j 4 | |
| - name: Build SQLCipher | |
| run: | | |
| OPENSSL_HEADERS=$(realpath openssl/include) | |
| OPENSSL_LIB=$(realpath openssl/libcrypto.a) | |
| cd sqlcipher | |
| ./configure --with-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown -I$OPENSSL_HEADERS" LDFLAGS="$OPENSSL_LIB" | |
| make -j 4 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sqlcipher-mac | |
| path: sqlcipher/libsqlite3.dylib | |
| package: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-android | |
| - build-linux | |
| - build-mac | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9' | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: sqlcipher-* | |
| path: artifacts | |
| - name: Build | |
| run: | | |
| mkdir -p "Stratum.SQLCipher/runtimes/linux-x64" | |
| cp "artifacts/sqlcipher-linux/libsqlite3.so" "Stratum.SQLCipher/runtimes/linux-x64/libsqlcipher.so" | |
| mkdir -p "Stratum.SQLCipher/runtimes/osx" | |
| cp "artifacts/sqlcipher-mac/libsqlite3.dylib" "Stratum.SQLCipher/runtimes/osx/libsqlcipher.dylib" | |
| mkdir -p "Stratum.SQLCipher/runtimes/android-arm64-v8a" | |
| cp "artifacts/sqlcipher-aarch64-linux-android/libsqlite3.so" "Stratum.SQLCipher/runtimes/android-arm64-v8a/libsqlcipher.so" | |
| mkdir -p "Stratum.SQLCipher/runtimes/android-armeabi-v7a" | |
| cp "artifacts/sqlcipher-armv7a-linux-androideabi/libsqlite3.so" "Stratum.SQLCipher/runtimes/android-armeabi-v7a/libsqlcipher.so" | |
| mkdir -p "Stratum.SQLCipher/runtimes/android-x86_64" | |
| cp "artifacts/sqlcipher-x86_64-linux-android/libsqlite3.so" "Stratum.SQLCipher/runtimes/android-x86_64/libsqlcipher.so" | |
| dotnet build --configuration $CONFIGURATION Stratum.SQLCipher.sln | |
| - name: Publish package | |
| run: | | |
| pkg=$(find Stratum.SQLCipher/bin/$CONFIGURATION/ -name '*.nupkg') | |
| dotnet nuget push $pkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json |