From 40f1ea388843884f7f5af5f16abd10adc14e509b Mon Sep 17 00:00:00 2001 From: Evgenii Kliuchnikov Date: Tue, 12 Sep 2023 06:18:15 -0700 Subject: [PATCH] upload full testdata archive PiperOrigin-RevId: 564700547 --- .github/workflows/build_test.yml | 2 +- .github/workflows/release.yaml | 24 ++++++++++++++++++++++++ CMakeLists.txt | 6 ++++++ scripts/download_testdata.sh | 6 ++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 scripts/download_testdata.sh diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 91668d3e2..0bb2d94bc 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -385,7 +385,7 @@ jobs: - name: Configure and Build run: | cd archive - cmake -B out . + cmake -B out . -DBROTLI_DOWNLOAD_TESTDATA=ON cmake --build out - name: Test diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 00b2b33d3..3d4d6dbf7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -119,4 +119,28 @@ jobs: uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 with: files: brotli-${{matrix.triplet}}.zip + + testdata_upload: + name: Upload testdata + runs-on: 'ubuntu-latest' + defaults: + run: + shell: bash + steps: + + - name: Checkout the source + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + submodules: false + fetch-depth: 1 + + - name: Compress testdata + run: | + tar cvfJ testdata.txz tests/testdata + + - name: Upload archive to release + if: (github.event_name == 'release') || true + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 + with: + files: testdata.txz tag_name: dev/null diff --git a/CMakeLists.txt b/CMakeLists.txt index 24002304d..a3ce5d8ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ cmake_policy(SET CMP0048 NEW) project(brotli C) option(BUILD_SHARED_LIBS "Build shared libraries" ON) +option(BUILD_DISABLE_TESTS "Disable tests" OFF) +option(BUILD_DOWNLOAD_TESTDATA "Download full testdata" OFF) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to Release as none was specified.") @@ -233,6 +235,10 @@ if(NOT BROTLI_DISABLE_TESTS) include(CTest) enable_testing() + if(BROTLI_DOWNLOAD_TESTDATA) + add_custom_target(download_testdata scripts/download_testdata.sh) + endif() + set(ROUNDTRIP_INPUTS tests/testdata/alice29.txt tests/testdata/asyoulik.txt diff --git a/scripts/download_testdata.sh b/scripts/download_testdata.sh new file mode 100644 index 000000000..5edf9a960 --- /dev/null +++ b/scripts/download_testdata.sh @@ -0,0 +1,6 @@ +#!/bin/bash +TAG=`git describe --tags --abbrev=0` +TAG="${TAG//'/'/%2F}" # Escaping for tag names with slash (e.g. "dev/null") +ARCHIVE=testdata.txz +curl https://github.com/google/brotli/releases/download/${TAG}/${ARCHIVE} --output ${ARCHIVE} +tar xvfJ ${ARCHIVE}