From ffc62c792c9a5196cb4ce7a353287dfe20db6524 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Fri, 9 Oct 2026 14:12:35 +0200 Subject: New upstream version 3.3.0~beta1+dfsg --- .github/actions/build-linux-payload/action.yml | 55 +- .github/actions/build-linux-sanitizers/action.yml | 99 +- .github/actions/build-windows-deps/action.yml | 24 +- .github/actions/upload-release-tarballs/action.yml | 51 + .github/actions/warm-macos-deps/action.yml | 15 + .github/images/linux-ci/Dockerfile.armhf-cross | 76 +- .github/images/linux-ci/Dockerfile.armhf-runtime | 1 + .github/images/linux-ci/README.md | 64 +- .../linux-ci/install-armhf-runtime-packages.sh | 1 + .github/scripts/armhf-ci-image-config.sh | 13 +- .github/scripts/armhf-static-ldd.sh | 6 +- .github/scripts/armhf-toolchain-config.sh | 17 + .../scripts/audit-staged-dll-imports-windows.sh | 18 +- .github/scripts/beta-scheduler.py | 798 + .github/scripts/build-fftw-macos.sh | 2 +- .github/scripts/build-linux-armhf-cross.sh | 15 +- .github/scripts/generate-quick-downloads.py | 13 +- .github/scripts/is-linux-ci-image-input.sh | 2 + .github/scripts/linux-artifact-validation.sh | 10 +- .github/scripts/linux-ci-image-inputs.sh | 2 + .github/scripts/linuxdeploy-excludelist.txt | 55 + .github/scripts/package-cli-tools.sh | 499 + .github/scripts/package-linux-armhf.sh | 45 +- .github/scripts/release-linux-images.py | 202 + .github/scripts/release-policy.py | 463 +- .github/scripts/select-linux-packaging.sh | 102 +- .github/scripts/smoke-release-tarballs.sh | 123 + .github/scripts/summarize-native-caches.py | 67 + .../tests/test_armhf_cross_configuration.py | 59 +- .../scripts/tests/test_armhf_sysroot_symlinks.py | 2 +- .github/scripts/tests/test_beta_scheduler.py | 1368 ++ .github/scripts/tests/test_check_candidate_tag.py | 2 + .github/scripts/tests/test_ghcr_retention.py | 11 + .github/scripts/tests/test_linux_ccache_policy.py | 189 +- .../tests/test_linux_image_publication_policy.py | 252 +- .github/scripts/tests/test_native_cache_policy.py | 86 + .github/scripts/tests/test_package_cli_tools.py | 745 + .github/scripts/tests/test_release_linux_images.py | 158 + .github/scripts/tests/test_release_policy.py | 1156 +- .../scripts/tests/test_release_workflow_policy.py | 186 + .github/scripts/third-party-libraries.tsv | 27 + .github/scripts/validate-ci-inputs.sh | 29 +- .github/scripts/validate-linux-armhf-runtime.sh | 4 +- .github/scripts/validate-workflow-timeouts.py | 14 + .github/scripts/verify-armhf-ci-image.sh | 1 + .github/scripts/verify-macos-artifacts.sh | 14 +- .github/workflows/beta-continue.yml | 71 + .github/workflows/beta-cut.yml | 69 + .github/workflows/build-linux-sanitizers.yml | 9 +- .github/workflows/build-linux.yml | 268 +- .github/workflows/build-macos.yml | 207 +- .github/workflows/build-selected-artifacts.yml | 22 +- .github/workflows/build-windows.yml | 125 +- .github/workflows/ci.yml | 32 +- .github/workflows/prepare-release-dependencies.yml | 104 + .github/workflows/promote-release.yml | 104 +- .github/workflows/public-release.yml | 178 +- .github/workflows/publish-linux-ci-images.yml | 63 +- .github/workflows/release-tag-helper.yml | 5 +- .github/workflows/release.yml | 65 +- .github/workflows/sign-windows-release.yml | 9 +- .github/workflows/warm-dependency-caches.yml | 119 + Audio/AudioDevice.hpp | 2 + Audio/BWFFile.cpp | 21 + Audio/BWFFile.hpp | 2 + Audio/FixtureAudioInput.cpp | 69 +- Audio/FixtureAudioInput.hpp | 8 + Audio/FixtureSoundOutput.cpp | 59 +- Audio/FixtureSoundOutput.hpp | 8 + Audio/TxAudioQueue.cpp | 26 +- Audio/TxAudioQueue.hpp | 10 + Audio/WavFile.cpp | 10 + Audio/WavFile.hpp | 4 + Audio/WavInputLoader.cpp | 3 + Audio/WavInputLoader.hpp | 4 + Audio/soundin.cpp | 35 +- Audio/soundin.h | 5 + CMake/CompilerFlags.cmake | 6 + CMake/Dependencies.cmake | 5 +- CMake/Install.cmake | 46 +- CMake/Modules/read_release_state.cmake | 32 +- CMake/Modules/read_release_tarballs.cmake | 37 + CMake/Modules/set_build_type.cmake | 77 +- CMake/SourceNavigation.cmake | 41 + CMake/Sources.cmake | 34 +- CMake/Utils.cmake | 13 +- CMake/generate_tags.cmake | 50 + CMake/prerelease_expiry.cmake | 16 + CMake/release-tarballs.txt | 5 + CMakeCPackOptions.cmake.in | 6 +- CMakeLists.txt | 284 +- Configuration.cpp | 848 +- Configuration.hpp | 16 +- Configuration.ui | 77 +- Darwin/ReadMe.txt | 69 +- Darwin/com.wsjtx.sysctl.plist | 18 - DecodeOperatingContext.hpp | 3 + DecoderEngine.h | 349 + DecoderIpc.cpp | 368 +- DecoderIpc.hpp | 148 +- DecoderIpcProtocol.h | 11 +- DecoderOutputFramer.cpp | 44 +- DecoderOutputFramer.hpp | 5 + Detector/Detector.cpp | 160 +- Detector/Detector.hpp | 16 + JttyDecoder.hpp | 116 + JttyReceiveAudio.hpp | 200 + JttyReceiveHistory.hpp | 81 + JttyReceiveLine.hpp | 229 + JttyReceiveResultController.cpp | 112 + JttyReceiveResultController.hpp | 81 + JttyReceiveTiming.hpp | 11 + JttyRecording.cpp | 251 + JttyRecording.hpp | 97 + JttyTxLoopbackTestController.cpp | 418 +- JttyTxLoopbackTestController.hpp | 19 +- LiveAudioTestController.cpp | 386 +- LiveAudioTestController.hpp | 19 + MetaDataRegistry.cpp | 1 + Modulator/JttyPcmFifo.cpp | 9 +- Modulator/JttyTxStream.cpp | 83 +- Modulator/JttyTxStream.hpp | 17 + Network/LiveCQUpload.cpp | 119 + Network/LiveCQUpload.hpp | 53 + Network/LotWUsers.cpp | 171 +- Radio.cpp | 46 +- Radio.hpp | 3 + SampleDownloader.cpp | 18 +- SampleDownloader.hpp | 23 +- SampleDownloader/Directory.cpp | 6 +- SampleDownloader/Directory.hpp | 3 +- SampleDownloader/FileNode.cpp | 5 +- SampleDownloader/FileNode.hpp | 3 +- SampleDownloader/README | 5 +- SampleDownloader/RemoteFile.cpp | 15 +- SampleDownloader/RemoteFile.hpp | 7 +- Transceiver/EmulateSplitTransceiver.cpp | 6 + Transceiver/EmulateSplitTransceiver.hpp | 6 + Transceiver/TCITransceiver.cpp | 146 +- Transceiver/TCITransceiver.hpp | 12 + Transceiver/Transceiver.cpp | 4 + Transceiver/Transceiver.hpp | 18 +- Transceiver/TransceiverBase.cpp | 8 + Transceiver/TransceiverBase.hpp | 2 + Transceiver/TxInhibitTransceiver.cpp | 7 + Transceiver/TxInhibitTransceiver.hpp | 6 + WavDecodeTestController.cpp | 372 + WavDecodeTestController.hpp | 53 + ci-cd/DEPLOYMENT_PLAYBOOK.md | 590 +- ci-cd/DEVELOPMENT_WORKFLOW.md | 211 +- commons.h | 18 +- debian/changelog.in | 2 +- doc/user_guide/en/settings-frequencies.adoc | 22 +- lib/77bit/decoder_codec_context.f90 | 16 + lib/77bit/packjt77.f90 | 872 +- lib/77bit/packjt77_grammar.f90 | 93 +- lib/77bit/packjt77_schema.f90 | 30 + lib/DecoderWorkerLock.cpp | 55 + lib/DecoderWorkerLock.hpp | 23 + lib/NativeSharedMemory.cpp | 253 + lib/NativeSharedMemory.hpp | 44 + lib/afc65b.f90 | 17 +- lib/astro.f90 | 10 +- lib/astro0.f90 | 9 +- lib/astrosub.f90 | 10 +- lib/blanker.f90 | 38 +- lib/decode65a.f90 | 21 +- lib/decode9w.f90 | 40 +- lib/decoder.f90 | 617 +- lib/decoder_callbacks.f90 | 269 +- lib/decoder_engine.f90 | 1366 ++ lib/decoder_engine_types.f90 | 99 + lib/decoder_ipc_control.cpp | 3 +- lib/decoder_ipc_control.h | 2 +- lib/decoder_ipc_layout.cpp | 230 + lib/decoder_ipc_layout.f90 | 174 + lib/decoder_ipc_layout.h | 69 + lib/downsam9.f90 | 159 +- lib/extract.f90 | 12 +- lib/fchisq.f90 | 18 +- lib/fchisq65.f90 | 16 +- lib/filbig.f90 | 67 +- lib/fst4/decode240_101.f90 | 24 +- lib/fst4/decode240_74.f90 | 24 +- lib/fst4/fastosd240_74.f90 | 108 +- lib/fst4/fst4_baseline.f90 | 18 +- lib/fst4/fst4_osd_workspace.f90 | 40 + lib/fst4/gen_fst4wave.f90 | 128 +- lib/fst4/get_fst4_bitmetrics.f90 | 87 +- lib/fst4/osd240_101.f90 | 188 +- lib/fst4/osd240_74.f90 | 188 +- lib/fst4_decode.f90 | 792 +- lib/fst4_host_support.f90 | 81 + lib/ft4/genft4.f90 | 170 +- lib/ft4_decode.f90 | 66 +- lib/ft8/ft8_a7.f90 | 42 +- lib/ft8/ft8_a8_test.f90 | 1 + lib/ft8/ft8_a8d.f90 | 26 +- lib/ft8/ft8apset.f90 | 21 +- lib/ft8/ft8b.f90 | 45 +- lib/ft8/genft8.f90 | 123 +- lib/ft8/subtractft8.f90 | 10 +- lib/ft8/sync8.f90 | 6 +- lib/ft8_decode.f90 | 135 +- lib/ft8_engine_kernel.f90 | 636 + lib/ft8var/cwfilter.f90 | 40 +- lib/ft8var/fillhashvar.f90 | 12 +- lib/ft8var/four2avar.f90 | 3 +- lib/ft8var/ft8_decodevar.f90 | 76 +- lib/ft8var/ft8_mod1.f90 | 50 + lib/ft8var/ft8apsetvar.f90 | 82 +- lib/ft8var/ft8bvar.f90 | 81 +- lib/ft8var/ft8mfcqvar.f90 | 13 +- lib/ft8var/ft8sd1var.f90 | 15 +- lib/ft8var/ft8sdvar.f90 | 15 +- lib/ft8var/ft8svar.f90 | 13 +- lib/ft8var/genft8sdvar.f90 | 54 +- lib/ft8var/genft8var.f90 | 209 +- lib/ft8var/partintft8.f90 | 13 +- lib/ft8var/tone8.f90 | 32 +- lib/ft8var/tone8myc.f90 | 12 +- lib/ft8var/tonesdvar.f90 | 16 +- lib/ftrsd/ftrsdap.c | 2 +- lib/get_q3list.f90 | 160 +- lib/hint65.f90 | 75 +- lib/jt65_decode.f90 | 230 +- lib/jt65_host_support.f90 | 61 + lib/jt65_mod.f90 | 75 + lib/jt65_test.f90 | 10 +- lib/jt9.f90 | 96 +- lib/jt9_decode.f90 | 150 +- lib/jt9_input_validation.f90 | 9 +- lib/jt9_params_init.f90 | 4 +- lib/jt9a.f90 | 138 +- lib/jt9a_stub.f90 | 7 +- lib/jt9com.f90 | 25 +- lib/jt9w.f90 | 4 +- lib/jtty/genjtty.f90 | 22 +- lib/jtty/jtty_design.md | 86 +- lib/jtty/jtty_design.txt | 231 - lib/jtty/jtty_mdecode.f90 | 107 +- lib/jtty/jtty_mod.f90 | 13 +- lib/jtty/jtty_n1mm_integration.md | 85 +- lib/jtty/jtty_receive_context.f90 | 297 + lib/jtty/jtty_source_codec.f90 | 8 +- lib/jtty/jtty_source_encoding.txt | 107 +- lib/jtty/jtty_tx_manual_checks.md | 33 +- lib/jtty/rjtty_sub.f90 | 5 +- lib/jtty/sjtty.f90 | 8 +- lib/jtty/wava/plot_results.py | 57 - lib/jtty/wava/tbcc_performance_curves.png | Bin 263436 -> 0 bytes lib/lorentzian.f90 | 7 +- lib/options.f90 | 2 + lib/prog_args.f90 | 1 + lib/q65_codec.f90 | 154 + lib/q65_decode.f90 | 404 +- lib/q65_host_support.f90 | 64 + lib/qra/q65/genq65.f90 | 22 +- lib/qra/q65/q65.f90 | 599 +- lib/qra/q65/q65.h | 5 +- lib/qra/q65/q65_callers.F90 | 142 + lib/qra/q65/q65_limits.h | 8 + lib/qra/q65/q65_loops.f90 | 4 +- lib/qra/q65/q65_set_list2.f90 | 17 +- lib/qra/q65/q65_subs.c | 223 +- lib/qra/q65/q65_workspace.f90 | 42 + lib/shmem.cpp | 58 +- lib/shmem.f90 | 26 +- lib/softsym.f90 | 28 +- lib/softsym9w.f90 | 18 +- lib/spec64.f90 | 6 +- lib/streaming_apply.f90 | 11 +- lib/streaming_emit.f90 | 31 +- lib/streaming_io.f90 | 257 +- lib/streaming_period.f90 | 70 + lib/subtract65.f90 | 44 +- lib/superfox/qpc_sync.f90 | 6 +- lib/superfox/sfox_gen_gfsk.f90 | 4 +- lib/superfox/sfox_pack.f90 | 38 +- lib/superfox/sfox_remove_ft8.f90 | 26 +- lib/superfox/sfox_unpack.f90 | 96 +- lib/superfox/sfrx_sub.f90 | 34 +- lib/symspec65.f90 | 23 +- lib/sync65.f90 | 10 +- lib/sync9.f90 | 11 +- lib/sync9w.f90 | 15 +- lib/tmoonsub.c | 2 +- lib/xcor.f90 | 6 +- main.cpp | 218 +- map65/CMakeLists.txt | 3 +- map65/bandmap.cpp | 8 +- map65/commons.h | 2 - map65/decode_label.h | 1 + map65/devsetup.cpp | 29 +- map65/devsetup.ui | 3 + map65/getsvn.cmake | 16 - map65/libm65/CMakeLists.txt | 27 + map65/libm65/decode0.f90 | 2 +- map65/libm65/decode1a.f90 | 30 +- map65/libm65/display.f90 | 283 +- map65/libm65/filbig.f90 | 20 +- map65/libm65/ftninit.f90 | 1 - map65/libm65/m65_mod.f90 | 21 +- map65/libm65/map65a.f90 | 105 +- map65/libm65/message_history_mod.f90 | 109 + map65/libm65/npar_ptrs_mod.f90 | 59 +- map65/libm65/ptt.c | 138 +- map65/libm65/ptt.h | 19 + map65/libm65/ptt_unix.c | 185 +- map65/libm65/q65b.F90 | 120 +- map65/libm65/tmoonsub.c | 2 +- map65/liveCQSender.cpp | 150 - map65/liveCQSender.hpp | 53 - map65/livecq_decode.cpp | 143 + map65/livecq_decode.hpp | 39 + map65/mainwindow.cpp | 287 +- map65/mainwindow.h | 8 +- map65/map65_config.h.in | 4 - map65/messages.cpp | 210 +- map65/messages.h | 11 +- map65/widegraph.cpp | 20 +- map65/widegraph.h | 13 +- models/DecodeHighlightingModel.cpp | 386 +- models/DecodeHighlightingModel.hpp | 32 +- models/FrequencyList.cpp | 147 +- models/FrequencyList.hpp | 16 +- models/FrequencySuggestions.cpp | 164 + models/FrequencySuggestions.hpp | 44 + models/IARURegions.cpp | 10 + models/IARURegions.hpp | 1 + qmap/CMakeLists.txt | 1 + qmap/getsvn.cmake | 16 - qmap/libqmap/CMakeLists.txt | 2 +- qmap/libqmap/getcand2.f90 | 15 +- qmap/libqmap/q65b.f90 | 79 +- qmap/libqmap/qmapa.f90 | 9 +- qmap/livecq_parser.cpp | 28 + qmap/livecq_parser.h | 7 + qmap/mainwindow.cpp | 91 +- qmap/mainwindow.h | 4 +- qmap/map65_config.h.in | 4 - qt_helpers.cpp | 27 + qt_helpers.hpp | 3 + release-linux-images.json | 22 + release-state.txt | 8 +- revision_utils.cpp | 5 +- samples/CMakeLists.txt | 67 - samples/FST4+FST4W/201230_0300.wav | Bin 43200254 -> 0 bytes samples/FST4+FST4W/210115_0058.wav | Bin 1440250 -> 0 bytes samples/FT4/000000_000002.wav | Bin 145196 -> 0 bytes samples/FT8/210703_133430.wav | Bin 360246 -> 0 bytes samples/ISCAT/ISCAT-A/VK7MO_110401_235515.wav | Bin 327724 -> 0 bytes samples/ISCAT/ISCAT-B/K0AWU_100714_115000.wav | Bin 661544 -> 0 bytes samples/JT4/JT4A/DF2ZC_070926_040700.WAV | Bin 1146924 -> 0 bytes samples/JT4/JT4F/OK1KIR_141105_175700.WAV | Bin 1146924 -> 0 bytes samples/JT65/JT65B/000000_0001.wav | Bin 1296044 -> 0 bytes samples/JT65/JT65B/000000_0002.wav | Bin 1296044 -> 0 bytes samples/JT65/JT65B/000000_0003.wav | Bin 1296044 -> 0 bytes samples/JT65/JT65B/000000_0004.wav | Bin 1296044 -> 0 bytes samples/JT65/JT65B/000000_0005.wav | Bin 1296044 -> 0 bytes samples/JT65/JT65B/000000_0006.wav | Bin 1296044 -> 0 bytes samples/JT65/JT65B/000000_0007.wav | Bin 1296044 -> 0 bytes samples/JT65/JT65B/DL7UAE_040308_002400.wav | Bin 584369 -> 0 bytes samples/JT9/130418_1742.wav | Bin 1440044 -> 0 bytes samples/JTTY/260807_134110.wav | Bin 725992 -> 0 bytes samples/MSK144/181211_120500.wav | Bin 360214 -> 0 bytes samples/MSK144/181211_120800.wav | Bin 360214 -> 0 bytes .../Q65/120D_Rainscatter_10_GHz/210117_0920.wav | Bin 2880256 -> 0 bytes samples/Q65/120E_Ionoscatter_6m/210130_1438.wav | Bin 2880252 -> 0 bytes samples/Q65/120E_Ionoscatter_6m/210130_1442.wav | Bin 2880252 -> 0 bytes samples/Q65/300A_Optical_Scatter/201210_0505.wav | Bin 7200236 -> 0 bytes samples/Q65/30A_Ionoscatter_6m/201203_022700.wav | Bin 720234 -> 0 bytes samples/Q65/30A_Ionoscatter_6m/201203_022800.wav | Bin 720234 -> 0 bytes samples/Q65/30A_Ionoscatter_6m/201203_022900.wav | Bin 720234 -> 0 bytes samples/Q65/30A_Ionoscatter_6m/201203_024000.wav | Bin 720234 -> 0 bytes samples/Q65/60A_EME_6m/210106_1621.wav | Bin 1440256 -> 0 bytes samples/Q65/60B_1296_Troposcatter/210109_0007.wav | Bin 1440238 -> 0 bytes samples/Q65/60B_1296_Troposcatter/210109_0147.wav | Bin 1440238 -> 0 bytes samples/Q65/60B_1296_Troposcatter/210109_0151.wav | Bin 1440238 -> 0 bytes samples/Q65/60D_EME_10GHz/201212_1838.wav | Bin 1440238 -> 0 bytes samples/QMAP/241019_0403.qm | Bin 11520142 -> 0 bytes samples/README | 20 - samples/WSPR/150426_0918.wav | Bin 2880044 -> 0 bytes samples/make_contents.cmake | 107 - test/apply_routing_test.f90 | 43 +- tests/CMakeLists.txt | 50 +- tests/integration/decoder_engine/run_wav_gui.cmake | 70 + tests/integration/jt65/check_stream.py | 27 + .../integration/jt9/verify_loaded_libraries.cmake | 39 + tests/integration/jtty/run_live_audio.cmake | 36 +- tests/integration/jtty/run_tx_loopback.cmake | 46 +- tests/integration/jtty/tx_loopback.expected.txt | 2 +- tests/release/test_build_type.cmake | 169 + tests/release/test_expiry_build_step.cmake | 43 + tests/release/test_git_archive.cmake | 17 +- tests/release/test_package_version_order.cmake | 59 + tests/release/test_release_state.cmake | 107 +- tests/release/test_release_state_dependency.cmake | 12 + tests/release/test_release_tarballs.cmake | 44 + tests/release/validate_release_state_fixture.cmake | 2 +- .../validate_release_tarballs_fixture.cmake | 4 + tests/unit/audio/CMakeLists.txt | 16 + .../audio/test_audio_input_stream_descriptor.cpp | 12 +- tests/unit/audio/test_echosim_wav_trailer.cpp | 30 +- tests/unit/audio/test_receive_audio_handoff.cpp | 249 + tests/unit/audio/test_sound_input.cpp | 85 + tests/unit/audio/test_tx_audio_queue.cpp | 9 +- tests/unit/audio/test_wav_input_loading.cpp | 69 + tests/unit/common/CMakeLists.txt | 49 + tests/unit/common/test_active_stations.cpp | 31 + .../common/test_configuration_dialog_layout.cpp | 41 + tests/unit/common/test_configuration_radio.cpp | 237 + .../unit/common/test_decode_highlighting_model.cpp | 526 + tests/unit/common/test_frequency_list.cpp | 294 + tests/unit/common/test_frequency_suggestions.cpp | 200 + tests/unit/common/test_log_window_deletion.cpp | 202 + tests/unit/common/test_qt_helpers.cpp | 33 + tests/unit/common/test_radio_callsign.cpp | 128 + tests/unit/decoder_engine/CMakeLists.txt | 222 + .../unit/decoder_engine/decoder_engine_signal.f90 | 190 + tests/unit/decoder_engine/fst4_engine_signal.f90 | 286 + tests/unit/decoder_engine/jt65_engine_signal.f90 | 52 + tests/unit/decoder_engine/jt9_engine_signal.f90 | 88 + tests/unit/decoder_engine/q65_engine_signal.f90 | 85 + tests/unit/decoder_engine/test_decoder_engine.c | 373 + .../unit/decoder_engine/test_decoder_engine_fst4.c | 369 + .../test_decoder_engine_fst4_host.f90 | 211 + .../unit/decoder_engine/test_decoder_engine_ft4.c | 225 + .../unit/decoder_engine/test_decoder_engine_jt65.c | 578 + .../test_decoder_engine_jt65_host.f90 | 190 + .../unit/decoder_engine/test_decoder_engine_jt9.c | 361 + .../unit/decoder_engine/test_decoder_engine_q65.c | 535 + .../test_decoder_engine_q65_host.f90 | 236 + tests/unit/decoder_ipc/CMakeLists.txt | 43 +- tests/unit/decoder_ipc/check_gui_handshake.py | 70 + .../unit/decoder_ipc/decoder_ipc_fortran_probe.f90 | 7 +- .../decoder_ipc/test_decode_operating_context.cpp | 14 + .../decoder_ipc/test_decoder_ipc_handshake.cpp | 603 + tests/unit/decoder_ipc/test_decoder_ipc_layout.cpp | 192 + .../unit/decoder_ipc/test_decoder_ipc_protocol.cpp | 178 +- .../decoder_ipc/test_decoder_output_framer.cpp | 106 + tests/unit/decoder_ipc/test_decoder_session.cpp | 561 + tests/unit/fst4/test_fst4_osd_depth.f90 | 76 +- tests/unit/ft8/CMakeLists.txt | 3 +- tests/unit/ft8/test_ft8_mtd_decode_coordinator.cpp | 46 +- tests/unit/jpl/test_jpl_resilience.f90 | 63 +- tests/unit/jt65/test_jt65_decode_pipeline.f90 | 52 +- tests/unit/jt65/test_jt65_xcor_silence.f90 | 8 +- tests/unit/jt65/test_map65_jt65_handoff.f90 | 55 +- tests/unit/jt9/test_jt9_cli_validation.cmake | 13 + tests/unit/jt9/test_jt9_input_validation.f90 | 8 +- tests/unit/jtty/CMakeLists.txt | 61 +- tests/unit/jtty/jtty_cpp_n1mm_smoke.cpp | 22 +- tests/unit/jtty/test_jtty_continuous_decode.f90 | 316 + tests/unit/jtty/test_jtty_draft_acceptance.cpp | 128 - tests/unit/jtty/test_jtty_get_updates.f90 | 19 +- tests/unit/jtty/test_jtty_live_entry.cpp | 86 + tests/unit/jtty/test_jtty_messages.cpp | 294 +- tests/unit/jtty/test_jtty_n1mm.cpp | 177 + tests/unit/jtty/test_jtty_overlap_decode.f90 | 14 +- tests/unit/jtty/test_jtty_pack.f90 | 12 +- tests/unit/jtty/test_jtty_receive_history.cpp | 87 + tests/unit/jtty/test_jtty_receive_line.cpp | 209 + tests/unit/jtty/test_jtty_receive_results.cpp | 396 + tests/unit/jtty/test_jtty_recording.cpp | 274 + tests/unit/jtty/test_jtty_source_codec.f90 | 19 + tests/unit/jtty/test_jtty_spectrum.cpp | 192 + tests/unit/jtty/test_jtty_structured_decode.f90 | 155 +- tests/unit/jtty/test_jtty_tbcc_decoder.f90 | 57 +- tests/unit/jtty/test_jtty_tbcc_list_decoder.f90 | 152 +- tests/unit/jtty/test_jtty_transmit_queue.cpp | 107 + tests/unit/jtty/test_jtty_tx_lifecycle.cpp | 186 + tests/unit/jtty/test_jtty_txstream.cpp | 376 + tests/unit/jtty/test_jtty_waterfall.cpp | 104 + tests/unit/map65/CMakeLists.txt | 11 + .../map65/decode_history/decode_history_stubs.f90 | 16 +- .../decode_history/test_map65_decode_history.f90 | 108 +- tests/unit/map65/messages_retention/CMakeLists.txt | 17 + .../messages_retention_stubs.f90 | 35 + .../test_map65_messages_retention.f90 | 189 + tests/unit/map65/test_map65_deep_search_cache.f90 | 5 +- tests/unit/map65/test_map65_filbig_boundary.f90 | 64 + tests/unit/map65/test_map65_ptt_unix.c | 489 + tests/unit/map65/test_map65_ptt_windows.c | 323 + tests/unit/map65/test_map65_q65_dphi.f90 | 17 +- tests/unit/map65/test_map65_q65_handoff.f90 | 117 + tests/unit/map65/test_map65_symspec_contract.f90 | 118 + tests/unit/map65/windows_fake/windows.h | 29 + tests/unit/network/CMakeLists.txt | 31 + tests/unit/network/test_livecq_upload.cpp | 257 + tests/unit/network/test_lotw_users.cpp | 312 + tests/unit/network/test_map65_livecq_decode.cpp | 196 + tests/unit/network/test_sample_downloader.cpp | 151 + tests/unit/packjt77/CMakeLists.txt | 7 + .../unit/packjt77/test_packjt77_context_state.f90 | 117 + tests/unit/packjt77/test_packjt77_grammar_gate.f90 | 49 +- tests/unit/packjt77/test_packjt77_hash_state.f90 | 28 +- .../unit/packjt77/test_packjt77_schema_decoder.f90 | 34 + .../packjt77/test_packjt77sdvar_invariants.f90 | 11 +- tests/unit/q65/CMakeLists.txt | 16 +- tests/unit/q65/test_map65_wideband_sync_rows.f90 | 132 + tests/unit/q65/test_q65_caller_display.f90 | 123 + tests/unit/q65/test_q65_callers.f90 | 163 + tests/unit/q65/test_q65_decode_pipeline.f90 | 138 +- tests/unit/q65/test_q65_llh_contracts.c | 70 + tests/unit/qmap/CMakeLists.txt | 22 + tests/unit/qmap/test_livecq_parser.cpp | 52 + tests/unit/qmap/test_qmap_candidates.f90 | 185 + tests/unit/qmap/test_qmap_q65_connection.f90 | 123 + tests/unit/qmap/test_qmap_q65_handoff.f90 | 116 + tests/unit/qmap/test_qmap_symspec_contract.f90 | 67 + tests/unit/streaming/CMakeLists.txt | 21 +- tests/unit/streaming/test_streaming_consumers.cpp | 199 +- tests/unit/streaming/test_streaming_period.f90 | 116 + tests/unit/superfox/test_superfox_unpack.f90 | 69 +- .../superfox/test_superfox_unpack_unsupported.f90 | 24 +- tests/unit/tci/test_tci_receive_ownership.cpp | 202 +- translations/wsjtx_ca.ts | 4447 ++-- translations/wsjtx_da.ts | 4295 ++-- translations/wsjtx_de.ts | 22356 ++++++++++-------- translations/wsjtx_en.ts | 4522 ++-- translations/wsjtx_en_GB.ts | 4522 ++-- translations/wsjtx_es.ts | 4295 ++-- translations/wsjtx_hu.ts | 4485 ++-- translations/wsjtx_it.ts | 5320 +++-- translations/wsjtx_ja.ts | 4295 ++-- translations/wsjtx_pl.ts | 22362 +++++++++++-------- translations/wsjtx_ru.ts | 4509 ++-- translations/wsjtx_uk.ts | 3146 +-- translations/wsjtx_zh.ts | 4304 ++-- translations/wsjtx_zh_TW.ts | 4334 ++-- widgets/AbstractLogWindow.cpp | 57 +- widgets/DecodeHighlightingListView.cpp | 2 +- widgets/JttyDraftAcceptanceTracker.hpp | 56 - widgets/JttyLiveEntry.hpp | 53 + widgets/JttyMessages.hpp | 156 +- widgets/JttyMmttyHandoff.hpp | 78 + widgets/JttyN1mmOutput.hpp | 10 + widgets/JttySpectrum.cpp | 112 + widgets/JttySpectrum.hpp | 66 + widgets/JttyTransmitQueue.hpp | 156 + widgets/JttyTxLifecycle.hpp | 349 + widgets/SuggestedFrequenciesDialog.cpp | 252 + widgets/SuggestedFrequenciesDialog.hpp | 49 + widgets/astro.cpp | 10 +- widgets/astro.h | 3 + widgets/displaytext.cpp | 34 +- widgets/logqso.cpp | 10 +- widgets/mainwindow.cpp | 976 +- widgets/mainwindow.h | 214 +- widgets/mainwindow.ui | 82 +- widgets/mainwindow_jtty.cpp | 2666 ++- widgets/mainwindow_jtty_receive.cpp | 807 + widgets/mainwindow_settings.cpp | 38 +- widgets/mainwindow_show_messages.cpp | 5 + widgets/mainwindow_slots.cpp | 35 +- widgets/plotter.cpp | 54 +- widgets/plotter.h | 17 +- widgets/widegraph.cpp | 62 +- widgets/widegraph.h | 11 +- 560 files changed, 102838 insertions(+), 50197 deletions(-) create mode 100644 .github/actions/upload-release-tarballs/action.yml create mode 100755 .github/scripts/armhf-toolchain-config.sh create mode 100644 .github/scripts/beta-scheduler.py create mode 100644 .github/scripts/linuxdeploy-excludelist.txt create mode 100755 .github/scripts/package-cli-tools.sh create mode 100644 .github/scripts/release-linux-images.py create mode 100755 .github/scripts/smoke-release-tarballs.sh create mode 100644 .github/scripts/summarize-native-caches.py create mode 100644 .github/scripts/tests/test_beta_scheduler.py create mode 100644 .github/scripts/tests/test_native_cache_policy.py create mode 100644 .github/scripts/tests/test_package_cli_tools.py create mode 100644 .github/scripts/tests/test_release_linux_images.py create mode 100644 .github/scripts/tests/test_release_workflow_policy.py create mode 100644 .github/scripts/third-party-libraries.tsv create mode 100644 .github/workflows/beta-continue.yml create mode 100644 .github/workflows/beta-cut.yml create mode 100644 .github/workflows/prepare-release-dependencies.yml create mode 100644 CMake/Modules/read_release_tarballs.cmake create mode 100644 CMake/SourceNavigation.cmake create mode 100644 CMake/generate_tags.cmake create mode 100644 CMake/prerelease_expiry.cmake create mode 100644 CMake/release-tarballs.txt delete mode 100644 Darwin/com.wsjtx.sysctl.plist create mode 100644 DecoderEngine.h create mode 100644 JttyDecoder.hpp create mode 100644 JttyReceiveAudio.hpp create mode 100644 JttyReceiveHistory.hpp create mode 100644 JttyReceiveLine.hpp create mode 100644 JttyReceiveResultController.cpp create mode 100644 JttyReceiveResultController.hpp create mode 100644 JttyReceiveTiming.hpp create mode 100644 JttyRecording.cpp create mode 100644 JttyRecording.hpp create mode 100644 Network/LiveCQUpload.cpp create mode 100644 Network/LiveCQUpload.hpp create mode 100644 WavDecodeTestController.cpp create mode 100644 WavDecodeTestController.hpp create mode 100644 lib/77bit/decoder_codec_context.f90 create mode 100644 lib/DecoderWorkerLock.cpp create mode 100644 lib/DecoderWorkerLock.hpp create mode 100644 lib/NativeSharedMemory.cpp create mode 100644 lib/NativeSharedMemory.hpp create mode 100644 lib/decoder_engine.f90 create mode 100644 lib/decoder_engine_types.f90 create mode 100644 lib/decoder_ipc_layout.cpp create mode 100644 lib/decoder_ipc_layout.f90 create mode 100644 lib/decoder_ipc_layout.h create mode 100644 lib/fst4/fst4_osd_workspace.f90 create mode 100644 lib/fst4_host_support.f90 create mode 100644 lib/ft8_engine_kernel.f90 create mode 100644 lib/jt65_host_support.f90 delete mode 100644 lib/jtty/jtty_design.txt create mode 100644 lib/jtty/jtty_receive_context.f90 delete mode 100644 lib/jtty/wava/plot_results.py delete mode 100644 lib/jtty/wava/tbcc_performance_curves.png create mode 100644 lib/q65_codec.f90 create mode 100644 lib/q65_host_support.f90 create mode 100644 lib/qra/q65/q65_callers.F90 create mode 100644 lib/qra/q65/q65_limits.h create mode 100644 lib/streaming_period.f90 delete mode 100644 map65/getsvn.cmake create mode 100644 map65/libm65/message_history_mod.f90 create mode 100644 map65/libm65/ptt.h delete mode 100644 map65/liveCQSender.cpp delete mode 100644 map65/liveCQSender.hpp create mode 100644 map65/livecq_decode.cpp create mode 100644 map65/livecq_decode.hpp delete mode 100644 map65/map65_config.h.in create mode 100644 models/FrequencySuggestions.cpp create mode 100644 models/FrequencySuggestions.hpp delete mode 100644 qmap/getsvn.cmake delete mode 100644 qmap/map65_config.h.in create mode 100644 release-linux-images.json delete mode 100644 samples/CMakeLists.txt delete mode 100644 samples/FST4+FST4W/201230_0300.wav delete mode 100644 samples/FST4+FST4W/210115_0058.wav delete mode 100644 samples/FT4/000000_000002.wav delete mode 100644 samples/FT8/210703_133430.wav delete mode 100644 samples/ISCAT/ISCAT-A/VK7MO_110401_235515.wav delete mode 100644 samples/ISCAT/ISCAT-B/K0AWU_100714_115000.wav delete mode 100644 samples/JT4/JT4A/DF2ZC_070926_040700.WAV delete mode 100644 samples/JT4/JT4F/OK1KIR_141105_175700.WAV delete mode 100644 samples/JT65/JT65B/000000_0001.wav delete mode 100644 samples/JT65/JT65B/000000_0002.wav delete mode 100644 samples/JT65/JT65B/000000_0003.wav delete mode 100644 samples/JT65/JT65B/000000_0004.wav delete mode 100644 samples/JT65/JT65B/000000_0005.wav delete mode 100644 samples/JT65/JT65B/000000_0006.wav delete mode 100644 samples/JT65/JT65B/000000_0007.wav delete mode 100644 samples/JT65/JT65B/DL7UAE_040308_002400.wav delete mode 100644 samples/JT9/130418_1742.wav delete mode 100644 samples/JTTY/260807_134110.wav delete mode 100644 samples/MSK144/181211_120500.wav delete mode 100644 samples/MSK144/181211_120800.wav delete mode 100644 samples/Q65/120D_Rainscatter_10_GHz/210117_0920.wav delete mode 100644 samples/Q65/120E_Ionoscatter_6m/210130_1438.wav delete mode 100644 samples/Q65/120E_Ionoscatter_6m/210130_1442.wav delete mode 100644 samples/Q65/300A_Optical_Scatter/201210_0505.wav delete mode 100644 samples/Q65/30A_Ionoscatter_6m/201203_022700.wav delete mode 100644 samples/Q65/30A_Ionoscatter_6m/201203_022800.wav delete mode 100644 samples/Q65/30A_Ionoscatter_6m/201203_022900.wav delete mode 100644 samples/Q65/30A_Ionoscatter_6m/201203_024000.wav delete mode 100644 samples/Q65/60A_EME_6m/210106_1621.wav delete mode 100644 samples/Q65/60B_1296_Troposcatter/210109_0007.wav delete mode 100644 samples/Q65/60B_1296_Troposcatter/210109_0147.wav delete mode 100644 samples/Q65/60B_1296_Troposcatter/210109_0151.wav delete mode 100644 samples/Q65/60D_EME_10GHz/201212_1838.wav delete mode 100644 samples/QMAP/241019_0403.qm delete mode 100644 samples/README delete mode 100644 samples/WSPR/150426_0918.wav delete mode 100644 samples/make_contents.cmake create mode 100644 tests/integration/decoder_engine/run_wav_gui.cmake create mode 100644 tests/integration/jt65/check_stream.py create mode 100644 tests/integration/jt9/verify_loaded_libraries.cmake create mode 100644 tests/release/test_build_type.cmake create mode 100644 tests/release/test_expiry_build_step.cmake create mode 100644 tests/release/test_package_version_order.cmake create mode 100644 tests/release/test_release_state_dependency.cmake create mode 100644 tests/release/test_release_tarballs.cmake create mode 100644 tests/release/validate_release_tarballs_fixture.cmake create mode 100644 tests/unit/audio/test_sound_input.cpp create mode 100644 tests/unit/common/test_configuration_radio.cpp create mode 100644 tests/unit/common/test_decode_highlighting_model.cpp create mode 100644 tests/unit/common/test_frequency_list.cpp create mode 100644 tests/unit/common/test_frequency_suggestions.cpp create mode 100644 tests/unit/common/test_log_window_deletion.cpp create mode 100644 tests/unit/common/test_radio_callsign.cpp create mode 100644 tests/unit/decoder_engine/CMakeLists.txt create mode 100644 tests/unit/decoder_engine/decoder_engine_signal.f90 create mode 100644 tests/unit/decoder_engine/fst4_engine_signal.f90 create mode 100644 tests/unit/decoder_engine/jt65_engine_signal.f90 create mode 100644 tests/unit/decoder_engine/jt9_engine_signal.f90 create mode 100644 tests/unit/decoder_engine/q65_engine_signal.f90 create mode 100644 tests/unit/decoder_engine/test_decoder_engine.c create mode 100644 tests/unit/decoder_engine/test_decoder_engine_fst4.c create mode 100644 tests/unit/decoder_engine/test_decoder_engine_fst4_host.f90 create mode 100644 tests/unit/decoder_engine/test_decoder_engine_ft4.c create mode 100644 tests/unit/decoder_engine/test_decoder_engine_jt65.c create mode 100644 tests/unit/decoder_engine/test_decoder_engine_jt65_host.f90 create mode 100644 tests/unit/decoder_engine/test_decoder_engine_jt9.c create mode 100644 tests/unit/decoder_engine/test_decoder_engine_q65.c create mode 100644 tests/unit/decoder_engine/test_decoder_engine_q65_host.f90 create mode 100644 tests/unit/decoder_ipc/check_gui_handshake.py create mode 100644 tests/unit/decoder_ipc/test_decoder_ipc_handshake.cpp create mode 100644 tests/unit/decoder_ipc/test_decoder_ipc_layout.cpp create mode 100644 tests/unit/decoder_ipc/test_decoder_session.cpp create mode 100644 tests/unit/jtty/test_jtty_continuous_decode.f90 delete mode 100644 tests/unit/jtty/test_jtty_draft_acceptance.cpp create mode 100644 tests/unit/jtty/test_jtty_live_entry.cpp create mode 100644 tests/unit/jtty/test_jtty_receive_history.cpp create mode 100644 tests/unit/jtty/test_jtty_receive_line.cpp create mode 100644 tests/unit/jtty/test_jtty_receive_results.cpp create mode 100644 tests/unit/jtty/test_jtty_recording.cpp create mode 100644 tests/unit/jtty/test_jtty_spectrum.cpp create mode 100644 tests/unit/jtty/test_jtty_transmit_queue.cpp create mode 100644 tests/unit/jtty/test_jtty_tx_lifecycle.cpp create mode 100644 tests/unit/jtty/test_jtty_waterfall.cpp create mode 100644 tests/unit/map65/messages_retention/CMakeLists.txt create mode 100644 tests/unit/map65/messages_retention/messages_retention_stubs.f90 create mode 100644 tests/unit/map65/messages_retention/test_map65_messages_retention.f90 create mode 100644 tests/unit/map65/test_map65_filbig_boundary.f90 create mode 100644 tests/unit/map65/test_map65_ptt_unix.c create mode 100644 tests/unit/map65/test_map65_ptt_windows.c create mode 100644 tests/unit/map65/test_map65_q65_handoff.f90 create mode 100644 tests/unit/map65/test_map65_symspec_contract.f90 create mode 100644 tests/unit/map65/windows_fake/windows.h create mode 100644 tests/unit/network/test_livecq_upload.cpp create mode 100644 tests/unit/network/test_lotw_users.cpp create mode 100644 tests/unit/network/test_map65_livecq_decode.cpp create mode 100644 tests/unit/network/test_sample_downloader.cpp create mode 100644 tests/unit/packjt77/test_packjt77_context_state.f90 create mode 100644 tests/unit/q65/test_q65_caller_display.f90 create mode 100644 tests/unit/q65/test_q65_callers.f90 create mode 100644 tests/unit/qmap/test_qmap_candidates.f90 create mode 100644 tests/unit/qmap/test_qmap_q65_connection.f90 create mode 100644 tests/unit/qmap/test_qmap_q65_handoff.f90 create mode 100644 tests/unit/qmap/test_qmap_symspec_contract.f90 create mode 100644 tests/unit/streaming/test_streaming_period.f90 delete mode 100644 widgets/JttyDraftAcceptanceTracker.hpp create mode 100644 widgets/JttyLiveEntry.hpp create mode 100644 widgets/JttyMmttyHandoff.hpp create mode 100644 widgets/JttySpectrum.cpp create mode 100644 widgets/JttySpectrum.hpp create mode 100644 widgets/JttyTransmitQueue.hpp create mode 100644 widgets/JttyTxLifecycle.hpp create mode 100644 widgets/SuggestedFrequenciesDialog.cpp create mode 100644 widgets/SuggestedFrequenciesDialog.hpp create mode 100644 widgets/mainwindow_jtty_receive.cpp diff --git a/.github/actions/build-linux-payload/action.yml b/.github/actions/build-linux-payload/action.yml index f5ce1e0b..b4bc77f2 100644 --- a/.github/actions/build-linux-payload/action.yml +++ b/.github/actions/build-linux-payload/action.yml @@ -36,11 +36,11 @@ inputs: required: false default: "true" release_channel: - description: "Build release channel: DEVEL, RC, or GA" + description: "Build release channel: DEVEL, BETA, RC, GA, or empty for release-state.txt" required: false - default: "DEVEL" - rc_number: - description: "Release candidate number when release_channel is RC" + default: "" + prerelease_number: + description: "Prerelease number when release_channel is BETA or RC" required: false default: "" allow_stale_image: @@ -57,7 +57,7 @@ runs: WSJTX_VERSION: ${{ inputs.version }} HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} - WSJT_RC_NUMBER: ${{ inputs.rc_number }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} ARCH: ${{ inputs.arch }} VALIDATE_FORTRAN_FALLBACK: ${{ inputs.validate_fortran_fallback }} run: .github/scripts/validate-ci-inputs.sh @@ -160,7 +160,7 @@ runs: shell: bash env: WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} - WSJT_RC_NUMBER: ${{ inputs.rc_number }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} run: | cmake -S . -B wsjtx-build \ -DCMAKE_PREFIX_PATH="${{ steps.image.outputs.hamlib_prefix }};/opt/wsjtx/pfunit" \ @@ -171,7 +171,7 @@ runs: -DWSJT_ENABLE_GUI_SMOKE_TESTS=ON \ -DWSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY \ -DWSJT_RELEASE_CHANNEL="${WSJT_RELEASE_CHANNEL}" \ - -DWSJT_RC_NUMBER="${WSJT_RC_NUMBER}" \ + -DWSJT_PRERELEASE_NUMBER="${WSJT_PRERELEASE_NUMBER}" \ -DPFUNIT_DIR="${{ steps.image.outputs.pfunit_dir }}" \ -Wno-dev @@ -444,6 +444,47 @@ runs: wsjtx-build/wsprd wsjtx-build/wsjtx + # linuxdeploy.AppImage is the pinned copy the AppImage step downloaded + # and checked. + - name: Package release tarballs + if: inputs.build_packages == 'true' + shell: bash + env: + VERSION: ${{ inputs.version }} + ARCH: ${{ inputs.arch }} + run: | + .github/scripts/package-cli-tools.sh \ + --platform linux \ + --version "$VERSION" \ + --arch "$ARCH" \ + --groups CMake/release-tarballs.txt \ + --source wsjtx-build \ + --linuxdeploy ./linuxdeploy.AppImage \ + --out release-tarballs + + - name: Smoke-test release tarballs + if: inputs.build_packages == 'true' + shell: bash + env: + VERSION: ${{ inputs.version }} + ARCH: ${{ inputs.arch }} + run: | + .github/scripts/smoke-release-tarballs.sh \ + --platform linux \ + --version "$VERSION" \ + --target "linux-$ARCH" \ + --groups CMake/release-tarballs.txt \ + --dir release-tarballs \ + --ldd + + - name: Upload release tarballs + if: inputs.build_packages == 'true' + uses: ./.github/actions/upload-release-tarballs + with: + version: ${{ inputs.version }} + target: linux-${{ inputs.arch }} + directory: release-tarballs + - name: Report suppressed ccache save if: inputs.save_ccache == 'true' && steps.image.outputs.recipe_match != 'true' shell: bash diff --git a/.github/actions/build-linux-sanitizers/action.yml b/.github/actions/build-linux-sanitizers/action.yml index a9a6de6e..254c3a83 100644 --- a/.github/actions/build-linux-sanitizers/action.yml +++ b/.github/actions/build-linux-sanitizers/action.yml @@ -18,6 +18,10 @@ inputs: description: "Save compiled objects for trusted builds" required: false default: "false" + run_tests: + description: "Run sanitizer tests after compiling production and test targets" + required: false + default: "true" allow_stale_image: description: "Allow a previously promoted image when a dependency refresh changed the recipe" required: false @@ -121,6 +125,7 @@ runs: ccache-linux-x86_64-${{ steps.sanitizer.outputs.cache_key }}-${{ steps.image.outputs.ccache_compatibility_id }}- - name: Configure ccache + id: ccache-config shell: bash run: | export CCACHE_DIR="${GITHUB_WORKSPACE}/${{ steps.sanitizer.outputs.ccache_dir }}" @@ -187,15 +192,20 @@ runs: "${{ steps.sanitizer.outputs.build_dir }}/CMakeCache.txt" - name: Build sanitizer targets + id: compile shell: bash - run: cmake --build "${{ steps.sanitizer.outputs.build_dir }}" -j"$(nproc)" + run: | + SECONDS=0 + trap 'echo "duration_seconds=$SECONDS" >> "$GITHUB_OUTPUT"' EXIT + cmake --build "${{ steps.sanitizer.outputs.build_dir }}" -j"$(nproc)" - name: Show ccache stats - if: always() + if: always() && steps.ccache-config.outcome == 'success' shell: bash - run: ccache --show-stats + run: ccache --show-stats | tee "$RUNNER_TEMP/sanitizer-ccache-stats.txt" - name: Verify sanitizer instrumentation + id: instrumentation shell: bash run: >- python3 .github/scripts/verify-sanitizer-instrumentation.py @@ -214,11 +224,13 @@ runs: "${{ steps.sanitizer.outputs.build_dir }}/wsjtx" - name: Prepare test scratch directory + if: inputs.run_tests == 'true' shell: bash run: mkdir -p "${GITHUB_WORKSPACE}/${{ steps.sanitizer.outputs.build_dir }}/tmp" - name: Run tests id: ctest + if: inputs.run_tests == 'true' continue-on-error: true shell: bash working-directory: ${{ steps.sanitizer.outputs.build_dir }} @@ -233,7 +245,7 @@ runs: ctest --parallel 1 --output-on-failure --output-junit ctest-results.xml - name: Publish test summary - if: always() && steps.ctest.outcome != 'skipped' + if: always() && inputs.run_tests == 'true' && steps.ctest.outcome != 'skipped' shell: bash working-directory: ${{ steps.sanitizer.outputs.build_dir }} run: >- @@ -241,7 +253,7 @@ runs: "${{ steps.sanitizer.outputs.summary_name }}" >> "$GITHUB_STEP_SUMMARY" - name: Upload test results - if: always() && steps.ctest.outcome != 'skipped' + if: always() && inputs.run_tests == 'true' && steps.ctest.outcome != 'skipped' uses: actions/upload-artifact@v7 with: name: ${{ steps.sanitizer.outputs.artifact_name }} @@ -252,7 +264,7 @@ runs: if-no-files-found: ignore - name: Require sanitizer tests to pass - if: always() + if: always() && inputs.run_tests == 'true' shell: bash run: | failed=false @@ -264,14 +276,77 @@ runs: exit 1 fi - - name: Report suppressed sanitizer ccache save - if: inputs.save_ccache == 'true' && steps.image.outputs.recipe_match != 'true' - shell: bash - run: echo "::notice::Not saving sanitizer ccache because this build used a stale Linux CI image recipe" - - name: Save sanitizer objects - if: inputs.save_ccache == 'true' && steps.image.outputs.recipe_match == 'true' && steps.ccache.outputs.cache-hit != 'true' + id: save-ccache + if: inputs.save_ccache == 'true' && github.ref == 'refs/heads/develop' && steps.image.outputs.recipe_match == 'true' && steps.ccache.outputs.cache-hit != 'true' uses: actions/cache/save@v5 with: path: ${{ steps.sanitizer.outputs.ccache_dir }} key: ${{ steps.ccache.outputs.cache-primary-key }} + + - name: Summarize sanitizer cache + if: always() + shell: bash + env: + CACHE_STEPS: ${{ toJSON(steps) }} + SAVE_CCACHE: ${{ inputs.save_ccache }} + RUN_TESTS: ${{ inputs.run_tests }} + run: | + python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY" + import json + import os + from pathlib import Path + + steps = json.loads(os.environ["CACHE_STEPS"]) + cache = steps.get("ccache", {}) + outputs = cache.get("outputs", {}) + image = steps.get("image", {}).get("outputs", {}) + compile_step = steps.get("compile", {}) + save = steps.get("save-ccache", {}).get("outcome", "skipped") + exact = outputs.get("cache-hit") == "true" + matched = outputs.get("cache-matched-key", "") + restore = "exact hit" if exact else "fallback restore" if matched else "miss" + if cache.get("outcome") != "success": + restore = cache.get("outcome", "not run") + + if os.environ["SAVE_CCACHE"] != "true": + publication = "disabled" + elif os.environ["GITHUB_REF"] != "refs/heads/develop": + publication = "skipped: cache writes require develop" + elif image.get("recipe_match") == "false": + publication = "skipped: image recipe mismatch" + elif save != "skipped": + publication = f"attempted (step: {save}); see cache action log for upload confirmation" + elif any(step.get("outcome") in ("failure", "cancelled") for step in steps.values()): + publication = "skipped: preceding failure or cancellation" + elif exact: + publication = "skipped: exact cache already exists" + else: + publication = "not attempted" + + tests = steps.get("ctest", {}).get("outcome", "not run") + if os.environ["RUN_TESTS"] != "true": + tests = "disabled (build-only warmer)" + duration = compile_step.get("outputs", {}).get("duration_seconds", "unavailable") + print("### Sanitizer compiler cache\n") + rows = { + "Source SHA": os.environ["GITHUB_SHA"], + "Image generation": image.get("generation", "unavailable"), + "Requested/save key": outputs.get("cache-primary-key", "unavailable"), + "Matched key": matched or "none", + "Restore": restore, + "Compilation": compile_step.get("outcome", "not run"), + "Compilation duration (seconds)": duration, + "Instrumentation": steps.get("instrumentation", {}).get("outcome", "not run"), + "Tests": tests, + "Cache publication": publication, + } + print("| Item | Result |\n| --- | --- |") + for label, value in rows.items(): + print(f"| {label} | {value} |") + stats = Path(os.environ["RUNNER_TEMP"]) / "sanitizer-ccache-stats.txt" + if stats.is_file(): + print("\n```text\n" + stats.read_text().rstrip() + "\n```") + print("\nCompiler caching covers C/C++; Fortran compilation and linking still run.") + print("Build-only warming does not establish that sanitizer tests pass.") + PY diff --git a/.github/actions/build-windows-deps/action.yml b/.github/actions/build-windows-deps/action.yml index 9f1d2d07..0d1dc844 100644 --- a/.github/actions/build-windows-deps/action.yml +++ b/.github/actions/build-windows-deps/action.yml @@ -17,6 +17,10 @@ inputs: hamlib_branch: description: "Hamlib branch to build" required: true + cold_build: + description: "Bypass dependency cache restores and saves" + required: false + default: "false" save_caches: description: "Whether to save dependency caches on misses" required: false @@ -64,18 +68,20 @@ runs: - name: Restore Boost cache id: boost-cache + if: inputs.cold_build != 'true' uses: actions/cache/restore@v6 with: path: boost-prefix key: boost-windows-windows-latest-mingw64-${{ inputs.boost_version }}-${{ inputs.boost_source_sha256 }}-winapi${{ inputs.windows_api_floor }}-epoch1-${{ hashFiles('.github/scripts/build-boost-windows.sh') }} - name: Build Boost + id: boost-build if: steps.boost-cache.outputs.cache-hit != 'true' shell: msys2 {0} run: .github/scripts/build-boost-windows.sh "${{ inputs.boost_version }}" "${{ inputs.boost_source_sha256 }}" "${{ inputs.windows_api_floor }}" "${{ steps.paths.outputs.boost_prefix }}" - name: Save Boost cache - if: inputs.save_caches == 'true' && steps.boost-cache.outputs.cache-hit != 'true' + if: inputs.cold_build != 'true' && inputs.save_caches == 'true' && steps.boost-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v6 with: path: boost-prefix @@ -108,12 +114,14 @@ runs: - name: Restore pFUnit cache id: pfunit-cache + if: inputs.cold_build != 'true' uses: actions/cache/restore@v6 with: path: pfunit-prefix key: pfunit-windows-windows-latest-mingw64-v4.14.0-gfortran${{ steps.fc.outputs.version }}-epoch1-${{ hashFiles('.github/scripts/build-pfunit-windows.sh') }} - name: Build pFUnit + id: pfunit-build if: steps.pfunit-cache.outputs.cache-hit != 'true' shell: msys2 {0} run: .github/scripts/build-pfunit-windows.sh v4.14.0 "${{ steps.paths.outputs.pfunit_prefix }}" @@ -135,7 +143,7 @@ runs: done - name: Save pFUnit cache - if: inputs.save_caches == 'true' && steps.pfunit-cache.outputs.cache-hit != 'true' + if: inputs.cold_build != 'true' && inputs.save_caches == 'true' && steps.pfunit-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v6 with: path: pfunit-prefix @@ -143,12 +151,14 @@ runs: - name: Restore Hamlib cache id: hamlib-cache + if: inputs.cold_build != 'true' uses: actions/cache/restore@v6 with: path: hamlib-prefix key: hamlib-windows-windows-latest-mingw64-${{ inputs.hamlib_branch }}-epoch2-${{ hashFiles('.github/scripts/build-hamlib-windows.sh') }} - name: Build Hamlib + id: hamlib-build if: steps.hamlib-cache.outputs.cache-hit != 'true' shell: msys2 {0} env: @@ -167,8 +177,16 @@ runs: test -f "${{ steps.paths.outputs.hamlib_prefix }}/lib/libhamlib.dll.a" - name: Save Hamlib cache - if: inputs.save_caches == 'true' && steps.hamlib-cache.outputs.cache-hit != 'true' + if: inputs.cold_build != 'true' && inputs.save_caches == 'true' && steps.hamlib-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v6 with: path: hamlib-prefix key: ${{ steps.hamlib-cache.outputs.cache-primary-key }} + + - name: Summarize dependency caches + if: always() + shell: bash + env: + CACHE_STEPS: ${{ toJSON(steps) }} + COLD_BUILD: ${{ inputs.cold_build }} + run: python .github/scripts/summarize-native-caches.py boost hamlib pfunit >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/actions/upload-release-tarballs/action.yml b/.github/actions/upload-release-tarballs/action.yml new file mode 100644 index 00000000..daec4523 --- /dev/null +++ b/.github/actions/upload-release-tarballs/action.yml @@ -0,0 +1,51 @@ +name: "Upload release tarballs" +description: >- + Upload one target's release tarballs, one artifact each under the names + .github/scripts/release-policy.py requires. There is one step per line of + CMake/release-tarballs.txt. + +inputs: + version: + description: "WSJT-X version string" + required: true + target: + description: "Release target, for example linux-x86_64 or arm64-macOS" + required: true + directory: + description: "Directory that holds the target's release tarballs" + required: true + +runs: + using: "composite" + steps: + - name: Upload jt9 tarball + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-${{ inputs.target }}-jt9 + path: ${{ inputs.directory }}/wsjtx-${{ inputs.version }}-${{ inputs.target }}-jt9.tar.gz + if-no-files-found: error + compression-level: 0 + + - name: Upload jt9stream tarball + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-${{ inputs.target }}-jt9stream + path: ${{ inputs.directory }}/wsjtx-${{ inputs.version }}-${{ inputs.target }}-jt9stream.tar.gz + if-no-files-found: error + compression-level: 0 + + - name: Upload wsprd tarball + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-${{ inputs.target }}-wsprd + path: ${{ inputs.directory }}/wsjtx-${{ inputs.version }}-${{ inputs.target }}-wsprd.tar.gz + if-no-files-found: error + compression-level: 0 + + - name: Upload utilities tarball + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-${{ inputs.target }}-utilities + path: ${{ inputs.directory }}/wsjtx-${{ inputs.version }}-${{ inputs.target }}-utilities.tar.gz + if-no-files-found: error + compression-level: 0 diff --git a/.github/actions/warm-macos-deps/action.yml b/.github/actions/warm-macos-deps/action.yml index 74ef9423..2c68bc1f 100644 --- a/.github/actions/warm-macos-deps/action.yml +++ b/.github/actions/warm-macos-deps/action.yml @@ -66,6 +66,7 @@ runs: key: ${{ steps.qt-key.outputs.key }} - name: Build Qt + id: qt-build if: steps.qt-cache.outputs.cache-hit != 'true' shell: bash run: | @@ -154,6 +155,7 @@ runs: key: libusb-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.0.27-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-libusb-macos.sh') }} - name: Build libusb + id: libusb-build if: steps.libusb-cache.outputs.cache-hit != 'true' shell: bash run: | @@ -177,6 +179,7 @@ runs: key: portaudio-macos-${{ inputs.arch }}-${{ inputs.runner }}-19.7.0-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-portaudio-macos.sh') }} - name: Build PortAudio + id: portaudio-build if: steps.portaudio-cache.outputs.cache-hit != 'true' shell: bash run: | @@ -200,6 +203,7 @@ runs: key: fftw-macos-${{ inputs.arch }}-${{ inputs.runner }}-3.3.10-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-fftw-macos.sh') }} - name: Build FFTW + id: fftw-build if: steps.fftw-cache.outputs.cache-hit != 'true' shell: bash run: | @@ -223,6 +227,7 @@ runs: key: boost-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.85.0-7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-boost-macos.sh') }} - name: Build Boost + id: boost-build if: steps.boost-cache.outputs.cache-hit != 'true' shell: bash run: | @@ -263,6 +268,7 @@ runs: key: hamlib-macos-${{ inputs.arch }}-${{ inputs.runner }}-${{ inputs.hamlib_branch }}-libusb1.0.27-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-hamlib-macos.sh', '.github/scripts/build-libusb-macos.sh') }} - name: Build Hamlib + id: hamlib-build if: steps.hamlib-cache.outputs.cache-hit != 'true' shell: bash env: @@ -300,6 +306,7 @@ runs: key: pfunit-macos-${{ inputs.arch }}-${{ inputs.runner }}-v4.14.0-${{ steps.fc.outputs.cache_key }}-min${{ inputs.deployment_target }}-epoch3-${{ hashFiles('.github/scripts/build-pfunit-macos.sh') }} - name: Build pFUnit + id: pfunit-build if: steps.pfunit-cache.outputs.cache-hit != 'true' shell: bash env: @@ -328,3 +335,11 @@ runs: with: path: pfunit-prefix key: ${{ steps.pfunit-cache.outputs.cache-primary-key }} + + - name: Summarize dependency caches + if: always() + shell: bash + env: + CACHE_STEPS: ${{ toJSON(steps) }} + COLD_BUILD: "false" + run: python3 .github/scripts/summarize-native-caches.py qt libusb portaudio fftw boost hamlib pfunit >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/images/linux-ci/Dockerfile.armhf-cross b/.github/images/linux-ci/Dockerfile.armhf-cross index f37d1928..09134413 100644 --- a/.github/images/linux-ci/Dockerfile.armhf-cross +++ b/.github/images/linux-ci/Dockerfile.armhf-cross @@ -1,31 +1,27 @@ -FROM debian:bookworm - -ARG IMAGE_REFRESH_EPOCH +FROM debian:bookworm@sha256:704583dbf243593da87cf949fc0543ffeca24a28d36c2760dc9545410cb8ed02 AS toolchain SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV DEBIAN_FRONTEND=noninteractive COPY .github/scripts/run-apt-get.sh /usr/local/bin/run-apt-get -RUN chmod +x /usr/local/bin/run-apt-get \ - && test -n "$IMAGE_REFRESH_EPOCH" \ - && run-apt-get update \ - && run-apt-get install -y --no-install-recommends \ - asciidoctor autoconf automake binutils bison build-essential \ - ca-certificates ccache cmake curl dpkg-dev file flex gawk git gperf \ - help2man libncurses-dev libtool libtool-bin mmdebstrap patch pkg-config \ - python3 python3-dev qt5-qmake-bin qtbase5-dev-tools qttools5-dev-tools \ - qemu-user-static rsync texinfo unzip wget xz-utils \ - && run-apt-get clean \ - && rm -rf /var/lib/apt/lists/* +COPY .github/scripts/armhf-toolchain-config.sh /usr/local/share/wsjtx-ci/ +RUN set -eux; \ + . /usr/local/share/wsjtx-ci/armhf-toolchain-config.sh; \ + test -n "$ARMHF_TOOLCHAIN_REBUILD_REVISION"; \ + chmod +x /usr/local/bin/run-apt-get; \ + run-apt-get update; \ + run-apt-get install -y --no-install-recommends \ + autoconf automake bison build-essential ca-certificates curl file flex \ + gawk gperf help2man libncurses-dev libtool libtool-bin patch pkg-config python3 \ + rsync texinfo unzip wget xz-utils; \ + run-apt-get clean; \ + rm -rf /var/lib/apt/lists/* -COPY .github/scripts/linux-ci-image-config.sh \ - .github/scripts/armhf-ci-image-config.sh \ - /usr/local/share/wsjtx-ci/ COPY .github/images/linux-ci/armhf-cross-toolchain.config \ /usr/local/share/wsjtx-ci/armhf-cross-toolchain.config RUN set -eux; \ - . /usr/local/share/wsjtx-ci/armhf-ci-image-config.sh; \ + . /usr/local/share/wsjtx-ci/armhf-toolchain-config.sh; \ curl --fail --show-error --silent --location --retry 5 \ -o /tmp/crosstool-ng.tar.xz "$ARMHF_CROSSTOOL_NG_URL"; \ echo "$ARMHF_CROSSTOOL_NG_SHA256 /tmp/crosstool-ng.tar.xz" | sha256sum -c -; \ @@ -38,15 +34,15 @@ RUN set -eux; \ cd /; \ rm -rf /tmp/crosstool-ng /tmp/crosstool-ng.tar.xz; \ useradd --create-home --shell /bin/bash wsjtx; \ - mkdir -p /tmp/wsjtx-ctng-build /var/cache/wsjtx-ctng /opt/wsjtx; \ - chown -R wsjtx:wsjtx /tmp/wsjtx-ctng-build /var/cache/wsjtx-ctng /opt/wsjtx + mkdir -p /var/cache/wsjtx-ctng /opt/wsjtx; \ + chown -R wsjtx:wsjtx /var/cache/wsjtx-ctng /opt/wsjtx -ARG IMAGE_RECIPE_SHA256 USER wsjtx RUN --mount=type=cache,id=wsjtx-armhf-ctng-downloads,target=/var/cache/wsjtx-ctng,uid=1000,gid=1000 \ - --mount=type=cache,id=wsjtx-armhf-ctng-build-${IMAGE_RECIPE_SHA256},target=/tmp/wsjtx-ctng-build,uid=1000,gid=1000 \ set -eux; \ - cd /tmp/wsjtx-ctng-build; \ + build_dir=/tmp/wsjtx-ctng-build; \ + mkdir "$build_dir"; \ + cd "$build_dir"; \ cp /usr/local/share/wsjtx-ci/armhf-cross-toolchain.config .config; \ ct-ng olddefconfig; \ # crosstool-NG prints only a summary on failure; expose the detailed compiler \ @@ -54,9 +50,36 @@ RUN --mount=type=cache,id=wsjtx-armhf-ctng-downloads,target=/var/cache/wsjtx-ctn if ! ct-ng build; then \ tail -n 300 build.log >&2; \ exit 1; \ - fi + fi; \ + cd /; \ + rm -rf "$build_dir" + +FROM debian:bookworm AS cross_builder + +ARG IMAGE_REFRESH_EPOCH + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ENV DEBIAN_FRONTEND=noninteractive + +COPY .github/scripts/run-apt-get.sh /usr/local/bin/run-apt-get +RUN chmod +x /usr/local/bin/run-apt-get \ + && test -n "$IMAGE_REFRESH_EPOCH" \ + && run-apt-get update \ + && run-apt-get install -y --no-install-recommends \ + asciidoctor autoconf automake binutils bison build-essential \ + ca-certificates ccache cmake curl dpkg-dev file flex gawk git gperf \ + help2man libncurses-dev libtool libtool-bin mmdebstrap patch pkg-config \ + python3 python3-dev qt5-qmake-bin qtbase5-dev-tools qttools5-dev-tools \ + qemu-user-static rsync texinfo unzip wget xz-utils \ + && run-apt-get clean \ + && rm -rf /var/lib/apt/lists/* -USER root +COPY --from=toolchain /opt/wsjtx/armhf-toolchain /opt/wsjtx/armhf-toolchain + +COPY .github/scripts/linux-ci-image-config.sh \ + .github/scripts/armhf-toolchain-config.sh \ + .github/scripts/armhf-ci-image-config.sh \ + /usr/local/share/wsjtx-ci/ COPY .github/scripts/linux-ccache-compiler-signature.sh \ .github/scripts/build-hamlib-armhf-cross.sh \ .github/scripts/build-armhf-toolchain-smoke.sh \ @@ -99,11 +122,12 @@ RUN set -eux; \ test "$("$ARMHF_TOOLCHAIN_PREFIX/bin/$ARMHF_TARGET_TRIPLET-gcc" -print-file-name=libquadmath.so.0)" = libquadmath.so.0; \ /usr/local/share/wsjtx-ci/build-armhf-toolchain-smoke.sh \ "$ARMHF_TOOLCHAIN_PREFIX" "$ARMHF_SYSROOT" /opt/wsjtx-ci/toolchain-smoke; \ - rm -rf /tmp/wsjtx-hamlib-build /home/wsjtx + rm -rf /tmp/wsjtx-hamlib-build ARG IMAGE_CREATED ARG IMAGE_GENERATION=local ARG IMAGE_REVISION +ARG IMAGE_RECIPE_SHA256 LABEL org.opencontainers.image.created="${IMAGE_CREATED}" \ org.opencontainers.image.revision="${IMAGE_REVISION}" \ org.opencontainers.image.source="https://github.com/WSJTX/wsjtx-internal" \ diff --git a/.github/images/linux-ci/Dockerfile.armhf-runtime b/.github/images/linux-ci/Dockerfile.armhf-runtime index 85404f0f..d0581a31 100644 --- a/.github/images/linux-ci/Dockerfile.armhf-runtime +++ b/.github/images/linux-ci/Dockerfile.armhf-runtime @@ -16,6 +16,7 @@ RUN chmod +x /usr/local/bin/run-apt-get /usr/local/bin/install-armhf-runtime-pac && /usr/local/bin/install-armhf-runtime-packages COPY .github/scripts/linux-ci-image-config.sh \ + .github/scripts/armhf-toolchain-config.sh \ .github/scripts/armhf-ci-image-config.sh \ .github/scripts/write-armhf-ci-manifest.sh \ .github/scripts/verify-armhf-ci-image.sh \ diff --git a/.github/images/linux-ci/README.md b/.github/images/linux-ci/README.md index 5c3cd01a..29a94eee 100644 --- a/.github/images/linux-ci/README.md +++ b/.github/images/linux-ci/README.md @@ -40,9 +40,11 @@ and `linux-noble:stable` moves last within that cohort. Consumers resolve that pointer to its immutable `build-*` tag and use the same generation for every normal Linux leg. -The armhf image pair is published explicitly with `include_armhf: true`. It is -excluded from routine weekly/monthly refreshes because toolchain construction -is expensive. The pair is built, promoted, and rolled back as one generation. +The ARMHF image pair is included when the cache-refresh workflow refreshes the +normal Linux image cohort. The pair is built, promoted, and rolled back as one +generation. Its toolchain stage is reused unless a toolchain input or the explicit +rebuild revision changes. + Opt-in full-ci, release, and standalone armhf builds resolve the last promoted runtime generation once and require the matching cross-builder tag; a missing member fails explicitly. Manual full-ci can instead name an immutable candidate @@ -74,6 +76,39 @@ retagging a retained `validated-build-*` generation as `stable` for rollback. Promotion and rollback are restricted to `develop`; non-promoting candidate builds may be run from another ref. +## ARMHF toolchain reuse + +The cross-builder has an independent toolchain stage pinned to a Debian Bookworm +amd64 base digest, which monthly refreshes do not update. Its inputs are the +bootstrap package recipe, apt helper, `armhf-toolchain-config.sh`, and +`armhf-cross-toolchain.config`. The final image +uses the maintained Bookworm base and refreshes host packages, the ARMHF sysroot, +and Hamlib independently. Monthly refresh epochs and full image fingerprints do +not invalidate the toolchain stage. + +The ARMHF cross-builder exports intermediate layers to the `buildcache` tag in +its own GHCR package with registry `mode=max` caching. Internal and public-release +publication use their respective package namespaces for both imports and exports. +A fresh builder can therefore reuse the completed toolchain stage. Only source +archives use a local BuildKit cache mount; each actual toolchain build starts with +a clean build directory and retains its detailed failure log in the job output. + +For an intentional toolchain refresh, update the pinned base digest when needed +and increment `ARMHF_TOOLCHAIN_REBUILD_REVISION` in `armhf-toolchain-config.sh`. +The revision invalidates the bootstrap package installation as well as compiler +construction. Compiler, ABI, crosstool-NG, and ct-ng configuration changes also +invalidate the relevant toolchain layers. Publish with `include_armhf: true` and +validate the resulting image pair before promoting it. Final image manifests +and compiler signatures are regenerated against the final host runtime libraries; +reusing compiler files does not bypass compatibility checks. + +To validate reuse, export a baseline cache and import it into a fresh Buildx +builder after changing only the refresh epoch or a downstream dependency input. +The ct-ng build must be cached while the dependency work reruns. A changed ct-ng +configuration or rebuild revision must execute the toolchain build again. Keep +these validation publications separate from stable promotion and retain their +build logs, image verification results, and timings. + ## ccache compatibility The image recipe and ccache compatibility identities intentionally answer @@ -91,10 +126,22 @@ normal per-object invalidation. Changes to unrelated image packages do not discard otherwise compatible objects. A new generation first restores its own snapshot and then falls back to any -compatible older generation. The candidate build recompiles only genuine -misses and saves an augmented generation-specific snapshot before promotion. -Recipe-stale fallback builds may restore caches but are not allowed to save -them. +compatible older generation. The build recompiles only genuine misses and +saves an augmented generation-specific snapshot. Recipe-stale fallback builds +may restore caches but are not allowed to save them. + +ARMHF warming compiles production and test targets and runs the binary audits, +then saves objects without preparing an AppDir or executing runtime tests and +packaging. Image-pair verification, including its brief QEMU checks, remains +required. The `armhf_build_only` workflow input defaults to false, preserving +full ARMHF CI; build-only cache writes require `develop`. + +The cache-refresh workflow selects ARMHF weekly, for relevant build/configuration +changes on `develop`, and through its `linux-armhf` manual target. Source-only +pushes do not select it. Successful internal ARMHF image promotion warms the +exact new generation afterward; a warmer failure does not undo promotion. +Standalone and post-promotion warmers share a concurrency group, and an image +refresh suppresses duplicate standalone warming. ## Retention @@ -102,7 +149,8 @@ The weekly retention job keeps `stable`, preserves unrecognized and untagged versions, retains at least the newest three recognized package versions, and deletes only recognized build, validated-build, and candidate versions older than 60 days. Manual retention runs are dry-run only; scheduled runs apply the -printed plan. +printed plan. The ARMHF `buildcache` tag is protected as an unrecognized tag; +older cache manifests left untagged when it moves are also preserved. The Buildx jobs deliberately disable provenance and SBOM attachment. Even a single-platform attestation is represented through an image index with diff --git a/.github/images/linux-ci/install-armhf-runtime-packages.sh b/.github/images/linux-ci/install-armhf-runtime-packages.sh index a7a18e2e..d715d85a 100755 --- a/.github/images/linux-ci/install-armhf-runtime-packages.sh +++ b/.github/images/linux-ci/install-armhf-runtime-packages.sh @@ -9,6 +9,7 @@ packages=( libboost-atomic1.74.0 libboost-chrono1.74.0 libboost-filesystem1.74.0 libboost-log1.74.0 libboost-regex1.74.0 libboost-thread1.74.0 libqt5widgets5 libqt5network5 libqt5multimedia5 libqt5printsupport5 libqt5test5 + libqt5concurrent5 libqt5multimedia5-plugins libqt5serialport5 libqt5sql5-sqlite libqt5websockets5 qt5-qmake-bin qtbase5-dev-tools libusb-1.0-0 libudev1 libportaudio2 diff --git a/.github/scripts/armhf-ci-image-config.sh b/.github/scripts/armhf-ci-image-config.sh index 6e97c2f0..85b95523 100755 --- a/.github/scripts/armhf-ci-image-config.sh +++ b/.github/scripts/armhf-ci-image-config.sh @@ -6,23 +6,14 @@ _armhf_config_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" # shellcheck source=.github/scripts/linux-ci-image-config.sh . "$_armhf_config_dir/linux-ci-image-config.sh" +# shellcheck source=.github/scripts/armhf-toolchain-config.sh +. "$_armhf_config_dir/armhf-toolchain-config.sh" unset _armhf_config_dir ARMHF_CI_IMAGE_SCHEMA=1 -ARMHF_CROSSTOOL_NG_VERSION=1.28.0 -ARMHF_CROSSTOOL_NG_SHA256=5750e29a2bda5cd8d67900592576b1670a1987a4dcd5e4f6beae09138a1f5699 -ARMHF_CROSSTOOL_NG_URL="https://github.com/crosstool-ng/crosstool-ng/releases/download/crosstool-ng-${ARMHF_CROSSTOOL_NG_VERSION}/crosstool-ng-${ARMHF_CROSSTOOL_NG_VERSION}.tar.xz" - -ARMHF_TARGET_TRIPLET=arm-linux-gnueabihf -ARMHF_TOOLCHAIN_PREFIX=/opt/wsjtx/armhf-toolchain ARMHF_SYSROOT=/opt/wsjtx/armhf-sysroot ARMHF_RUNTIME_PREFIX=/opt/wsjtx/armhf-runtime ARMHF_QEMU_EXECUTABLE=/usr/local/bin/qemu-arm-static -ARMHF_GCC_VERSION=13.4.0 -ARMHF_GLIBC_VERSION=2.36 -ARMHF_BINUTILS_VERSION=2.40 -ARMHF_LINUX_HEADERS_VERSION=6.1.147 -ARMHF_MIN_KERNEL_VERSION=3.2.0 ARMHF_SYSROOT_PACKAGES=( libc6-dev libstdc++6 libgfortran5 libgomp1 libatomic1 diff --git a/.github/scripts/armhf-static-ldd.sh b/.github/scripts/armhf-static-ldd.sh index bb85e6f3..50cecc61 100755 --- a/.github/scripts/armhf-static-ldd.sh +++ b/.github/scripts/armhf-static-ldd.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash set -euo pipefail -# linuxdeploy's ldd probe crashes when an ARM loader is nested under user-mode -# QEMU. Resolve DT_NEEDED entries from the clean ARMHF runtime without executing -# the target; packaged runtime behavior is still proved by the QEMU smoke test. +# Resolve DT_NEEDED entries from the clean ARMHF runtime without executing the +# target, so linuxdeploy sees the runtime prefix first and a libquadmath +# dependency fails; the AppImage startup smoke test proves runtime behavior. if [ "$#" -ne 1 ]; then echo "Usage: armhf-static-ldd.sh ELF" >&2 diff --git a/.github/scripts/armhf-toolchain-config.sh b/.github/scripts/armhf-toolchain-config.sh new file mode 100755 index 00000000..bcd44613 --- /dev/null +++ b/.github/scripts/armhf-toolchain-config.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Pinned inputs for the native ARMHF cross-toolchain. +# shellcheck disable=SC2034 + +ARMHF_TOOLCHAIN_REBUILD_REVISION=1 +ARMHF_CROSSTOOL_NG_VERSION=1.28.0 +ARMHF_CROSSTOOL_NG_SHA256=5750e29a2bda5cd8d67900592576b1670a1987a4dcd5e4f6beae09138a1f5699 +ARMHF_CROSSTOOL_NG_URL="https://github.com/crosstool-ng/crosstool-ng/releases/download/crosstool-ng-${ARMHF_CROSSTOOL_NG_VERSION}/crosstool-ng-${ARMHF_CROSSTOOL_NG_VERSION}.tar.xz" + +ARMHF_TARGET_TRIPLET=arm-linux-gnueabihf +ARMHF_TOOLCHAIN_PREFIX=/opt/wsjtx/armhf-toolchain +ARMHF_GCC_VERSION=13.4.0 +ARMHF_GLIBC_VERSION=2.36 +ARMHF_BINUTILS_VERSION=2.40 +ARMHF_LINUX_HEADERS_VERSION=6.1.147 +ARMHF_MIN_KERNEL_VERSION=3.2.0 diff --git a/.github/scripts/audit-staged-dll-imports-windows.sh b/.github/scripts/audit-staged-dll-imports-windows.sh index ca8b75f2..464faf7e 100644 --- a/.github/scripts/audit-staged-dll-imports-windows.sh +++ b/.github/scripts/audit-staged-dll-imports-windows.sh @@ -38,8 +38,14 @@ for exe in "$@"; do fi echo "::group::DLL imports for $exe" + if ! import_metadata=$(objdump -p "$exe"); then + echo "::error::Could not inspect DLL imports for $exe" + echo "::endgroup::" + fail=1 + continue + fi imports=$( - objdump -p "$exe" | + printf '%s\n' "$import_metadata" | awk '/DLL Name:/ {print $3}' | sort -u ) @@ -50,8 +56,16 @@ for exe in "$@"; do echo "(none)" fi + if [ "$(basename "$exe" | tr '[:upper:]' '[:lower:]')" = jt9.exe ]; then + qt_imports=$(printf '%s\n' "$imports" | awk 'tolower($0) ~ /^qt.*\.dll$/') + if [ -n "$qt_imports" ]; then + echo "::error::$exe must not depend on Qt: $qt_imports" + fail=1 + fi + fi + win7_blocked_imports=$( - objdump -p "$exe" | + printf '%s\n' "$import_metadata" | awk ' /DLL Name:/ { dll=tolower($3) } /api-ms-win-core-synch-l1-2-0\.dll/ { print "api-ms-win-core-synch-l1-2-0.dll" } diff --git a/.github/scripts/beta-scheduler.py b/.github/scripts/beta-scheduler.py new file mode 100644 index 00000000..925703ee --- /dev/null +++ b/.github/scripts/beta-scheduler.py @@ -0,0 +1,798 @@ +#!/usr/bin/env python3 +"""Advance the scheduled beta line by one state-machine step per workflow run.""" + +from __future__ import annotations + +import argparse +import base64 +import importlib.util +import io +import json +import os +from pathlib import Path +import re +import shutil +import subprocess +import sys +import tempfile +import textwrap +import traceback +from typing import Callable, NamedTuple +import urllib.error +import urllib.parse +import urllib.request +import zipfile + + +def load_script(name: str, filename: str): + spec = importlib.util.spec_from_file_location(name, Path(__file__).with_name(filename)) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +policy = load_script("release_policy", "release-policy.py") +images = load_script("release_linux_images", "release-linux-images.py") +image_tags = load_script("resolve_linux_ci_image_tag", "resolve-linux-ci-image-tag.py") + +PUBLIC_REPOSITORY = "WSJTX/wsjtx" +ALERT_TITLE = "Scheduled beta alerts" +ALERT_CREATOR = "github-actions[bot]" +STATE_FILE = "release-state.txt" +LOCK_FILE = "release-linux-images.json" +METADATA_FILES = frozenset((STATE_FILE, LOCK_FILE)) +PREPARED_ARTIFACT = "prepared-release-dependencies" +IMAGE_PACKAGES = ( + image_tags.NORMAL_PACKAGE, + image_tags.ARM64_PACKAGE, + image_tags.ARMHF_CROSS_PACKAGE, + image_tags.ARMHF_PACKAGE, +) +CI = "ci.yml" +CANDIDATE = "release-tag-helper.yml" +PROMOTION = "promote-release.yml" +PREPARATION = "prepare-release-dependencies.yml" +WARMER = "warm-dependency-caches.yml" +PUBLISHER = "publish-linux-ci-images.yml" +PUBLICATION = "public-release.yml" +BETA_CUT = "beta-cut.yml" +IMAGE_REFRESH_JOB = "refresh-linux-images" +NORMAL_IMAGES_JOB = "build-normal" +CANDIDATE_TITLE = re.compile(r"Prepare Release Candidate build/v(?P\S+) \((?Pvalidate|create)\)") +PREPARATION_TITLE = re.compile(r"Prepare Release Dependencies (?P\S+) (?P\S+)") +GENERATION_TAG = re.compile(r"validated-build-\d{8}-(?P\d+)-(?P\d+)") + + +class Skip(Exception): + """Nothing to do now; a later run tries again. Reported in the job summary only.""" + + +class Stop(Exception): + """A person must act. Reported in the job summary and on the tracking issue.""" + + def __init__(self, stage: str, reason: str, link: str | None = None) -> None: + super().__init__(reason) + self.stage = stage + self.link = link + + +class Spent(Exception): + """The candidate failed after its build tag was pushed; build tags never move, so the number is used up.""" + + def __init__(self, reason: str, link: str | None = None) -> None: + super().__init__(reason) + self.link = link + + +class Line(NamedTuple): + branch: str + tip: str + version: str + number: int + + def prerelease(self, number: int | None = None) -> str: + return f"{self.version}-beta{self.number if number is None else number}" + + +class Commit(NamedTuple): + sha: str + author_email: str + files: tuple[str, ...] + + +def candidate_tag(version: str) -> str: + return f"build/v{version}" + + +def in_flight(run: dict) -> bool: + return run.get("status") != "completed" + + +def run_order(run: dict) -> tuple[str, int]: + return run.get("created_at") or "", run.get("id") or 0 + + +def newest(runs: list[dict]) -> dict | None: + return max(runs, key=run_order, default=None) + + +def candidate_of(run: dict) -> tuple[str, str] | None: + match = CANDIDATE_TITLE.fullmatch(run.get("display_title") or "") + return (match["version"], match["operation"]) if match else None + + +def preparation_of(run: dict) -> tuple[str, str] | None: + match = PREPARATION_TITLE.fullmatch(run.get("display_title") or "") + return (match["source"], match["generation"]) if match else None + + +def render_state(version: str, number: int) -> str: + return f"version={version}\nchannel=BETA\nprerelease={number}\nrevision=$Format:%H$\nwindows_signing=unsigned\n" + + +def git_identity(name: str, email: str) -> dict[str, str]: + return {"GIT_AUTHOR_NAME": name, "GIT_AUTHOR_EMAIL": email, + "GIT_COMMITTER_NAME": name, "GIT_COMMITTER_EMAIL": email} + + +def lock_recipes(lock: bytes | None) -> dict[str, str] | None: + try: + selected = json.loads(lock)["images"] + return {key: selected[key]["recipe_sha256"] for key in images.IMAGES} + except (TypeError, ValueError, KeyError): + return None + + +def lock_generation(lock: bytes) -> str | None: + try: + return json.loads(lock).get("generation") + except (ValueError, AttributeError): + return None + + +class Scheduler: + def __init__(self, repository, internal, public=None, packages=None, *, bot_login: str, + bot_email: str | None = None, notes: list[str] | None = None) -> None: + self.repository = repository + self.internal = internal + self.public = public + self.packages = packages + self.bot_login = bot_login + self.bot_email = bot_email + self.notes = [] if notes is None else notes + self.recipe_cache: dict[str, dict[str, str] | None] = {} + + def beta_line(self) -> Line: + lines = [] + for branch, tip in sorted(self.repository.release_heads().items()): + if not policy.RELEASE_BRANCH_RE.fullmatch(branch): + continue + raw = self.repository.read(tip, STATE_FILE) + try: + state = policy.parse_state(raw.decode("utf-8")) + except (AttributeError, UnicodeDecodeError, ValueError) as error: + if raw is not None and b"channel=BETA" in raw.splitlines(): + raise Stop("line", f"{branch}'s {STATE_FILE} says channel=BETA but does not validate: " + f"{error}") from error + continue + if state["channel"] != "BETA": + continue + if policy.classify(state["version"])["release_branch"] != branch: + raise Stop("line", f"{branch} is in BETA state for version {state['version']}, " + "which belongs to another release line.") + lines.append(Line(branch, tip, state["version"], int(state["prerelease"]))) + if not lines: + raise Skip("No release/X.Y branch is in BETA state, as between a freeze and the next line's start; " + "nothing to do.") + if len(lines) > 1: + found = ", ".join(line.branch for line in lines) + raise Stop("line", f"Exactly one release/X.Y branch may be in BETA state; found {found}.") + line = lines[0] + self.notes.append(f"Beta line: {line.branch} at {line.tip}, state BETA {line.number}.") + return line + + def cut(self) -> str: + self.repository.sync() + line = self.beta_line() + tag_sha = self.repository.tag(candidate_tag(line.prerelease())) + if tag_sha is None: + return self.retry(line) + public_tag = f"v{line.prerelease()}" + if self.public.release_published(public_tag): + self.notes.append(f"`{public_tag}` is published, so the next cut is BETA {line.number + 1}.") + return self.advance(line) + outcome = self.unpublished(line, tag_sha) + if not isinstance(outcome, Spent): + raise outcome + self.notes.append(str(outcome)) + return self.advance(line, spent=outcome) + + def retry(self, line: Line) -> str: + version = line.prerelease() + self.notes.append(f"`{candidate_tag(version)}` does not exist, so {version} is retried under the same number.") + self.check_fixes_on_develop(line) + runs = self.internal.runs(CI, head_sha=line.tip) + if any(in_flight(run) for run in runs): + raise self.wait("ci", runs, f"CI for {line.branch} at {line.tip} is still running; {version} waits for it.") + ci = newest(runs) + if ci is None: + raise Stop("ci", f"{line.branch} at {line.tip} has no CI run, so {version} cannot be cut.") + if ci.get("conclusion") != "success": + return self.recut(line, ci) + candidates = self.candidate_runs(line) + if any(in_flight(run) for run in candidates): + raise self.wait("candidate", candidates, f"A candidate run for {version} is still running.") + return self.dispatch_candidate(line) + + def wait(self, stage: str, runs: list[dict], reason: str) -> Exception: + running = [run for run in runs if in_flight(run)] + # The continuation follows only runs the App started, and the weekly cut would otherwise wait a week. + if any((run.get("actor") or {}).get("login") == self.bot_login for run in running): + return Skip(reason) + return Stop(stage, f"{reason} Nothing resumes the cut when that run finishes, so dispatch Scheduled Beta Cut " + "after it does.", running[0].get("html_url")) + + def recut(self, line: Line, ci: dict) -> str: + version = line.prerelease() + failed = f"CI for {line.branch} at {line.tip} concluded {ci.get('conclusion')}" + target = self.newest_green_develop() + if target is None or self.repository.is_ancestor(target, line.tip): + raise Stop("ci", f"{failed}, and develop has no newer green commit to cut {version} from. Re-run the CI " + "if the failure is transient.", ci.get("html_url")) + self.notes.append(f"{failed}, so {version} is cut again from develop {target}.") + lock, lock_note = self.lock_for(line, target) + commit = self.commit_cut(line, line.number, target, lock, lock_note) + return f"Pushed {commit} to {line.branch}: develop {target} as {version} again." + + def candidate_runs(self, line: Line) -> list[dict]: + return [run for run in self.internal.runs(CANDIDATE, branch=line.branch, event="workflow_dispatch") + if candidate_of(run) == (line.prerelease(), "create")] + + def dispatch_candidate(self, line: Line) -> str: + version = line.prerelease() + self.internal.dispatch(CANDIDATE, line.branch, + {"version": version, "expected_sha": line.tip, "operation": "create"}) + return f"Dispatched Prepare Release Candidate for `{candidate_tag(version)}` at {line.tip}." + + def unpublished(self, line: Line, tag_sha: str) -> Exception: + version = line.prerelease() + public_tag = f"v{version}" + stages = { + "CI": self.internal.runs(CI, head_sha=tag_sha), + "candidate": [run for run in self.candidate_runs(line) if run.get("head_sha") == tag_sha], + "promotion": self.internal.runs(PROMOTION, branch=line.branch, event="workflow_dispatch", head_sha=tag_sha), + "public release": self.public.runs(PUBLICATION, branch=public_tag, event="push"), + } + for stage, runs in stages.items(): + if any(in_flight(run) for run in runs): + reason = f"`{public_tag}` is not published yet; its {stage} run is still in progress." + # The public release completes on its own; nothing is due from the cut until it has. + return Skip(reason) if stage == "public release" else self.wait(stage.lower(), runs, reason) + failed = newest(stages["candidate"]) + if failed is None: + return Stop("candidate", f"`{candidate_tag(version)}` exists, but no candidate run for it was found.") + candidate = newest([run for run in stages["candidate"] if run.get("conclusion") == "success"]) + # A run reports only its latest attempt, so a later failed re-run can hide a promoted candidate. + promoted = newest([run for run in stages["promotion"] if run.get("conclusion") == "success"]) + if candidate is None and promoted is None: + return Spent(f"The candidate run for `{candidate_tag(version)}` concluded {failed.get('conclusion')} after " + f"the tag was pushed. Build tags never move, so {version} is spent and the next cut is " + f"BETA {line.number + 1}.", failed.get("html_url")) + promotion = promoted or newest(stages["promotion"]) + if promotion is None: + return Stop("promotion", f"The candidate for {version} succeeded, but Promote Release Source was not " + f"dispatched. Dispatch it with operation=promote and candidate run " + f"{candidate.get('id')}.", candidate.get("html_url")) + if promotion.get("conclusion") != "success": + return Stop("promotion", f"Promote Release Source for {version} concluded {promotion.get('conclusion')}.", + promotion.get("html_url")) + publication = newest(stages["public release"]) + if publication is None: + return Stop("publication", f"`{public_tag}` was promoted, but no public release run started for it.", + promotion.get("html_url")) + if publication.get("conclusion") != "success": + return Stop("publication", f"The public release run for `{public_tag}` concluded " + f"{publication.get('conclusion')}.", publication.get("html_url")) + return Stop("publication", f"The public release run for `{public_tag}` succeeded, but the release is not " + "published.", publication.get("html_url")) + + def advance(self, line: Line, spent: Spent | None = None) -> str: + number = line.number + 1 + target = self.newest_green_develop() + if target is None: + raise Stop("develop", "No commit on develop has a successful push CI run.") + if self.repository.is_ancestor(target, line.tip): + if spent is not None: + raise Stop("candidate", f"{spent} develop has no newer green commit to cut " + f"{line.prerelease(number)} from; land the fix on develop.", spent.link) + raise Skip(f"develop has not moved: its newest green commit {target} is already in {line.branch}.") + self.check_fixes_on_develop(line) + lock, lock_note = self.lock_for(line, target) + commit = self.commit_cut(line, number, target, lock, lock_note) + return f"Pushed {commit} to {line.branch}: develop {target} as {line.prerelease(number)}." + + def newest_green_develop(self) -> str | None: + develop = self.repository.develop() + runs = self.internal.runs(CI, branch="develop", event="push", status="success") + for run in sorted(runs, key=run_order, reverse=True): + sha = run.get("head_sha", "") + if self.repository.contains(sha) and self.repository.is_ancestor(sha, develop): + self.notes.append(f"Newest green develop commit: {sha}.") + return sha + return None + + def check_fixes_on_develop(self, line: Line) -> None: + fixes = [ + commit.sha for commit in self.repository.commits_missing_from_develop(line.tip) + if commit.author_email != self.bot_email and not METADATA_FILES.issuperset(commit.files) + ] + if fixes: + raise Stop("fixes", f"{line.branch} holds commits that are not on develop: {', '.join(fixes)}. " + "Fixes land on develop first.") + + def recipes(self, commit: str) -> dict[str, str] | None: + if commit not in self.recipe_cache: + self.recipe_cache[commit] = self.repository.fingerprints(commit) + return self.recipe_cache[commit] + + def lock_for(self, line: Line, target: str) -> tuple[bytes, str]: + wanted = self.recipes(target) + if wanted is None: + raise RuntimeError(f"develop commit {target} is missing from the checkout") + current = self.repository.read(line.tip, LOCK_FILE) + if current is not None and lock_recipes(current) == wanted: + self.notes.append(f"Linux image lock: kept; develop's recipe fingerprints match {line.branch}'s lock.") + return current, "" + generation = self.generation_for(wanted) + lock, run = self.prepared_lock(generation, wanted) + self.notes.append(f"Linux image lock: replaced with {generation} from {run.get('html_url')}.") + return lock, f"The Linux image lock moves to {generation}, prepared by {run.get('html_url')}." + + def published_generations(self) -> dict[int, str]: + shared: set[str] | None = None + for package in IMAGE_PACKAGES: + tags = {tag for version in self.packages.list_versions(image_tags.OWNER, package) + for tag in version.tags if GENERATION_TAG.fullmatch(tag)} + shared = tags if shared is None else shared & tags + generations: dict[int, str] = {} + for tag in sorted(shared or (), key=lambda item: int(GENERATION_TAG.fullmatch(item)["attempt"])): + generations[int(GENERATION_TAG.fullmatch(tag)["run"])] = tag + return generations + + def generation_for(self, wanted: dict[str, str]) -> str: + published = self.published_generations() + refreshing = None + runs = (self.internal.runs(WARMER, branch="develop") + + self.internal.runs(PUBLISHER, branch="develop", event="workflow_dispatch")) + for run in sorted(runs, key=run_order, reverse=True): + matches = self.recipes(run.get("head_sha", "")) == wanted + # A generation is tagged only by the run's promote job, so it can be used before the run ends. + if matches and run.get("id") in published: + return published[run["id"]] + if refreshing is None and in_flight(run) and matches and self.refreshes_images(run): + refreshing = run + if refreshing is not None: + raise Stop("lock", "The Linux images for develop's recipe fingerprints are still being refreshed. Nothing " + "resumes the cut when that run finishes, so dispatch Scheduled Beta Cut after it does.", + refreshing.get("html_url")) + raise Stop("lock", "No validated Linux image generation matches develop's recipe fingerprints. " + "Refresh the images with Refresh Build Caches (targets: linux-images) on develop.") + + def refreshes_images(self, run: dict) -> bool: + for job in self.internal.jobs(run["id"]): + name = job.get("name") or "" + if name in (NORMAL_IMAGES_JOB, f"{IMAGE_REFRESH_JOB} / {NORMAL_IMAGES_JOB}"): + return job.get("conclusion") != "skipped" + if name == IMAGE_REFRESH_JOB: + return job.get("status") != "completed" + # The run has not yet decided whether it builds the four normal images. + return True + + def prepared_lock(self, generation: str, wanted: dict[str, str]) -> tuple[bytes, dict]: + runs = [run for run in self.internal.runs(PREPARATION, branch="develop", event="workflow_dispatch") + if preparation_of(run) == ("develop", generation)] + if any(in_flight(run) for run in runs): + raise self.wait("lock", runs, f"Prepare Release Dependencies for {generation} is still running; the cut " + "waits for its lock.") + for run in sorted(runs, key=run_order, reverse=True): + if run.get("conclusion") != "success": + continue + lock = self.internal.artifact_file(run["id"], PREPARED_ARTIFACT, LOCK_FILE) + if lock is not None and lock_generation(lock) == generation and lock_recipes(lock) == wanted: + return lock, run + latest = newest(runs) + if latest is not None and latest.get("conclusion") != "success": + raise Stop("lock", f"Prepare Release Dependencies for {generation} concluded {latest.get('conclusion')}. " + "Re-run it to resume the cut.", latest.get("html_url")) + tip = self.repository.develop() + if self.recipes(tip) != wanted: + # The preparation verifies the images against develop's tip, not against the commit being cut. + raise Stop("lock", f"develop's tip {tip} has other Linux image recipes than its newest green commit, so " + f"a preparation of {generation} would fail. Dispatch Scheduled Beta Cut once the tip's " + "CI has passed.") + self.internal.dispatch(PREPARATION, "develop", {"source_branch": "develop", "generation": generation}) + raise Skip(f"Dispatched Prepare Release Dependencies for {generation}; a later run commits its lock " + "in the cut.") + + def commit_cut(self, line: Line, number: int, target: str, lock: bytes, lock_note: str) -> str: + version = line.prerelease(number) + worktree, conflicts = self.repository.start_merge(line.tip, target, self.bot_login, self.bot_email) + try: + unexpected = sorted(set(conflicts) - METADATA_FILES) + if unexpected: + raise Stop("merge", f"Merging develop {target} into {line.branch} conflicts in " + f"{', '.join(unexpected)}.") + self.repository.write(worktree, {STATE_FILE: render_state(line.version, number).encode(), LOCK_FILE: lock}) + try: + self.repository.validate_lock(worktree) + except RuntimeError as error: + raise Stop("lock", f"The Linux image lock for {version} does not validate: {error}") from error + body = textwrap.fill( + f"Merge develop at {target} into {line.branch} with release state BETA {number}. {lock_note}".strip(), + 72, break_long_words=False, break_on_hyphens=False) + commit = self.repository.commit(worktree, self.bot_login, self.bot_email, + f"Cut {version} from develop\n\n{body}\n") + try: + self.repository.push(commit, line.branch) + except RuntimeError as error: + raise Stop("merge", f"Pushing the {version} cut to {line.branch} failed: {error}") from error + return commit + finally: + self.repository.discard(worktree) + + def continue_after(self, run: dict) -> str: + actor = (run.get("actor") or {}).get("login") + if actor != self.bot_login: + raise Skip(f"{run.get('html_url')} was started by {actor}, not {self.bot_login}; nothing to do.") + workflow = (run.get("path"), run.get("event")) + conclusion = run.get("conclusion") + if workflow == (f".github/workflows/{PREPARATION}", "workflow_dispatch"): + return self.after_preparation(run) + self.repository.sync(shallow=True) + line = self.beta_line() + if (run.get("head_branch"), run.get("head_sha")) != (line.branch, line.tip): + raise Skip(f"{run.get('html_url')} ran on {run.get('head_branch')} at {run.get('head_sha')}, not at the " + f"tip of {line.branch}; nothing to do.") + version = line.prerelease() + tag = candidate_tag(version) + if workflow == (f".github/workflows/{CI}", "push"): + if conclusion != "success": + raise Stop("ci", f"CI for the {version} cut concluded {conclusion}. Re-run it if the failure is " + "transient.", run.get("html_url")) + if self.repository.tag(tag) is not None: + raise Skip(f"`{tag}` already exists; nothing to do.") + if any(in_flight(candidate) for candidate in self.candidate_runs(line)): + raise Skip(f"A candidate run for {version} is already running; nothing to do.") + return self.dispatch_candidate(line) + candidate_run = workflow == (f".github/workflows/{CANDIDATE}", "workflow_dispatch") + if candidate_run and candidate_of(run) == (version, "create"): + if conclusion != "success": + if self.repository.tag(tag) is None: + after = f"the next scheduled cut retries {version}" + else: + after = f"the next scheduled cut moves on to BETA {line.number + 1}, because build tags never move" + raise Stop("candidate", f"The candidate run for `{tag}` concluded {conclusion}. Re-run it if the " + f"failure is transient; otherwise {after}.", run.get("html_url")) + tag_sha = self.repository.tag(tag) + if tag_sha != line.tip: + raise Stop("candidate", f"The candidate run succeeded, but `{tag}` resolves to {tag_sha or 'nothing'} " + f"instead of {line.tip}.", run.get("html_url")) + self.internal.dispatch(PROMOTION, line.branch, + {"version": version, "candidate_run_id": str(run["id"]), "operation": "promote"}) + return f"Dispatched Promote Release Source for `v{version}` from candidate run {run['id']}." + if workflow == (f".github/workflows/{PROMOTION}", "workflow_dispatch"): + if conclusion != "success": + raise Stop("promotion", f"Promote Release Source for {version} concluded {conclusion}. Re-running it " + f"resumes {version}.", run.get("html_url")) + raise Skip(f"`v{version}` is promoted; the public repository's release run publishes it.") + raise Skip(f"{run.get('html_url')} is not a CI, candidate or promotion run of the {version} cut; " + "nothing to do.") + + def after_preparation(self, run: dict) -> str: + prepared = preparation_of(run) + if run.get("head_branch") != "develop" or prepared is None or prepared[0] != "develop": + raise Skip(f"{run.get('html_url')} is not a preparation from develop; nothing to do.") + if run.get("conclusion") != "success": + raise Stop("lock", f"Prepare Release Dependencies for {prepared[1]} concluded {run.get('conclusion')}. " + "Re-run it to resume the cut.", run.get("html_url")) + self.internal.dispatch(BETA_CUT, "develop", {}) + return f"Dispatched the beta cut on develop: the lock for {prepared[1]} is prepared." + + +class Repository: + """Git operations on the workflow checkout; remote access authenticates with the release-bot token.""" + + def __init__(self, root: Path, remote: str, token: str | None = None, server: str = "https://github.com") -> None: + self.root = root + self.remote = remote + self.auth: tuple[str, ...] = () + if token: + credential = base64.b64encode(f"x-access-token:{token}".encode()).decode() + self.auth = ("-c", f"http.{server}/.extraheader=AUTHORIZATION: basic {credential}") + + def git(self, *arguments: str, cwd: Path | None = None, check: bool = True, + env: dict[str, str] | None = None) -> subprocess.CompletedProcess: + result = subprocess.run(["git", *self.auth, *arguments], cwd=cwd or self.root, capture_output=True, + env={**os.environ, "GIT_TERMINAL_PROMPT": "0", **(env or {})}) + if check and result.returncode: + detail = (result.stderr or result.stdout).decode(errors="replace").strip() + raise RuntimeError(f"git {' '.join(arguments[:2])} failed: {detail}") + return result + + def output(self, *arguments: str, cwd: Path | None = None) -> str: + return self.git(*arguments, cwd=cwd).stdout.decode().strip() + + def sync(self, *, shallow: bool = False) -> None: + releases = "+refs/heads/release/*:refs/remotes/origin/release/*" + if shallow: + self.git("fetch", "--prune", "--no-tags", "--depth=1", self.remote, releases) + else: + self.git("fetch", "--prune", "--no-tags", self.remote, + "+refs/heads/develop:refs/remotes/origin/develop", releases) + + def release_heads(self) -> dict[str, str]: + listing = self.output("for-each-ref", "--format=%(refname:strip=3) %(objectname)", + "refs/remotes/origin/release/") + return dict(line.split(" ", 1) for line in listing.splitlines()) + + def develop(self) -> str: + return self.output("rev-parse", "--verify", "refs/remotes/origin/develop^{commit}") + + def tag(self, name: str) -> str | None: + listing = self.output("ls-remote", self.remote, f"refs/tags/{name}", f"refs/tags/{name}^{{}}") + refs = {ref: sha for sha, ref in (line.split("\t") for line in listing.splitlines())} + return refs.get(f"refs/tags/{name}^{{}}") or refs.get(f"refs/tags/{name}") + + def contains(self, commit: str) -> bool: + return bool(commit) and self.git("cat-file", "-e", f"{commit}^{{commit}}", check=False).returncode == 0 + + def read(self, commit: str, path: str) -> bytes | None: + self.git("cat-file", "-e", f"{commit}^{{commit}}") + if self.git("cat-file", "-e", f"{commit}:{path}", check=False).returncode: + return None + return self.git("cat-file", "blob", f"{commit}:{path}").stdout + + def is_ancestor(self, ancestor: str, descendant: str) -> bool: + result = self.git("merge-base", "--is-ancestor", ancestor, descendant, check=False) + if result.returncode not in (0, 1): + raise RuntimeError(f"git merge-base failed: {result.stderr.decode(errors='replace').strip()}") + return result.returncode == 0 + + def commits_missing_from_develop(self, tip: str) -> list[Commit]: + commits = [] + for sha in self.output("rev-list", f"refs/remotes/origin/develop..{tip}").split(): + email, _, parents = self.output("show", "-s", "--format=%ae%n%P", sha).partition("\n") + if parents: + files = self.output("diff", "--no-renames", "--name-only", parents.split()[0], sha) + else: + files = self.output("ls-tree", "-r", "--name-only", sha) + commits.append(Commit(sha, email, tuple(files.splitlines()))) + return commits + + def fingerprints(self, commit: str) -> dict[str, str] | None: + if not self.contains(commit): + return None + archive = self.git("archive", "--format=tar", commit, ".github").stdout + with tempfile.TemporaryDirectory() as directory: + subprocess.run(["tar", "-x", "-f", "-", "-C", directory], input=archive, check=True, capture_output=True) + return { + key: subprocess.run(["bash", ".github/scripts/linux-ci-image-fingerprint.sh", profile], cwd=directory, + check=True, capture_output=True, text=True).stdout.strip() + for key, (_package, profile, *_rest) in images.IMAGES.items() + } + + def start_merge(self, tip: str, commit: str, name: str, email: str) -> tuple[Path, list[str]]: + worktree = Path(tempfile.mkdtemp(prefix="beta-cut-")) / "tree" + self.git("worktree", "add", "--detach", str(worktree), tip) + merged = self.git("merge", "--no-ff", "--no-commit", commit, cwd=worktree, check=False, + env=git_identity(name, email)) + conflicts = self.output("diff", "--name-only", "--diff-filter=U", cwd=worktree).splitlines() + if merged.returncode and not conflicts: + detail = (merged.stderr or merged.stdout).decode(errors="replace").strip() + self.discard(worktree) + raise RuntimeError(f"git merge failed: {detail}") + return worktree, conflicts + + def write(self, worktree: Path, files: dict[str, bytes]) -> None: + for path, content in files.items(): + (worktree / path).write_bytes(content) + self.git("add", "--", *files, cwd=worktree) + + def validate_lock(self, worktree: Path) -> None: + result = subprocess.run([sys.executable, ".github/scripts/release-linux-images.py", "validate", LOCK_FILE, + "--check-remote"], cwd=worktree, capture_output=True, text=True) + if result.returncode: + raise RuntimeError((result.stderr or result.stdout).strip()) + + def commit(self, worktree: Path, name: str, email: str, message: str) -> str: + self.git("commit", "--no-verify", "--quiet", "--message", message, cwd=worktree, + env=git_identity(name, email)) + return self.output("rev-parse", "HEAD", cwd=worktree) + + def push(self, commit: str, branch: str) -> None: + self.git("push", self.remote, f"{commit}:refs/heads/{branch}") + + def discard(self, worktree: Path) -> None: + self.git("worktree", "remove", "--force", str(worktree), check=False) + shutil.rmtree(worktree.parent, ignore_errors=True) + + +class KeepRedirect(urllib.request.HTTPRedirectHandler): + def redirect_request(self, *arguments, **keywords): + return None + + +class GitHub: + def __init__(self, token: str, repository: str, api_url: str = "https://api.github.com") -> None: + self.token = token + self.repository = repository + self.api_url = api_url.rstrip("/") + + def request(self, method: str, path: str, *, params: dict | None = None, + body: object = None) -> urllib.request.Request: + url = self.api_url + path + ("?" + urllib.parse.urlencode(params) if params else "") + data = None if body is None else json.dumps(body).encode() + headers = { + "Accept": "application/vnd.github+json", + "Authorization": f"Bearer {self.token}", + "X-GitHub-Api-Version": "2022-11-28", + "User-Agent": "wsjtx-beta-scheduler", + } + if data is not None: + headers["Content-Type"] = "application/json" + return urllib.request.Request(url, data=data, method=method, headers=headers) + + def call(self, method: str, path: str, *, params: dict | None = None, body: object = None, + missing_ok: bool = False): + try: + with urllib.request.urlopen(self.request(method, path, params=params, body=body), timeout=60) as response: + payload = response.read() + except urllib.error.HTTPError as error: + if missing_ok and error.code == 404: + return None + raise RuntimeError(f"{method} {path} failed with HTTP {error.code}") from error + return json.loads(payload) if payload else None + + def runs(self, workflow: str, **filters: str) -> list[dict]: + return self.call("GET", f"/repos/{self.repository}/actions/workflows/{workflow}/runs", + params={"per_page": 100, **filters})["workflow_runs"] + + def jobs(self, run_id: int) -> list[dict]: + return self.call("GET", f"/repos/{self.repository}/actions/runs/{run_id}/jobs", + params={"per_page": 100})["jobs"] + + def dispatch(self, workflow: str, ref: str, inputs: dict[str, str]) -> None: + self.call("POST", f"/repos/{self.repository}/actions/workflows/{workflow}/dispatches", + body={"ref": ref, "inputs": inputs}) + + def release_published(self, tag: str) -> bool: + path = f"/repos/{self.repository}/releases/tags/{urllib.parse.quote(tag, safe='')}" + return self.call("GET", path, missing_ok=True) is not None + + def user_id(self, login: str) -> int: + return self.call("GET", f"/users/{urllib.parse.quote(login, safe='')}")["id"] + + def artifact_file(self, run_id: int, name: str, member: str) -> bytes | None: + listing = self.call("GET", f"/repos/{self.repository}/actions/runs/{run_id}/artifacts", + params={"name": name, "per_page": 100}) + live = [item for item in listing["artifacts"] if item.get("name") == name and not item.get("expired")] + if not live: + return None + archive = self.download(f"/repos/{self.repository}/actions/artifacts/{live[0]['id']}/zip") + with zipfile.ZipFile(io.BytesIO(archive)) as bundle: + return bundle.read(member) if member in bundle.namelist() else None + + def download(self, path: str) -> bytes: + try: + with urllib.request.build_opener(KeepRedirect).open(self.request("GET", path), timeout=60) as response: + return response.read() + except urllib.error.HTTPError as redirect: + location = redirect.headers.get("Location") + if redirect.code not in (301, 302, 303, 307, 308) or not location: + raise RuntimeError(f"GET {path} failed with HTTP {redirect.code}") from redirect + # The signed storage URL must not receive the API token. + with urllib.request.urlopen(location, timeout=120) as response: + return response.read() + + +class Alerts: + def __init__(self, github, run_url: str) -> None: + self.github = github + self.run_url = run_url + + def post(self, stage: str, reason: str, link: str | None = None) -> None: + lines = [f"**Stage:** {stage}", f"**Reason:** {reason}", f"**Run:** {link or self.run_url}"] + if link and link != self.run_url: + lines.append(f"**Reported by:** {self.run_url}") + body = "\n\n".join(lines) + issues_path = f"/repos/{self.github.repository}/issues" + issues = self.github.call("GET", issues_path, + params={"state": "open", "creator": ALERT_CREATOR, "per_page": 100}) + tracking = sorted( + issue["number"] for issue in issues + if issue.get("title") == ALERT_TITLE and "pull_request" not in issue + and (issue.get("user") or {}).get("login") == ALERT_CREATOR + ) + if tracking: + self.github.call("POST", f"{issues_path}/{tracking[0]}/comments", body={"body": body}) + else: + self.github.call("POST", issues_path, body={"title": ALERT_TITLE, "body": body}) + + +def run_step(command: str, action: Callable[[], str], + notes: list[str]) -> tuple[int, str, tuple[str, str, str | None] | None]: + alert = None + try: + result, status = action(), 0 + except Skip as skip: + result, status = str(skip), 0 + except Stop as stop: + result, status, alert = f"Stopped at {stop.stage}: {stop}", 1, (stop.stage, str(stop), stop.link) + except Exception as error: # Every unexpected failure also reaches the tracking issue. + traceback.print_exc() + result, status, alert = f"Failed: {error}", 1, (command, f"Unexpected error: {error}", None) + summary = "\n".join([f"## Scheduled beta: {command}", "", *(f"- {note}" for note in notes), "", result, ""]) + return status, summary, alert + + +def build_scheduler(command: str, env, notes: list[str]) -> Scheduler: + repository = env["GITHUB_REPOSITORY"] + server = env.get("GITHUB_SERVER_URL", "https://github.com") + api_url = env.get("GITHUB_API_URL", "https://api.github.com") + token = env["RELEASE_BOT_TOKEN"] + bot_login = f"{env['RELEASE_BOT_SLUG']}[bot]" + internal = GitHub(token, repository, api_url) + git = Repository(Path.cwd(), f"{server}/{repository}.git", token, server) + if command == "continue": + return Scheduler(git, internal, bot_login=bot_login, notes=notes) + return Scheduler( + git, internal, + GitHub(env["PUBLIC_READ_TOKEN"], PUBLIC_REPOSITORY, api_url), + image_tags.GitHubPackagesClient(env["GITHUB_TOKEN"], api_url), + bot_login=bot_login, + bot_email=f"{internal.user_id(bot_login)}+{bot_login}@users.noreply.github.com", + notes=notes, + ) + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__) + commands = parser.add_subparsers(dest="command", required=True) + commands.add_parser("cut", help="apply one step of the beta state machine") + commands.add_parser("continue", help="continue after the workflow run in GITHUB_EVENT_PATH") + alert_parser = commands.add_parser("alert", help="record a failure on the tracking issue") + alert_parser.add_argument("--stage", required=True) + alert_parser.add_argument("--reason", required=True) + args = parser.parse_args(argv) + env = os.environ + repository = env["GITHUB_REPOSITORY"] + run_url = f"{env.get('GITHUB_SERVER_URL', 'https://github.com')}/{repository}/actions/runs/{env['GITHUB_RUN_ID']}" + alerts = Alerts(GitHub(env["GITHUB_TOKEN"], repository, env.get("GITHUB_API_URL", "https://api.github.com")), + run_url) + if args.command == "alert": + alerts.post(args.stage, args.reason) + return 0 + notes: list[str] = [] + + def step() -> str: + scheduler = build_scheduler(args.command, env, notes) + if args.command == "cut": + return scheduler.cut() + event = json.loads(Path(env["GITHUB_EVENT_PATH"]).read_text(encoding="utf-8")) + return scheduler.continue_after(event["workflow_run"]) + + status, summary, alert = run_step(args.command, step, notes) + print(summary) + if env.get("GITHUB_STEP_SUMMARY"): + with open(env["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as stream: + stream.write(summary) + if alert: + alerts.post(*alert) + if env.get("GITHUB_OUTPUT"): + with open(env["GITHUB_OUTPUT"], "a", encoding="utf-8") as stream: + stream.write("alerted=true\n") + return status + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/scripts/build-fftw-macos.sh b/.github/scripts/build-fftw-macos.sh index 6ae1505d..cbaf0291 100755 --- a/.github/scripts/build-fftw-macos.sh +++ b/.github/scripts/build-fftw-macos.sh @@ -19,7 +19,7 @@ cd "fftw-${version}" --enable-single \ --enable-threads \ --enable-shared --disable-static \ - CFLAGS="-mmacosx-version-min=${deployment_target}" \ + CFLAGS="-O3 -mmacosx-version-min=${deployment_target}" \ LDFLAGS="-mmacosx-version-min=${deployment_target}" make -j"$(sysctl -n hw.ncpu)" make install diff --git a/.github/scripts/build-linux-armhf-cross.sh b/.github/scripts/build-linux-armhf-cross.sh index cfbb2f03..f8c80dd8 100755 --- a/.github/scripts/build-linux-armhf-cross.sh +++ b/.github/scripts/build-linux-armhf-cross.sh @@ -4,8 +4,13 @@ set -euo pipefail VERSION="${VERSION:?missing}" ARCH="${ARCH:?missing}" HAMLIB_BRANCH="${HAMLIB_BRANCH:?missing}" -WSJT_RELEASE_CHANNEL="${WSJT_RELEASE_CHANNEL:-DEVEL}" -WSJT_RC_NUMBER="${WSJT_RC_NUMBER:-}" +WSJT_RELEASE_CHANNEL="${WSJT_RELEASE_CHANNEL:-}" +WSJT_PRERELEASE_NUMBER="${WSJT_PRERELEASE_NUMBER:-}" +ARMHF_BUILD_ONLY="${ARMHF_BUILD_ONLY:-false}" +case "$ARMHF_BUILD_ONLY" in + true|false) ;; + *) echo "ARMHF_BUILD_ONLY must be true or false" >&2; exit 2 ;; +esac if [ "$ARCH" != armhf ]; then echo "build-linux-armhf-cross.sh supports only arch=armhf" >&2 exit 2 @@ -42,7 +47,7 @@ cmake -S . -B wsjtx-build \ -DWSJT_ENABLE_TESTS=ON \ -DWSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY \ -DWSJT_RELEASE_CHANNEL="$WSJT_RELEASE_CHANNEL" \ - -DWSJT_RC_NUMBER="$WSJT_RC_NUMBER" \ + -DWSJT_PRERELEASE_NUMBER="$WSJT_PRERELEASE_NUMBER" \ -Wno-dev cmake --build wsjtx-build --parallel "$(nproc)" ended="$(date +%s)" @@ -55,6 +60,10 @@ ccache --show-stats validate_linux_build_executables wsjtx-build "$ARCH" .github/scripts/audit-armhf-cross-build.sh wsjtx-build +if [ "$ARMHF_BUILD_ONLY" = true ]; then + echo "ARMHF build-only compilation and binary audits complete for version=$VERSION" + exit 0 +fi echo "::group::Prepare ARMHF AppDir" cmake --install wsjtx-build --prefix /work/AppDir/usr validate_linux_application_tree AppDir appdir "$ARCH" diff --git a/.github/scripts/generate-quick-downloads.py b/.github/scripts/generate-quick-downloads.py index 6706292d..0ba21c36 100755 --- a/.github/scripts/generate-quick-downloads.py +++ b/.github/scripts/generate-quick-downloads.py @@ -3,7 +3,7 @@ The release workflow attaches every build artifact to the Release, which makes the assets list long and hard for an end user to navigate (installers sit among -standalone command-line utilities, raw binaries, and source). This emits a +the command-line program tarballs, checksums, the manifest, and source). This emits a short, curated per-platform installer picker to prepend to the auto-generated release notes. @@ -19,9 +19,8 @@ Usage: generate-quick-downloads.py ... Only installer-grade assets are listed (.pkg / win64.exe / .deb / .rpm / -.AppImage) plus the source tarball. Per-mode utility tarballs and raw -command-line binaries are intentionally omitted; they remain in the full -assets list below the notes. +.AppImage) plus the source tarball. The command-line program tarballs are +intentionally omitted; they remain in the full assets list below the notes. """ import os import re @@ -66,8 +65,8 @@ def main(argv): appimage[m.group(1)] = n elif (m := re.search(r"\.([A-Za-z0-9_]+)\.rpm$", n)): rpm[m.group(1)] = n - # Anything else (utility tarballs, raw binaries) is intentionally - # excluded; it stays in the full assets list. + # Anything else (program tarballs, checksums, the manifest) is + # intentionally excluded; it stays in the full assets list. def arches(d): known = [a for a in ARCH_ORDER if a in d] @@ -83,7 +82,7 @@ def main(argv): "## Quick Downloads", "", "Choose the installer for your platform. The full assets list below also", - "includes standalone command-line utilities and source code for developers.", + "includes the command-line program tarballs and source code for developers.", ] if macos: diff --git a/.github/scripts/is-linux-ci-image-input.sh b/.github/scripts/is-linux-ci-image-input.sh index 23a76e1b..07437151 100755 --- a/.github/scripts/is-linux-ci-image-input.sh +++ b/.github/scripts/is-linux-ci-image-input.sh @@ -82,6 +82,8 @@ if [ "${1:-}" = "--self-test" ]; then expect_non_input normal-noble ".github/images/linux-ci/install-armhf-runtime-packages.sh" expect_input armhf-cross-bookworm ".github/images/linux-ci/armhf-cross-toolchain.config" expect_non_input armhf-runtime-bookworm ".github/images/linux-ci/armhf-cross-toolchain.config" + expect_input armhf-cross-bookworm ".github/scripts/armhf-toolchain-config.sh" + expect_input armhf-runtime-bookworm ".github/scripts/armhf-toolchain-config.sh" expect_input normal-noble ".github/scripts/build-hamlib-linux.sh" expect_non_input tsan-noble ".github/scripts/build-hamlib-linux.sh" expect_input tsan-noble ".github/scripts/build-qt-tsan-linux.sh" diff --git a/.github/scripts/linux-artifact-validation.sh b/.github/scripts/linux-artifact-validation.sh index 01a607f6..2a7db636 100644 --- a/.github/scripts/linux-artifact-validation.sh +++ b/.github/scripts/linux-artifact-validation.sh @@ -70,6 +70,7 @@ validate_elf_executable() { local file_output local header_output local program_output + local dynamic_output if [ ! -x "$path" ]; then linux_validation_error "Required executable is missing: $path" @@ -80,7 +81,14 @@ validate_elf_executable() { header_output=$(readelf -hW -- "$path") || return program_output=$(readelf -lW -- "$path") || return echo "$file_output" - validate_elf_metadata "$arch" "$path" "$file_output" "$header_output" "$program_output" + validate_elf_metadata "$arch" "$path" "$file_output" "$header_output" "$program_output" || return + if [ "${path##*/}" = jt9 ]; then + dynamic_output=$(readelf -dW -- "$path") || return + if printf '%s\n' "$dynamic_output" | awk '/\(NEEDED\)/ && /\[libQt/ { found=1 } END { exit found ? 0 : 1 }'; then + linux_validation_error "$path must not depend on Qt" + return 1 + fi + fi } validate_linux_build_executables() { diff --git a/.github/scripts/linux-ci-image-inputs.sh b/.github/scripts/linux-ci-image-inputs.sh index bc3e43af..938ad2d7 100644 --- a/.github/scripts/linux-ci-image-inputs.sh +++ b/.github/scripts/linux-ci-image-inputs.sh @@ -33,6 +33,7 @@ linux_ci_image_inputs() { printf '%s\n' \ .github/images/linux-ci/Dockerfile.armhf-cross \ .github/images/linux-ci/armhf-cross-toolchain.config \ + .github/scripts/armhf-toolchain-config.sh \ .github/scripts/armhf-ci-image-config.sh \ .github/scripts/build-armhf-toolchain-smoke.sh \ .github/scripts/build-hamlib-armhf-cross.sh \ @@ -49,6 +50,7 @@ linux_ci_image_inputs() { printf '%s\n' \ .github/images/linux-ci/Dockerfile.armhf-runtime \ .github/images/linux-ci/install-armhf-runtime-packages.sh \ + .github/scripts/armhf-toolchain-config.sh \ .github/scripts/armhf-ci-image-config.sh \ .github/scripts/linux-ci-image-config.sh \ .github/scripts/linux-ci-image-fingerprint.sh \ diff --git a/.github/scripts/linuxdeploy-excludelist.txt b/.github/scripts/linuxdeploy-excludelist.txt new file mode 100644 index 00000000..ee55ae4d --- /dev/null +++ b/.github/scripts/linuxdeploy-excludelist.txt @@ -0,0 +1,55 @@ +# The excludelist compiled into linuxdeploy 1-alpha-20251107-1, identical in +# its x86_64, aarch64 and armhf builds. linuxdeploy leaves these libraries, +# ld-linux* and linux-vdso to the host; update this file with the pin. +ld-linux-x86-64.so.2 +ld-linux.so.2 +libBrokenLocale.so.1 +libEGL.so.1 +libGL.so.1 +libGLX.so.0 +libGLdispatch.so.0 +libICE.so.6 +libOpenGL.so.0 +libSM.so.6 +libX11-xcb.so.1 +libX11.so.6 +libanl.so.1 +libasound.so.2 +libc.so.6 +libcidn.so.1 +libcom_err.so.2 +libdl.so.2 +libdrm.so.2 +libexpat.so.1 +libfontconfig.so.1 +libfreetype.so.6 +libfribidi.so.0 +libgbm.so.1 +libgcc_s.so.1 +libglapi.so.0 +libgmp.so.10 +libgpg-error.so.0 +libharfbuzz.so.0 +libjack.so.0 +libm.so.6 +libmvec.so.1 +libnss_compat.so.2 +libnss_dns.so.2 +libnss_files.so.2 +libnss_hesiod.so.2 +libnss_nis.so.2 +libnss_nisplus.so.2 +libpipewire-0.3.so.0 +libpthread.so.0 +libresolv.so.2 +librt.so.1 +libstdc++.so.6 +libthread_db.so.1 +libusb-1.0.so.0 +libutil.so.1 +libuuid.so.1 +libwayland-client.so.0 +libxcb-dri2.so.0 +libxcb-dri3.so.0 +libxcb.so.1 +libz.so.1 diff --git a/.github/scripts/package-cli-tools.sh b/.github/scripts/package-cli-tools.sh new file mode 100755 index 00000000..e9b7d03d --- /dev/null +++ b/.github/scripts/package-cli-tools.sh @@ -0,0 +1,499 @@ +#!/usr/bin/env bash +# Package the command-line programs into the release tarballs published beside +# the installers: one tarball per line of CMake/release-tarballs.txt. +# +# package-cli-tools.sh --platform macos|linux|windows --version V --arch A \ +# --groups FILE --source DIR --out DIR \ +# [--dll-dir DIR --system-dir DIR] [--linuxdeploy COMMAND] +# +# wsjtx-V--.tar.gz holds one directory of the same name: the +# tarball's programs, every library they load beyond the operating system's, +# README.txt, COPYING and THIRD-PARTY.txt. A missing program, an unresolved +# library or a library third-party-libraries.tsv does not name fails the run, +# and then no tarball is written. +# +# macos: --source is the CLI assets directory: the signed programs and the +# deployed lib/ of dylibs they reference as @rpath/. Each +# tarball gets its programs at the top and, in lib/, the dylibs they +# reach through their LC_RPATH entries. A reference outside /usr/lib +# and /System/Library that does not resolve there, or an absolute +# LC_RPATH, fails the run. +# linux: --source is the CMake build directory. --linuxdeploy is a command +# that runs the pinned linuxdeploy AppImage. It deploys each tarball's +# programs to bin/ and the libraries they load to lib/, except those +# on its excludelist (linuxdeploy-excludelist.txt), with RUNPATH +# $ORIGIN/../lib and $ORIGIN, and the libraries' Debian copyright +# files to share/doc/. A library that resolves neither inside the +# tarball nor to the excludelist, or a RUNPATH entry not relative to +# $ORIGIN, fails the run. +# windows: --source is the CMake build directory, --dll-dir the staged bin/ +# after DLL fixup and --system-dir the Windows system directory. Each +# tarball gets its .exe files and the transitive closure of the DLLs +# they import from --dll-dir; an import found in neither directory +# fails the run. +set -euo pipefail + +PLATFORM=""; VERSION=""; ARCH=""; GROUPS_FILE=""; SOURCE=""; OUT=""; DLL_DIR=""; SYSTEM_DIR=""; LINUXDEPLOY="" +while [ "$#" -gt 0 ]; do + case "$1" in + --platform) PLATFORM="$2"; shift 2 ;; + --version) VERSION="$2"; shift 2 ;; + --arch) ARCH="$2"; shift 2 ;; + --groups) GROUPS_FILE="$2"; shift 2 ;; + --source) SOURCE="$2"; shift 2 ;; + --out) OUT="$2"; shift 2 ;; + --dll-dir) DLL_DIR="$2"; shift 2 ;; + --system-dir) SYSTEM_DIR="$2"; shift 2 ;; + --linuxdeploy) LINUXDEPLOY="$2"; shift 2 ;; + *) echo "unknown argument: $1" >&2; exit 2 ;; + esac +done +for option in PLATFORM VERSION ARCH GROUPS_FILE SOURCE OUT; do + if [ -z "${!option}" ]; then echo "missing --$(echo "${option%_FILE}" | tr '[:upper:]' '[:lower:]')" >&2; exit 2; fi +done + +SCRIPTS="$(cd "$(dirname "$0")" && pwd)" +COPYING="${SCRIPTS}/../../COPYING" +NOTICES_TABLE="${SCRIPTS}/third-party-libraries.tsv" +EXCLUDELIST="${SCRIPTS}/linuxdeploy-excludelist.txt" +LICENSE_PAGE="${SCRIPTS}/../../doc/common/license.adoc" + +fail() { echo "::error::$*" >&2; exit 1; } + +case "$PLATFORM" in + macos) TARGET="${ARCH}-macOS"; EXT="" ;; + linux) TARGET="linux-${ARCH}"; EXT="" + [ -n "$LINUXDEPLOY" ] || { echo "::error::--linuxdeploy is required for linux" >&2; exit 2; } ;; + windows) TARGET="windows-${ARCH}"; EXT=".exe" + [ -n "$DLL_DIR" ] && [ -d "$DLL_DIR" ] || { echo "::error::--dll-dir is required for windows" >&2; exit 2; } + [ -n "$SYSTEM_DIR" ] && [ -d "$SYSTEM_DIR" ] || { echo "::error::--system-dir is required for windows" >&2; exit 2; } + ;; + *) echo "unknown platform: $PLATFORM" >&2; exit 2 ;; +esac +[ -d "$SOURCE" ] || fail "source directory not found: $SOURCE" +[ -s "$GROUPS_FILE" ] || fail "release tarball list not found or empty: $GROUPS_FILE" +[ -f "$COPYING" ] || fail "COPYING not found: $COPYING" +[ -f "$NOTICES_TABLE" ] || fail "third-party library table not found: $NOTICES_TABLE" +[ -f "$LICENSE_PAGE" ] || fail "license page not found: $LICENSE_PAGE" +[ "$PLATFORM" != linux ] || [ -f "$EXCLUDELIST" ] || fail "linuxdeploy excludelist not found: $EXCLUDELIST" + +# Plain indexed arrays and lookup files keep this runnable on bash 3.2. +GROUP_NAMES=(); GROUP_PROGRAMS=() +while IFS= read -r line || [ -n "$line" ]; do + line="${line%$'\r'}" # a Windows checkout may have CRLF endings + read -r -a fields <<< "$line" || true + [ "${#fields[@]}" -gt 0 ] || continue + case "${fields[0]}" in '#'*) continue ;; esac + [ "${#fields[@]}" -ge 2 ] || fail "release tarball ${fields[0]} names no programs in ${GROUPS_FILE}" + for name in ${GROUP_NAMES[@]+"${GROUP_NAMES[@]}"}; do + [ "$name" != "${fields[0]}" ] || fail "release tarball ${name} is named twice in ${GROUPS_FILE}" + done + GROUP_NAMES+=("${fields[0]}") + GROUP_PROGRAMS+=("${fields[*]:1}") +done < "$GROUPS_FILE" +[ "${#GROUP_NAMES[@]}" -gt 0 ] || fail "no release tarballs named in ${GROUPS_FILE}" + +missing=() +for programs in "${GROUP_PROGRAMS[@]}"; do + for program in $programs; do + [ -f "${SOURCE}/${program}${EXT}" ] || missing+=("${program}${EXT}") + done +done +[ "${#missing[@]}" -eq 0 ] || fail "programs listed in ${GROUPS_FILE} are missing under ${SOURCE}: ${missing[*]}" + +WORK=$(mktemp -d) +trap 'rm -rf "$WORK"' EXIT +mkdir -p "${WORK}/tarballs" + +# --- macOS ----------------------------------------------------------------- + +macho_rpaths() { + otool -l "$1" | awk '$1 == "cmd" && $2 == "LC_RPATH" { getline; getline; print $2 }' +} + +# Copies into $DEST/lib every dylib program $1 reaches. dyld resolves the +# @rpath references of the program, and of each dylib it loads, through that +# file's own LC_RPATH entries and then the program's; @executable_path is the +# program's directory, the top of $SOURCE. +macos_closure() { + local program="$1" rpath entry file id ref candidate directory found + local program_rpaths=() rpaths=() queue=("$1") unresolved=() i=0 visited=$'\n'"$1"$'\n' + while IFS= read -r rpath; do + case "$rpath" in + @loader_path|@executable_path) entry="" ;; + @loader_path/*) entry="${rpath#@loader_path/}" ;; + @executable_path/*) entry="${rpath#@executable_path/}" ;; + /*) fail "${program} has an absolute LC_RPATH: ${rpath}" ;; + *) fail "${program} has an LC_RPATH dyld cannot resolve: ${rpath}" ;; + esac + case "/${entry}/" in */../*) fail "${program} has an LC_RPATH outside its directory: ${rpath}" ;; esac + program_rpaths+=("$entry") + done < <(macho_rpaths "${SOURCE}/${program}") + while [ "$i" -lt "${#queue[@]}" ]; do + file="${queue[$i]}"; i=$((i + 1)) + directory=$(dirname "$file") + [ "$directory" != . ] || directory="" + rpaths=() + if [ "$file" != "$program" ]; then + while IFS= read -r rpath; do + case "$rpath" in + @loader_path) entry="$directory" ;; + @loader_path/*) entry="${directory:+${directory}/}${rpath#@loader_path/}" ;; + @executable_path) entry="" ;; + @executable_path/*) entry="${rpath#@executable_path/}" ;; + /*) fail "${file} has an absolute LC_RPATH: ${rpath}" ;; + *) fail "${file} has an LC_RPATH dyld cannot resolve: ${rpath}" ;; + esac + # QtCore searches ../Frameworks, outside the tarball; nothing may load from there. + case "/${entry}/" in */../*) continue ;; esac + rpaths+=("$entry") + done < <(macho_rpaths "${SOURCE}/${file}") + fi + rpaths+=(${program_rpaths[@]+"${program_rpaths[@]}"}) + id=$(otool -D "${SOURCE}/${file}" | awk 'NR == 2 { print; exit }') + while IFS= read -r ref; do + [ "$ref" != "$id" ] || continue + found="" + case "$ref" in + /usr/lib/*|/System/Library/*) continue ;; + @rpath/*) + for entry in ${rpaths[@]+"${rpaths[@]}"}; do + candidate="${entry:+${entry}/}${ref#@rpath/}" + if [ -f "${SOURCE}/${candidate}" ]; then found="$candidate"; break; fi + done + ;; + @loader_path/*) + candidate="${directory:+${directory}/}${ref#@loader_path/}" + if [ -f "${SOURCE}/${candidate}" ]; then found="$candidate"; fi + ;; + @executable_path/*) + candidate="${ref#@executable_path/}" + if [ -f "${SOURCE}/${candidate}" ]; then found="$candidate"; fi + ;; + esac + case "/${found}/" in */../*) found="" ;; esac + case "$found" in lib/*) ;; *) found="" ;; esac + if [ -z "$found" ]; then + unresolved+=("${ref}(${file})") + continue + fi + case "$visited" in *$'\n'"$found"$'\n'*) continue ;; esac + visited="${visited}${found}"$'\n' + queue+=("$found") + if [ ! -e "${DEST}/${found}" ]; then + mkdir -p "$(dirname "${DEST}/${found}")" + cp -p "${SOURCE}/${found}" "${DEST}/${found}" + fi + done < <(otool -L "${SOURCE}/${file}" | awk 'NR > 1 { print $1 }') + done + [ "${#unresolved[@]}" -eq 0 ] || fail "references that resolve neither to lib/ under ${SOURCE} nor to the system: ${unresolved[*]}" +} + +macos_minimum() { + local file + find "$DEST" -type f ! -name '*.txt' ! -name COPYING | while IFS= read -r file; do + otool -l "$file" | awk ' + $1 == "Load" && $2 == "command" { command = "" } + $1 == "cmd" { command = $2 } + command == "LC_BUILD_VERSION" && $1 == "minos" { print $2 } + command == "LC_VERSION_MIN_MACOSX" && $1 == "version" { print $2 } + ' + done | sort -t . -k 1,1n -k 2,2n -k 3,3n | tail -n 1 +} + +# --- Windows --------------------------------------------------------------- + +windows_setup() { + have="${WORK}/have.tsv" + : > "$have" + for dll in "$DLL_DIR"/*.dll "$DLL_DIR"/*.DLL; do + [ -e "$dll" ] || continue + printf '%s\t%s\n' "$(basename "$dll" | tr '[:upper:]' '[:lower:]')" "$dll" >> "$have" + done + system="${WORK}/system.txt" + for file in "$SYSTEM_DIR"/*; do + printf '%s\n' "${file##*/}" + done | tr '[:upper:]' '[:lower:]' > "$system" +} + +windows_closure() { + local queue=("${DEST}"/*.exe) unresolved=() i=0 bin imports dep lower src target + while [ "$i" -lt "${#queue[@]}" ]; do + bin="${queue[$i]}"; i=$((i + 1)) + imports=$(objdump -p "$bin") || fail "objdump failed on ${bin##*/}" + while read -r dep; do + lower=$(printf '%s' "$dep" | tr '[:upper:]' '[:lower:]') + src=$(awk -F '\t' -v k="$lower" '$1 == k { print $2; exit }' "$have") + if [ -z "$src" ]; then + grep -qxF "$lower" "$system" || unresolved+=("${dep}(${bin##*/})") + continue + fi + target="${DEST}/$(basename "$src")" + [ ! -e "$target" ] || continue + cp "$src" "$target" + queue+=("$target") + done < <(awk '/DLL Name:/ { print $3 }' <<< "$imports") + done + [ "${#unresolved[@]}" -eq 0 ] || fail "DLL imports found in neither ${DLL_DIR} nor ${SYSTEM_DIR}: ${unresolved[*]}" +} + +# --- Linux ----------------------------------------------------------------- + +in_excludelist() { + local library="$1" pattern + case "$library" in ld-linux*|linux-vdso*) return 0 ;; esac + while IFS= read -r pattern; do + pattern="${pattern%%#*}" + pattern="${pattern//[[:space:]]/}" + [ -n "$pattern" ] || continue + # shellcheck disable=SC2254 # entries are glob patterns + case "$library" in $pattern) return 0 ;; esac + done < "$EXCLUDELIST" + return 1 +} + +linux_deploy() { + local appdir="${WORK}/appdir-$1" program arguments=() + shift + for program in "$@"; do + arguments+=(--executable "${SOURCE}/${program}") + done + env -u GITHUB_TOKEN APPIMAGE_EXTRACT_AND_RUN=1 \ + "$LINUXDEPLOY" --appimage-extract-and-run --appdir "$appdir" "${arguments[@]}" || + fail "linuxdeploy failed for ${NAME}" + mkdir -p "${DEST}/bin" "${DEST}/lib" + for program in "$@"; do + [ -f "${appdir}/usr/bin/${program}" ] || fail "linuxdeploy did not deploy ${program}" + cp -p "${appdir}/usr/bin/${program}" "${DEST}/bin/" + done + if [ -d "${appdir}/usr/lib" ]; then + find "${appdir}/usr/lib" -maxdepth 1 -type f -exec cp -p {} "${DEST}/lib/" \; + fi + if [ -d "${appdir}/usr/share/doc" ]; then + mkdir -p "${DEST}/share" + cp -R "${appdir}/usr/share/doc" "${DEST}/share/doc" + fi +} + +# Every library a file needs must resolve inside the tarball through that +# file's own RUNPATH (it is not inherited) or be on the excludelist. Records +# what the host must provide. +linux_check() { + local file relative directory dynamic line entry library found unresolved=() searched + # shellcheck disable=SC2016 # the loader's literal ORIGIN token + local origin='$ORIGIN' braced='${ORIGIN}' + : > "${WORK}/host-libraries.txt" + : > "${WORK}/host-versions.txt" + while IFS= read -r file; do + relative="${file#"${DEST}"/}" + dynamic=$(readelf -dW "$file") || fail "readelf failed on ${relative}" + directory=$(dirname "$file") + searched=() + while IFS= read -r line; do + [[ "$line" =~ \((RUNPATH|RPATH)\).*Library[[:space:]](runpath|rpath):[[:space:]]\[([^]]+)\] ]] || continue + # The loader reads an empty entry as the current directory. + case "${BASH_REMATCH[3]}" in + :*|*:|*::*) fail "${relative} has an empty RUNPATH entry: ${BASH_REMATCH[3]}" ;; + esac + IFS=: read -r -a entries <<< "${BASH_REMATCH[3]}" + for entry in "${entries[@]}"; do + case "$entry" in + "$origin"|"$braced") searched+=("$directory") ;; + "$origin"/*) searched+=("${directory}/${entry#"$origin"/}") ;; + "$braced"/*) searched+=("${directory}/${entry#"$braced"/}") ;; + *) fail "${relative} has a RUNPATH entry not relative to ${origin}: ${entry}" ;; + esac + done + done <<< "$dynamic" + while IFS= read -r line; do + [[ "$line" =~ \(NEEDED\).*Shared[[:space:]]library:[[:space:]]\[([^]]+)\] ]] || continue + library="${BASH_REMATCH[1]}" + if in_excludelist "$library"; then + printf '%s\n' "$library" >> "${WORK}/host-libraries.txt" + continue + fi + found="" + for entry in ${searched[@]+"${searched[@]}"}; do + if [ -f "${entry}/${library}" ]; then found=1; break; fi + done + [ -n "$found" ] || unresolved+=("${library}(${relative})") + done <<< "$dynamic" + readelf -VW "$file" | awk ' + /^Version needs section/ { needs = 1; next } + /^Version (definition|symbols) section/ { needs = 0 } + needs && match($0, /Name: (GLIBC|GLIBCXX)_[0-9.]+/) { print substr($0, RSTART + 6, RLENGTH - 6) } + ' >> "${WORK}/host-versions.txt" || fail "readelf failed on ${relative}" + done < <(find "${DEST}/bin" "${DEST}/lib" -type f) + [ "${#unresolved[@]}" -eq 0 ] || fail "libraries that resolve neither inside ${NAME} nor to linuxdeploy's excludelist: ${unresolved[*]}" +} + +highest_version() { + awk -v prefix="$1_" 'index($0, prefix) == 1 { print substr($0, length(prefix) + 1) }' "${WORK}/host-versions.txt" | + sort -t . -k 1,1n -k 2,2n -k 3,3n | tail -n 1 +} + +# --- Notices and README ---------------------------------------------------- + +bundled_libraries() { + case "$PLATFORM" in + macos) if [ -d "${DEST}/lib" ]; then find "${DEST}/lib" -type f; fi ;; + linux) find "${DEST}/lib" -type f ;; + windows) find "$DEST" -maxdepth 1 -type f -iname '*.dll' ;; + esac +} + +write_notices() { + local file name pattern component license url matched unknown=() + : > "${WORK}/notices.tsv" + shopt -s nocasematch # Windows DLL names vary in case + while IFS= read -r file; do + name="${file##*/}" + matched="" + while IFS=$'\t' read -r pattern component license url; do + case "$pattern" in ''|'#'*) continue ;; esac + # shellcheck disable=SC2254 # table entries are glob patterns + case "$name" in + $pattern) printf '%s\t%s\t%s\t%s\n' "$component" "$license" "$url" "$name" >> "${WORK}/notices.tsv"; matched=1; break ;; + esac + done < "$NOTICES_TABLE" + [ -n "$matched" ] || unknown+=("$name") + done < <(bundled_libraries) + shopt -u nocasematch + while IFS=$'\t' read -r pattern component license url; do + [ "$pattern" != "@${PLATFORM}" ] || printf '%s\t%s\t%s\t(static)\n' "$component" "$license" "$url" >> "${WORK}/notices.tsv" + done < "$NOTICES_TABLE" + [ "${#unknown[@]}" -eq 0 ] || fail "bundled libraries missing from ${NOTICES_TABLE##*/}: ${unknown[*]}" + { + echo "Third-party libraries in ${NAME}" + echo + if [ -s "${WORK}/notices.tsv" ]; then + echo "These libraries are not part of WSJT-X. Each is distributed under its own license, published at the address given." + echo + LC_ALL=C sort -t $'\t' -k 1,1 -k 4,4 "${WORK}/notices.tsv" | awk -F '\t' ' + function flush() { + if (files != "") print " Files:" files + if (static) print " Linked statically into the programs" + } + $1 != last { if (last != "") { flush(); print "" } printf "%s\n License: %s\n %s\n", $1, $2, $3; last = $1; files = ""; static = 0 } + $4 == "(static)" { static = 1; next } + { files = files " " $4 } + END { if (last != "") flush() } + ' + else + echo "This tarball bundles no third-party libraries." + fi + if [ -d "${DEST}/share/doc" ]; then + echo + echo "share/doc/ holds the copyright files of the Debian packages that bundled libraries come from; a library built outside a Debian package has none there." + fi + } > "${DEST}/THIRD-PARTY.txt" +} + +describe() { + local writes="writes working files to its data directory (-a) and its temporary directory (-t), both the current directory by default; run it where it can write, or point -a and -t at writable directories." + case "$1" in + jt9) + echo "jt9 is the decoder the WSJT-X application drives through shared memory (-s). It also decodes WAV files, and framed PCM audio on standard input (--stream). jt9stream, in its own tarball, is the same decoder without Qt or shared memory." + echo "jt9 ${writes}" + ;; + jt9stream) + echo "jt9stream is the decoder of jt9 without Qt or shared memory: it decodes WAV files, and framed PCM audio on standard input (--stream). Its usage text names jt9 and lists -s, which jt9stream does not support." + echo "jt9stream ${writes}" + ;; + wsprd) + echo "wsprd decodes WSPR from WAV files, and from framed PCM audio on standard input (-0)." + echo "wsprd writes working files to its data directory (-a, default the current directory) and stops if it cannot write there." + ;; + utilities) + echo "Utilities for testing decoders: wsprcode and encode77 encode messages; ft4sim, jt4sim, jt65sim, cwsim and sfoxsim write simulated signals to WAV files in the current directory, so run them where they can write." + ;; + *) fail "no README description for release tarball $1" ;; + esac +} + +# The notice doc/common/license.adoc asks anyone using WSJT-X under the GPL to display. +copyright_notice() { + tr -d '\r' < "$LICENSE_PAGE" | + awk '/^\*The algorithms/ { on = 1 } on { printf "%s ", $0 } on && /Development Group\.\*$/ { exit }' | + sed -e 's/_{prog}_/WSJT-X/g' -e 's/^\*//' -e 's/\* *$//' -e 's/ */ /g' -e 's/ *$//' +} + +write_readme() { + local group="$1" programs="$2" floor glibc glibcxx host notice + notice=$(copyright_notice) + [ -n "$notice" ] || fail "no copyright notice found in ${LICENSE_PAGE}" + { + echo "WSJT-X ${VERSION}: ${group} for ${TARGET}" + echo + echo "Programs: ${programs}" + describe "$group" + echo + case "$PLATFORM" in + macos) + floor=$(macos_minimum) + [ -n "$floor" ] || fail "no minimum macOS version recorded in ${NAME}" + echo "Layout: the programs are at the top of this directory and the libraries they load are in lib/. Keep lib/ beside the programs. They require macOS ${floor} or later." + echo + echo "The programs and libraries carry ad-hoc signatures and are not notarized. macOS blocks quarantined programs that are not notarized, so remove the quarantine attribute from the tarball before extracting it (xattr -d com.apple.quarantine ), or from an extracted directory (xattr -dr com.apple.quarantine ). Changing one of these files, for example with install_name_tool, invalidates its signature; sign it again with codesign --force --sign - ." + ;; + linux) + glibc=$(highest_version GLIBC) + glibcxx=$(highest_version GLIBCXX) + host=$(LC_ALL=C sort -u "${WORK}/host-libraries.txt" | paste -sd ' ' -) + echo "Layout: the programs are in bin/ and the libraries they load are in lib/. Keep both directories together." + echo + echo "The system must provide glibc ${glibc:-of any version}${glibc:+ or later}${glibcxx:+, libstdc++ with GLIBCXX_${glibcxx} or later}, and these libraries: ${host}." + echo "LD_LIBRARY_PATH takes precedence over the bundled lib/, so start the programs without it." + ;; + windows) + echo "Layout: the programs and the DLLs they load are in this directory. Keep them together." + echo + echo "The programs and DLLs carry no Authenticode signature." + ;; + esac + echo + echo "WSJT-X is free software under the GNU General Public License version 3 (COPYING). Its source code is wsjtx-${VERSION}-src.tar.gz on the same release page. THIRD-PARTY.txt lists the bundled libraries and their licenses." + echo + echo "$notice" + } > "${DEST}/README.txt" +} + +# --- Package --------------------------------------------------------------- + +[ "$PLATFORM" != windows ] || windows_setup +packaged=() +for index in "${!GROUP_NAMES[@]}"; do + group="${GROUP_NAMES[$index]}" + programs="${GROUP_PROGRAMS[$index]}" + NAME="wsjtx-${VERSION}-${TARGET}-${group}" + DEST="${WORK}/${NAME}" + mkdir -p "$DEST" + # shellcheck disable=SC2086 # program names are single words + case "$PLATFORM" in + macos) + for program in $programs; do + cp -p "${SOURCE}/${program}" "${DEST}/" + macos_closure "$program" + done + ;; + linux) + linux_deploy "$group" $programs + linux_check + ;; + windows) + for program in $programs; do cp "${SOURCE}/${program}.exe" "${DEST}/"; done + windows_closure + ;; + esac + cp "$COPYING" "${DEST}/COPYING" + write_notices + write_readme "$group" "$programs" + COPYFILE_DISABLE=1 tar -czf "${WORK}/tarballs/${NAME}.tar.gz" -C "$WORK" "$NAME" + packaged+=("${NAME}.tar.gz") +done + +mkdir -p "$OUT" +for tarball in "${packaged[@]}"; do + mv "${WORK}/tarballs/${tarball}" "${OUT}/${tarball}" + echo "packaged ${OUT}/${tarball}" +done diff --git a/.github/scripts/package-linux-armhf.sh b/.github/scripts/package-linux-armhf.sh index abef3284..552fea56 100755 --- a/.github/scripts/package-linux-armhf.sh +++ b/.github/scripts/package-linux-armhf.sh @@ -16,8 +16,6 @@ source .github/scripts/armhf-ci-image-config.sh # shellcheck source=.github/scripts/linux-artifact-validation.sh source .github/scripts/linux-artifact-validation.sh export LD_LIBRARY_PATH="$ARMHF_RUNTIME_PREFIX" -export ARMHF_QEMU_EXECUTABLE -export LINUX_APPIMAGE_RUNNER="$ARMHF_QEMU_EXECUTABLE" echo "::group::Package .deb" ( @@ -89,20 +87,14 @@ QT_PLUGIN_ASSET_ID="$( )" curl "${curl_flags[@]}" -o linuxdeploy.AppImage \ "https://github.com/linuxdeploy/linuxdeploy/releases/download/${LINUXDEPLOY_TAG}/linuxdeploy-armhf.AppImage" -mkdir -p wsjtx-build/appimage-tools -github_api_curl -H "Accept: application/octet-stream" \ - -o wsjtx-build/appimage-tools/qt-plugin.AppImage \ +github_api_curl -H "Accept: application/octet-stream" -o linuxdeploy-plugin-qt.AppImage \ "https://api.github.com/repos/linuxdeploy/linuxdeploy-plugin-qt/releases/assets/${QT_PLUGIN_ASSET_ID}" echo "$LINUXDEPLOY_SHA256 linuxdeploy.AppImage" | sha256sum -c - -chmod +x linuxdeploy.AppImage wsjtx-build/appimage-tools/qt-plugin.AppImage -# shellcheck disable=SC2016 # variables expand when the generated wrapper runs -printf '%s\n' \ - '#!/bin/sh' \ - 'exec "${ARMHF_QEMU_EXECUTABLE:?}" /work/wsjtx-build/appimage-tools/qt-plugin.AppImage "$@"' \ - > linuxdeploy-plugin-qt.AppImage -chmod +x linuxdeploy-plugin-qt.AppImage -# Supply linuxdeploy with the non-executing ARMHF resolver; native ldd cannot -# safely enter the target loader from this already-emulated container. +chmod +x linuxdeploy.AppImage linuxdeploy-plugin-qt.AppImage +# linuxdeploy resolves dependencies with the non-executing ARMHF resolver, +# which reads the clean runtime prefix first and refuses a libquadmath +# dependency the ARMHF runtime cannot satisfy. +mkdir -p wsjtx-build/appimage-tools ln -sfn /work/.github/scripts/armhf-static-ldd.sh wsjtx-build/appimage-tools/ldd for target in AppDir/usr/bin/wsjtx AppDir/usr/bin/jt9 AppDir/usr/bin/qmap \ @@ -113,7 +105,6 @@ done export APPIMAGE_EXTRACT_AND_RUN=1 export OUTPUT="wsjtx-${VERSION}-linux-${ARCH}.AppImage" env -u GITHUB_TOKEN PATH="/work/wsjtx-build/appimage-tools:$PATH" \ - "$ARMHF_QEMU_EXECUTABLE" \ ./linuxdeploy.AppImage --appimage-extract-and-run \ --appdir AppDir \ --plugin qt \ @@ -124,7 +115,7 @@ file "$OUTPUT" echo "::endgroup::" echo "::group::Validate AppImage payload" -"$ARMHF_QEMU_EXECUTABLE" ./"$OUTPUT" --appimage-extract >/dev/null +./"$OUTPUT" --appimage-extract >/dev/null validate_linux_application_tree squashfs-root appimage "$ARCH" rm -rf /work/squashfs-root echo "::endgroup::" @@ -134,4 +125,26 @@ run_packaged_appimage_startup_smoke \ "./$OUTPUT" wsjtx-build/appimage-startup-smoke.log echo "::endgroup::" +echo "::group::Package release tarballs" +PATH="/work/wsjtx-build/appimage-tools:$PATH" .github/scripts/package-cli-tools.sh \ + --platform linux \ + --version "$VERSION" \ + --arch "$ARCH" \ + --groups CMake/release-tarballs.txt \ + --source wsjtx-build \ + --linuxdeploy /work/linuxdeploy.AppImage \ + --out release-tarballs +echo "::endgroup::" + +# LD_LIBRARY_PATH, exported above, would hide a GCC runtime library missing +# from a tarball; the smoke test unsets it for every program it runs. +echo "::group::Smoke-test release tarballs" +.github/scripts/smoke-release-tarballs.sh \ + --platform linux \ + --version "$VERSION" \ + --target "linux-$ARCH" \ + --groups CMake/release-tarballs.txt \ + --dir release-tarballs +echo "::endgroup::" + echo "ARMHF package phase complete for version=$VERSION" diff --git a/.github/scripts/release-linux-images.py b/.github/scripts/release-linux-images.py new file mode 100644 index 00000000..260617ed --- /dev/null +++ b/.github/scripts/release-linux-images.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python3 +"""Prepare and validate the Linux dependency selection committed with a release.""" +import argparse +import hashlib +import json +import os +from pathlib import Path +import re +import subprocess +import sys +from urllib.parse import urlencode +from urllib.request import Request, urlopen + +PUBLIC = "ghcr.io/wsjtx/wsjtx" +PRIVATE = "ghcr.io/wsjtx/wsjtx-internal" +IMAGES = { + "x86_64": ("linux-noble", "normal-noble", "linux/amd64", "normal", "x86_64"), + "aarch64": ("linux-arm64-bookworm", "normal-bookworm", "linux/arm64", "normal", "aarch64"), + "armhf_cross": ("linux-armhf-cross-bookworm", "armhf-cross-bookworm", "linux/amd64", "cross-builder", "armhf"), + "armhf_runtime": ("linux-armv7-bookworm", "armhf-runtime-bookworm", "linux/arm/v7", "runtime", "armhf"), +} +DIGEST = re.compile(r"sha256:[0-9a-f]{64}\Z") +GENERATION = re.compile(r"validated-build-[0-9]{8}-[0-9]+-[0-9]+\Z") + + +def run(args, **kwargs): + return subprocess.run(args, check=True, text=True, capture_output=True, **kwargs).stdout.strip() + + +def fingerprint(profile): + return run(["bash", ".github/scripts/linux-ci-image-fingerprint.sh", profile]) + + +def inspect(reference, anonymous=False, missing_ok=False): + command = ["skopeo", "inspect"] + if anonymous: + command += ["--no-creds"] + command += ["--raw", "docker://" + reference] + try: + manifest = subprocess.run(command, check=True, capture_output=True).stdout + except subprocess.CalledProcessError as error: + # Authentication, transport and server errors must not authorize an overwrite. + if missing_ok and b"manifest unknown" in error.stderr.lower(): + return None + raise + return "sha256:" + hashlib.sha256(manifest).hexdigest() + + +def anonymous_digest(reference): + repository, digest = reference.removeprefix("ghcr.io/").split("@", 1) + query = urlencode({"service": "ghcr.io", "scope": f"repository:{repository}:pull"}) + with urlopen("https://ghcr.io/token?" + query, timeout=30) as response: + token = json.load(response)["token"] + request = Request(f"https://ghcr.io/v2/{repository}/manifests/{digest}", headers={ + "Authorization": f"Bearer {token}", + "Accept": ", ".join(("application/vnd.oci.image.manifest.v1+json", + "application/vnd.oci.image.index.v1+json", + "application/vnd.docker.distribution.manifest.v2+json", + "application/vnd.docker.distribution.manifest.list.v2+json")), + }) + with urlopen(request, timeout=30) as response: + return "sha256:" + hashlib.sha256(response.read()).hexdigest() + + +def validate(lock, check_remote=False): + if not isinstance(lock, dict) or lock.get("schema") != 1: + raise ValueError("Unsupported Linux image selection schema") + if not isinstance(lock.get("generation"), str) or not GENERATION.fullmatch(lock["generation"]): + raise ValueError("Select an explicit validated-build generation") + if not isinstance(lock.get("images"), dict) or set(lock["images"]) != set(IMAGES): + raise ValueError("Linux image selection must contain all four release images") + for key, (package, profile, *_rest) in IMAGES.items(): + image = lock["images"][key] + if not isinstance(image, dict): + raise ValueError(f"Malformed image selection: {key}") + reference = image.get("reference", "") + prefix = f"{PUBLIC}/{package}@" + if not isinstance(reference, str) or not reference.startswith(prefix) or not DIGEST.fullmatch(reference[len(prefix):]): + raise ValueError(f"Expected public digest-pinned image: {key}") + if image.get("recipe_sha256") != fingerprint(profile): + raise ValueError(f"Stale recipe for {key}; refresh and prepare the dependency images") + if check_remote and anonymous_digest(reference) != reference.split("@", 1)[1]: + raise ValueError(f"Public image digest mismatch: {key}") + return lock + + +def provenance(lock_path): + lock = validate(json.loads(Path(lock_path).read_text())) + return { + "lock_sha256": hashlib.sha256(Path(lock_path).read_bytes()).hexdigest(), + "builders": {key: image["reference"].split("@", 1)[1] for key, image in lock["images"].items()}, + } + + +def image_manifest(reference, spec, recipe, generation): + _package, _profile, platform, role, arch = spec + root = str(Path.cwd()) + helper = "verify-linux-ci-image.sh" if role == "normal" else "verify-armhf-ci-image.sh" + hamlib = run(["bash", "-c", '. .github/scripts/linux-ci-image-config.sh; printf "%s" "$LINUX_HAMLIB_REF"']) + command = ["docker", "run", "--rm", "--platform", platform, "--network", "none", + "--mount", f"type=bind,source={root},target=/source,readonly", "--workdir", "/source", + "-e", f"IMAGE_RECIPE_SHA256={recipe}", reference] + run(command + ["bash", f".github/scripts/{helper}", role, arch, hamlib]) + raw = run(command + ["cat", "/opt/wsjtx-ci/image.env"]) + manifest = dict(line.split("=", 1) for line in raw.splitlines() if "=" in line) + if manifest.get("generation") != generation.removeprefix("validated-"): + raise ValueError(f"Image generation mismatch: {reference}") + return manifest + + +def prepare(generation): + if not GENERATION.fullmatch(generation): + raise ValueError("Select an explicit validated-build generation") + lock = {"schema": 1, "generation": generation, "images": {}} + sources = {} + manifests = {} + # Freeze the entire cohort before downloading or copying any image. + for key, spec in IMAGES.items(): + package, profile, *_rest = spec + source = f"{PRIVATE}/{package}" + digest = inspect(f"{source}:{generation}") + sources[key] = f"{source}@{digest}" + lock["images"][key] = {"reference": f"{PUBLIC}/{package}@{digest}", "recipe_sha256": fingerprint(profile)} + for key, spec in IMAGES.items(): + manifests[key] = image_manifest(sources[key], spec, lock["images"][key]["recipe_sha256"], generation) + cross, runtime = manifests["armhf_cross"], manifests["armhf_runtime"] + for field in ("generation", "recipe_sha256", "toolchain_id"): + if not cross.get(field) or runtime.get("cross_" + field) != cross[field]: + raise ValueError(f"ARMHF image pair mismatch: {field}") + if not cross.get("runtime_sha256") or runtime.get("runtime_sha256") != cross["runtime_sha256"]: + raise ValueError("ARMHF image pair mismatch: runtime_sha256") + for key, spec in IMAGES.items(): + destination = f"{PUBLIC}/{spec[0]}:release-deps-{generation}" + digest = sources[key].split("@", 1)[1] + existing = inspect(destination, missing_ok=True) + if existing is not None and existing != digest: + raise ValueError(f"Conflicting retained image tag: {destination}") + if existing is None: + run(["skopeo", "copy", "--all", "--preserve-digests", "docker://" + sources[key], "docker://" + destination]) + if inspect(destination, anonymous=True) != digest: + raise ValueError(f"Public image digest mismatch: {destination}") + validate(lock, check_remote=True) + return lock, manifests + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + commands = parser.add_subparsers(dest="command", required=True) + check = commands.add_parser("validate") + check.add_argument("lock") + check.add_argument("--check-remote", action="store_true") + check.add_argument("--github-output") + binding = commands.add_parser("provenance") + binding.add_argument("lock") + verify = commands.add_parser("verify-provenance") + verify.add_argument("lock") + verify.add_argument("provenance") + preparation = commands.add_parser("prepare") + preparation.add_argument("generation") + preparation.add_argument("--output-directory", required=True) + args = parser.parse_args() + if args.command == "prepare": + output = Path(args.output_directory) + if output.exists(): + raise ValueError("Preparation output directory must not already exist") + lock, manifests = prepare(args.generation) + output.mkdir(parents=True) + (output / "release-linux-images.json").write_text(json.dumps(lock, indent=2) + "\n") + record = {"source_sha": run(["git", "rev-parse", "HEAD"]), "run_url": os.environ.get("PREPARATION_RUN_URL"), "manifests": manifests} + (output / "preparation-record.json").write_text(json.dumps(record, indent=2) + "\n") + elif args.command == "provenance": + print(json.dumps(provenance(args.lock))) + elif args.command == "verify-provenance": + if json.loads(Path(args.provenance).read_text()).get("linux_images") != provenance(args.lock): + raise ValueError("Candidate Linux image provenance does not match the committed selection") + else: + lock = validate(json.loads(Path(args.lock).read_text()), args.check_remote) + bound = provenance(args.lock) + outputs = {"image_tag": lock["generation"], "lock_sha256": bound["lock_sha256"]} + for key, digest in bound["builders"].items(): + outputs[("armhf" if key == "armhf_runtime" else key) + "_digest"] = digest + if args.github_output: + with open(args.github_output, "a") as target: + target.write("".join(f"{key}={value}\n" for key, value in outputs.items())) + if os.environ.get("GITHUB_STEP_SUMMARY"): + with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as summary: + summary.write("## Linux release dependencies\n\n") + summary.write(f"Generation: `{lock['generation']}`. All recipe fingerprints match.\n\n") + for key, image in lock["images"].items(): + summary.write(f"- {key}: `{image['reference']}`\n") + print(json.dumps(bound)) + + +if __name__ == "__main__": + try: + main() + except (ValueError, OSError, subprocess.CalledProcessError) as error: + detail = error.stderr if isinstance(error, subprocess.CalledProcessError) else str(error) + if isinstance(detail, bytes): + detail = detail.decode("utf-8", errors="replace") + print(f"Linux release dependencies: {detail}", file=sys.stderr) + sys.exit(1) diff --git a/.github/scripts/release-policy.py b/.github/scripts/release-policy.py index ec7abe09..b2e160ce 100644 --- a/.github/scripts/release-policy.py +++ b/.github/scripts/release-policy.py @@ -7,33 +7,381 @@ import argparse import hashlib import json import re +import subprocess import sys import tarfile import zipfile +from collections.abc import Callable from pathlib import Path -VERSION_RE = re.compile(r"^(?P\d+\.\d+\.\d+)(?:-rc(?P[1-9]\d*))?$") +VERSION_RE = re.compile(r"^(?P\d+\.\d+\.\d+)(?:-(?P