diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 6518b9f3b..2790704bb 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2022.3.2", + "version": "2025.3.3", "commands": [ "jb" ] diff --git a/.github/workflows/pull-request-ui.yml b/.github/workflows/pull-request-ui.yml index 94db206a1..d837e38f4 100644 --- a/.github/workflows/pull-request-ui.yml +++ b/.github/workflows/pull-request-ui.yml @@ -69,8 +69,8 @@ jobs: name: ["macOS", "windows-os"] include: - name: macOS - os: macOS-13 - version: "14.2" + os: macos-26 + version: "26.2" osFolder: "maccatalyst" - name: windows-os os: windows-2022 @@ -113,7 +113,7 @@ jobs: if: (runner.os == 'macOS' && steps.filter.outputs.any == 'true') run: | ls -ls /Applications/ - ls -ls $ANDROID_SDK_ROOT/ndk + # ANDROID_SDK_ROOT may not be set on all runners sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app - name: Configure Environment diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 46180e449..f77d96cb9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -68,9 +68,9 @@ jobs: "ubuntu-22.04-clang-14.0.0", "ubuntu-22.04-emscripten-3.1", "ubuntu-22.04-gcc-12.1.0", - "macos-13-xcode-14.2", - "macos-13-xcode-14.2-arm64", - "windows-2022-gcc-11", + "macos-15-intel-xcode-16.4", + "macos-15-xcode-16.4-arm64", + "windows-2022-msys2-clang-14", "windows-2022-msvc-latest-x86", "windows-2022-msvc-latest-x64", "ubuntu-22.04-linter", @@ -103,29 +103,29 @@ jobs: lint: false runCsTests: false runTsTests: false - - name: macOS-13-xcode-14.2 - os: macOS-13 + - name: macos-15-intel-xcode-16.4 + os: macos-15-intel processor: x64 compiler: xcode - version: "14.2" + version: "16.4" makeReleaseBuild: false lint: false runCsTests: true runTsTests: false - - name: macOS-13-xcode-14.2-arm64 - os: macOS-13 + - name: macos-15-xcode-16.4-arm64 + os: macos-15 processor: arm64 compiler: xcode - version: "14.2" + version: "16.4" makeReleaseBuild: false lint: false runCsTests: false runTsTests: false - - name: windows-2022-gcc-11 + - name: windows-2022-msys2-clang-14 os: windows-2022 processor: x64 - compiler: gcc - version: "11" + compiler: clang + version: "14" makeReleaseBuild: false lint: false runCsTests: false @@ -246,7 +246,7 @@ jobs: if: (runner.os == 'macOS' && steps.filter.outputs.any == 'true') run: | ls -ls /Applications/ - ls -ls $ANDROID_SDK_ROOT/ndk + # ANDROID_SDK_ROOT may not be set on all runners sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app - name: Update Environment (Windows MSYS2) @@ -259,9 +259,9 @@ jobs: base-devel mingw-w64-clang-x86_64-gcc mingw-w64-clang-x86_64-toolchain - mingw-w64-clang-x86_64-clang-14 + mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-cmake - mingw-w64-clang-x86_64-llvm-14 + mingw-w64-clang-x86_64-llvm make git @@ -320,6 +320,13 @@ jobs: if: (runner.os == 'Windows' && matrix.compiler == 'msvc' && steps.filter.outputs.cpp == 'true') run: make test + - name: Run Tests (Windows MSYS2) + env: + PROCESSOR: ${{ matrix.processor }} + if: (runner.os == 'Windows' && matrix.compiler == 'clang' && steps.filter.outputs.cpp == 'true') + shell: msys2 {0} + run: make test-msys2 + - name: Run Tests (Windows-x86) env: PROCESSOR: ${{ matrix.processor }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 459dab65e..e2160c8bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,9 +59,9 @@ jobs: maccatalyst_build_arm64: name: MacCatalyst Build (arm64) - runs-on: macos-13 + runs-on: macos-15 env: - compiler_version: 14.2 + compiler_version: 16.4 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -82,9 +82,9 @@ jobs: macos_build_arm64: name: MacOS Build (arm64) - runs-on: macos-13 + runs-on: macos-15 env: - compiler_version: 14.2 + compiler_version: 16.4 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -105,9 +105,9 @@ jobs: macos_build_x64: name: MacOS Build (x64) - runs-on: macos-13 + runs-on: macos-15-intel env: - compiler_version: 14.2 + compiler_version: 16.4 steps: - name: Checkout Code uses: actions/checkout@v4 @@ -313,8 +313,8 @@ jobs: name: ["windows-os"] include: # - name: macOS - # os: macOS-13 - # version: "14.2" + # os: macos-26 + # version: "26.2" # osFolder: "maccatalyst" - name: windows-os os: windows-2022 diff --git a/Makefile b/Makefile index 32fd19ef3..aa16cd2cb 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ EMSDK?=$(ELECTIONGUARD_CACHE)/emscripten # not all platforms can compile all targets. # valid values: # OPERATING_SYSTEM: Android, Ios, Linux, Darwin, Windows +# OS_VARIANT: Debian, Alpine # PROCESSOR: arm64, x64, x86 ifeq ($(OS),Windows_NT) OPERATING_SYSTEM ?= Windows @@ -114,18 +115,34 @@ ifeq ($(OPERATING_SYSTEM),Darwin) endif ifeq ($(OPERATING_SYSTEM),Linux) @echo 🐧 LINUX INSTALL - sudo apt install -y build-essential - sudo apt install -y iwyu - sudo apt install -y llvm - sudo apt install -y clang-12 - sudo apt install -y cmake - sudo apt install -y lcov - sudo apt install -y cppcheck - sudo apt install -y clang-format - sudo apt install -y clang-tidy - sudo apt install -y ninja-build - sudo apt install -y valgrind - sudo apt install -y unzip + if [ -f /etc/os-release ] && grep -qi "alpine" /etc/os-release; then \ + echo "🏔️ Alpine Linux detected"; \ + sudo apk update; \ + echo "Installing CXX dependencies"; \ + sudo apk add make musl-dev g++ cmake; \ + echo "Installing DotNet dependencies"; \ + sudo apk add dotnet10-sdk dotnetcore10-runtime; \ + else \ + echo "🐧 Debian-based Linux detected"; \ + wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb; \ + sudo dpkg -i packages-microsoft-prod.deb; \ + rm packages-microsoft-prod.deb; \ + sudo apt update; \ + sudo apt install -y build-essential; \ + sudo apt install -y iwyu; \ + sudo apt install -y llvm; \ + sudo apt install -y clang-14; \ + sudo apt install -y cmake; \ + sudo apt install -y lcov; \ + sudo apt install -y cppcheck; \ + sudo apt install -y clang-format; \ + sudo apt install -y clang-tidy; \ + sudo apt install -y ninja-build; \ + sudo apt install -y valgrind; \ + sudo apt install -y unzip; \ + sudo apt install -y dotnet-sdk-10.0; \ + sudo apt install -y npm; \ + fi endif ifeq ($(OPERATING_SYSTEM),Windows) @echo 🏁 WINDOWS INSTALL @@ -134,11 +151,20 @@ ifeq ($(OPERATING_SYSTEM),Windows) choco upgrade cmake -y choco upgrade ninja -y choco upgrade vswhere -y + choco upgrade llvm -y + choco install dotnet-sdk endif wget -O cmake/CPM.cmake https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.38.2/CPM.cmake make fetch-sample-data dotnet tool restore +# environment-dotnet: +# ifeq ($(OPERATING_SYSTEM),Linux) +# # Ubuntu 22.04 and later? +# sudo add-apt-repository ppa:dotnet/backports +# apt-get update && sudo apt-get install -y dotnet-sdk-10.0 +# endif + environment-msys2: ifeq ($(OPERATING_SYSTEM),Windows) @echo 🏁 MSYS2 INSTALL @@ -187,6 +213,7 @@ ifeq ($(OPERATING_SYSTEM),Windows) cmake -S . -B $(ELECTIONGUARD_BUILD_LIBS_DIR)/$(OPERATING_SYSTEM)/$(PROCESSOR)/$(TARGET) \ -G "Visual Studio 18" -A $(VSPLATFORM) \ -DCMAKE_BUILD_TYPE=$(TARGET) \ + -DCMAKE_OBJECT_PATH_MAX=200 \ -DBUILD_SHARED_LIBS=ON \ -DDISABLE_VALE=$(TEMP_DISABLE_VALE) \ -DUSE_MSVC=ON \ @@ -307,7 +334,12 @@ build-cli: build-ui: @echo 🖥️ BUILD UI $(OPERATING_SYSTEM) $(PROCESSOR) $(TARGET) cd ./src/electionguard-ui && dotnet restore +ifeq ($(OPERATING_SYSTEM),Darwin) + dotnet build -f net10.0-maccatalyst -c $(TARGET) ./$(ELECTIONGUARD_APP_ADMIN_DIR)/ElectionGuard.UI/ElectionGuard.UI.csproj /p:APPCENTER_SECRET_MACOS=$(APPCENTER_SECRET_MACOS) +endif +ifeq ($(OPERATING_SYSTEM),Windows) dotnet build -c $(TARGET) ./src/electionguard-ui/ElectionGuard.UI.sln /p:Platform=$(PROCESSOR) /p:APPCENTER_SECRET_UWP=$(APPCENTER_SECRET_UWP) /p:APPCENTER_SECRET_MACOS=$(APPCENTER_SECRET_MACOS) +endif build-wasm: @echo 🌐 BUILD WASM $(OPERATING_SYSTEM) $(PROCESSOR) $(TARGET) @@ -388,7 +420,7 @@ generate-interop: # Lint / Format format: build - cd $(ELECTIONGUARD_BUILD_LIBS_DIR)/$(PROCESSOR) && $(MAKE) format + cd $(ELECTIONGUARD_BUILD_LIBS_DIR)/$(OPERATING_SYSTEM)/$(PROCESSOR) && $(MAKE) format lint: dotnet jb inspectcode -o="lint-results.xml" -f="Xml" --build --verbosity="WARN" --severity="Warning" bindings/netstandard/ElectionGuard/ElectionGuard.sln @@ -419,6 +451,7 @@ endif ifeq ($(OPERATING_SYSTEM),Darwin) dotnet publish -f net10.0-maccatalyst -c $(TARGET) /p:CreatePackage=true /p:ApplicationVersion=$(BUILD_NUMBER) /p:APPCENTER_SECRET_MACOS=$(APPCENTER_SECRET_MACOS) ./$(ELECTIONGUARD_APP_ADMIN_DIR)/ElectionGuard.UI/ElectionGuard.UI.csproj -o ./publish endif +# add error for running on Linuxx! publish-ui-appcenter: @echo 🧱 PUBLISH UI APPCENTER @@ -440,7 +473,7 @@ else @echo "APPCENTER_SECRET_MACOS not set. Skipping AppCenter publish" exit 1 endif - +# add linux check publish-wasm: build-npm @echo 🌐 PUBLISH WASM ifeq ($(OPERATING_SYSTEM),Windows) @@ -728,7 +761,7 @@ fetch-sample-data: @echo ⬇️ FETCH Sample Data wget -O $(TEMPFILE) https://github.com/microsoft/electionguard/releases/download/v1.0/sample-data.zip unzip -o $(TEMPFILE) - rm -f $(TEMPFILE) +# rm -f $(TEMPFILE) generate-sample-data: build-netstandard @echo Generate Sample Data diff --git a/cmake/tools.cmake b/cmake/tools.cmake index 81543159d..988e98e4a 100644 --- a/cmake/tools.cmake +++ b/cmake/tools.cmake @@ -5,7 +5,7 @@ option(CODE_COVERAGE "Enable code coverage" OFF) option(USE_STATIC_ANALYSIS "use static analysis tools" OFF) option(USE_DYNAMIC_ANALYSIS "use dynamic analysis tools" OFF) -option(USE_FORMATTING "use formatting tools" OFF) +option(USE_FORMATTING "use formatting tools" ON) function(use_valgrind TARGET_NAME) set(VALGRIND_LOG ${PROJECT_BINARY_DIR}/valgrind.log) @@ -20,7 +20,7 @@ function(use_valgrind TARGET_NAME) endfunction() # ---- Dependencies ---- -include(cmake/CPM_0.31.0.cmake) +include(cmake/CPM.cmake) CPMAddPackage( NAME StableCoder-cmake-scripts @@ -111,7 +111,7 @@ if(USE_DYNAMIC_ANALYSIS) endif() endif() -#if(USE_FORMATTING) -# message("++ Running with formatting") -# include(${StableCoder-cmake-scripts_SOURCE_DIR}/formatting.cmake) -#endif() +## if(USE_FORMATTING) +## message("++ Running with formatting") +## include(${StableCoder-cmake-scripts_SOURCE_DIR}/formatting.cmake) +## endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f257921c2..702728303 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.14...3.16 FATAL_ERROR) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") # ---- Dependencies ---- -include(../cmake/CPM_0.31.0.cmake) +include(../cmake/CPM.cmake) CPMAddPackage( NAME date @@ -266,7 +266,7 @@ if(CODE_COVERAGE) target_code_coverage(${META_PROJECT_TARGET} AUTO) endif() -#if(USE_FORMATTING) -# message("++ Building with formatting") -# clang_format(format ${PROJECT_SOURCE_FILES}) -#endif() +## if(USE_FORMATTING) +## message("++ Building with formatting") +## clang_format(format ${PROJECT_SOURCE_FILES}) +## endif() diff --git a/src/electionguard-ui/Directory.Packages.props b/src/electionguard-ui/Directory.Packages.props index e641f943a..1168729c3 100644 --- a/src/electionguard-ui/Directory.Packages.props +++ b/src/electionguard-ui/Directory.Packages.props @@ -8,8 +8,9 @@ - - + + + diff --git a/src/electionguard-ui/ElectionGuard.UI/ElectionGuard.UI.csproj b/src/electionguard-ui/ElectionGuard.UI/ElectionGuard.UI.csproj index 61b5ff481..c37a70b07 100644 --- a/src/electionguard-ui/ElectionGuard.UI/ElectionGuard.UI.csproj +++ b/src/electionguard-ui/ElectionGuard.UI/ElectionGuard.UI.csproj @@ -1,7 +1,7 @@  - + net10.0-maccatalyst net10.0-windows10.0.19041.0 Exe true @@ -20,7 +20,7 @@ 1.92.0 19 - + 15.3 10.0.19041.0 10.0.19041.0 @@ -37,6 +37,7 @@ $(DefineConstants);APPCENTER_SECRET_MACOS=$(APPCENTER_SECRET_MACOS);APPCENTER_SECRET_UWP=$(APPCENTER_SECRET_UWP) + false maccatalyst-arm64;maccatalyst-x64 @@ -68,8 +69,8 @@ - - False + portable + @@ -95,8 +96,8 @@ - - False + portable + @@ -149,11 +150,12 @@ - + + diff --git a/src/electionguard-ui/ElectionGuard.UI/Services/TallyManager.cs b/src/electionguard-ui/ElectionGuard.UI/Services/TallyManager.cs index ab8937d81..c243aab2c 100644 --- a/src/electionguard-ui/ElectionGuard.UI/Services/TallyManager.cs +++ b/src/electionguard-ui/ElectionGuard.UI/Services/TallyManager.cs @@ -5,12 +5,12 @@ using ElectionGuard.Decryption.Extensions; using ElectionGuard.Decryption.Shares; using ElectionGuard.Decryption.Tally; +using ElectionGuard.ElectionSetup; using ElectionGuard.Converters; using ElectionGuard.Extensions; using ElectionGuard.Guardians; using MongoDB.Driver; using Newtonsoft.Json; -using ElectionGuard.ElectionSetup; namespace ElectionGuard.UI.Services { @@ -381,7 +381,7 @@ private async Task HydrateGuardian( userId, keyCeremony, publicKeys, - backups.ToDictionary(k => k.GuardianId!, v => v.Backup!.ToRecord())) ?? throw new ElectionGuardException(nameof(userId)); + backups.ToDictionary(k => k.GuardianId!, v => v.Backup!)) ?? throw new ElectionGuardException(nameof(userId)); return guardian; } catch (Exception ex)