diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml new file mode 100644 index 0000000..f01534e --- /dev/null +++ b/exports/taskfiles/utils/boost.yaml @@ -0,0 +1,184 @@ +version: "3" + +includes: + remote: "remote.yaml" + +set: ["u", "pipefail"] +shopt: ["globstar"] + +tasks: + # Runs the bootstrap.sh generate step in the given source directory. Boost only supports + # in-source generation and building. + # + # @param {string} SOURCE_DIR Project source directory. + # @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. + # @param {string[]} TARGETS Target libraries to build. + # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the generate command. + generate: + internal: true + dir: "{{.SOURCE_DIR}}" + vars: + EXTRA_ARGS: + ref: "default (list) .EXTRA_ARGS" + requires: + vars: ["SOURCE_DIR", "INSTALL_PREFIX", "TARGETS"] + cmds: + - >- + ./bootstrap.sh + --prefix="{{.INSTALL_PREFIX}}" + --exec-prefix="{{.INSTALL_PREFIX}}" + --with-libraries={{(join "," .TARGETS)}} + {{- range .EXTRA_ARGS}} + "{{.}}" + {{- end}} + + # Runs the b2 build step for boost. The caller must have previously called `generate` on + # `SOURCE_DIR` for this task to succeed. + # + # @param {string} SOURCE_DIR Directory containing the boost source. + # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the build command. + # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If + # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the + # default is the number of cores. + build: + internal: true + dir: "{{.SOURCE_DIR}}" + vars: + EXTRA_ARGS: + ref: "default (list) .EXTRA_ARGS" + JOBS: >- + {{default "" .JOBS}} + requires: + vars: ["SOURCE_DIR"] + cmds: + - >- + ./b2 + {{- range .EXTRA_ARGS}} + "{{.}}" + {{- end}} + {{- if .JOBS}} + "-j{{.JOBS}}" + {{- end}} + + # Runs the b2 install step for boost. The caller must have previously called `build` on + # `SOURCE_DIR` for this task to succeed. If `CMAKE_SETTINGS_DIR` is set, a settings file will be + # created in that directory, containing a `boost_ROOT` CMake variable that points to + # `INSTALL_PREFIX`. + # + # @param {string} SOURCE_DIR Directory containing the boost source. + # @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. + # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings + # file should be stored. + # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the install command. + install: + internal: true + dir: "{{.SOURCE_DIR}}" + vars: + EXTRA_ARGS: + ref: "default (list) .EXTRA_ARGS" + INSTALL_PREFIX: >- + {{default "" .INSTALL_PREFIX}} + CMAKE_SETTINGS_DIR: >- + {{default "" .CMAKE_SETTINGS_DIR}} + requires: + vars: ["SOURCE_DIR", "INSTALL_PREFIX"] + cmds: + - >- + ./b2 + install + {{- range .EXTRA_ARGS}} + "{{.}}" + {{- end}} + - | + {{- if .CMAKE_SETTINGS_DIR}} + cat <> "{{.CMAKE_SETTINGS_DIR}}/boost.cmake" + set(Boost_ROOT "{{.INSTALL_PREFIX}}" CACHE PATH "Package root for boost.") + EOF + {{- end}} + # Downloads boost from `URL` and installs boost. + # + # General parameters + # @param {string} [WORK_DIR={{.TASK_DIR}}] Base directory to store the install and src + # directories inside. + # @param {string} [SOURCE_DIR={{.WORK_DIR}}/boost-src] Directory in which to extract the tar + # file. + # + # Download parameters + # @param {string} FILE_SHA256 Content hash to verify the downloaded tar file against. + # @param {string} URL + # + # Boost generate parameters + # @param {string} [INSTALL_PREFIX={{.WORK_DIR}}/boost-install] Path prefix of where the project + # should be installed. + # @param {string[]} [TARGETS] Target libraries to build. + # @param {string[]} [GEN_ARGS] Any additional arguments to pass to the generate command. + # + # Boost build parameters + # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If + # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the + # default is the number of cores. + # @param {string[]} [BUILD_ARGS] Any additional arguments to pass to the build command. + # + # Boost install parameters + # @param {string[]} [INSTALL_ARGS] Any additional arguments to pass to the install command. + # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings + # file should be stored. + download-and-install: + internal: true + label: "{{.TASK}}:{{.URL}}-{{.INSTALL_PREFIX}}" + vars: + # General parameters + WORK_DIR: >- + {{default .TASK_DIR .WORK_DIR}} + SOURCE_DIR: >- + {{default (printf "%s/boost-src" .WORK_DIR) .SOURCE_DIR}} + + # Boost generate parameters + INSTALL_PREFIX: >- + {{default (printf "%s/boost-install" .WORK_DIR) .INSTALL_PREFIX}} + TARGETS: + ref: "default (list) .TARGETS" + GEN_ARGS: + ref: "default (list) .GEN_ARGS" + + # Boost build parameters + BUILD_ARGS: + ref: "default (list) .BUILD_ARGS" + JOBS: >- + {{default "" .JOBS}} + + # Boost install parameters + INSTALL_ARGS: + ref: "default (list) .INSTALL_ARGS" + CMAKE_SETTINGS_DIR: >- + {{default "" .CMAKE_SETTINGS_DIR}} + requires: + vars: ["FILE_SHA256", "URL"] + deps: + - task: "remote:download-and-extract-tar" + vars: + FILE_SHA256: "{{.FILE_SHA256}}" + OUTPUT_DIR: "{{.SOURCE_DIR}}" + URL: "{{.URL}}" + cmds: + - task: "generate" + vars: + SOURCE_DIR: "{{.SOURCE_DIR}}" + INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" + TARGETS: + ref: ".TARGETS" + EXTRA_ARGS: + ref: ".GEN_ARGS" + - task: "build" + vars: + SOURCE_DIR: "{{.SOURCE_DIR}}" + JOBS: "{{.JOBS}}" + EXTRA_ARGS: + ref: ".BUILD_ARGS" + - task: "install" + vars: + SOURCE_DIR: "{{.SOURCE_DIR}}" + INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" + CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}" + EXTRA_ARGS: + ref: ".INSTALL_ARGS" diff --git a/exports/taskfiles/utils/utils.yaml b/exports/taskfiles/utils/utils.yaml index 92520ac..565d87b 100644 --- a/exports/taskfiles/utils/utils.yaml +++ b/exports/taskfiles/utils/utils.yaml @@ -1,6 +1,7 @@ version: "3" includes: + boost: boost.yaml checksum: checksum.yaml cmake: cmake.yaml cpp-lint: cpp-lint.yaml diff --git a/taskfile.yaml b/taskfile.yaml index 0153a0f..1e83d24 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -16,4 +16,4 @@ tasks: test: cmds: - - task: "tests:download-and-extract-zip-basic" + - task: "tests:all" diff --git a/taskfiles/boost/.clang-format b/taskfiles/boost/.clang-format new file mode 100644 index 0000000..8853989 --- /dev/null +++ b/taskfiles/boost/.clang-format @@ -0,0 +1,17 @@ +BasedOnStyle: "InheritParentConfig" + +IncludeCategories: + # NOTE: A header is grouped by first matching regex + # Library headers. Update when adding new libraries. + # NOTE: clang-format retains leading white-space on a line in violation of the YAML spec. + # Ex: + # - Regex: "<(fmt|spdlog)" + # Priority: 3 + - Regex: "^<(boost)" + Priority: 3 + # C system headers + - Regex: "^<.+\\.h>" + Priority: 1 + # C++ standard libraries + - Regex: "^<.+>" + Priority: 2 \ No newline at end of file diff --git a/taskfiles/boost/CMakeLists.txt b/taskfiles/boost/CMakeLists.txt new file mode 100644 index 0000000..fd3e1aa --- /dev/null +++ b/taskfiles/boost/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.22.1) + +project(boost-test LANGUAGES CXX VERSION 0.1.0) + +set(CMAKE_EXPORT_COMPILE_COMMANDS + ON + CACHE BOOL + "Enable/Disable output of compile commands during generation." + FORCE +) + +if(PROJECT_IS_TOP_LEVEL) + # Include dependency settings if the project isn't being included as a subproject. + # NOTE: We mark the file optional because if the user happens to have the dependencies + # installed, this file is not necessary. + include( + "${CMAKE_CURRENT_SOURCE_DIR}/../../build/deps/cmake-settings/all.cmake" + OPTIONAL + ) +endif() + +find_package( + Boost + 1.83 + REQUIRED + COMPONENTS + filesystem + headers + iostreams + process + program_options + regex + system + url +) +if(Boost_FOUND) + message(STATUS "Found Boost ${Boost_VERSION}.") +endif() + +add_executable(boost-test) +target_compile_features(boost-test PRIVATE cxx_std_20) +target_sources(boost-test PRIVATE test_boost.cpp) +target_link_libraries( + boost-test + PRIVATE + Boost::filesystem + Boost::headers + Boost::iostreams + Boost::process + Boost::program_options + Boost::regex + Boost::system + Boost::url +) diff --git a/taskfiles/boost/test_boost.cpp b/taskfiles/boost/test_boost.cpp new file mode 100644 index 0000000..b2eb3ce --- /dev/null +++ b/taskfiles/boost/test_boost.cpp @@ -0,0 +1,163 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: keep +#include +#include +#include +#include + +namespace { +auto parse_args(int argc, char** argv) -> boost::program_options::variables_map { + boost::program_options::options_description desc; + desc.add_options()("help", "Boost task test. Check the string against its size."); + desc.add_options()("input", boost::program_options::value(), "Input string."); + desc.add_options()("size", boost::program_options::value(), "Size of the string."); + boost::program_options::variables_map variables; + boost::program_options::store( + // NOLINTNEXTLINE(misc-include-cleaner) + boost::program_options::parse_command_line(argc, argv, desc), + variables + ); + boost::program_options::notify(variables); + return variables; +} + +auto test_filesystem() -> bool { + boost::filesystem::path const path = boost::filesystem::path(__FILE__); + return path.has_parent_path(); +} + +auto test_iostreams() -> bool { + std::string result; + try { + boost::iostreams::filtering_ostream out{boost::iostreams::back_inserter(result)}; + out << "Hello World!"; + out.flush(); + } catch (std::exception const& e) { + return false; + } + return result == "Hello World!"; +} + +constexpr int cWaitTime = 10; + +auto test_process() -> bool { + try { + boost::asio::io_context io_context; + boost::process::v2::process process{io_context, "/bin/true", {}}; + std::future result = process.async_wait(boost::asio::use_future); + io_context.run_for(std::chrono::milliseconds(cWaitTime)); + if (std::future_status::ready != result.wait_for(std::chrono::milliseconds(cWaitTime))) { + return false; + } + return 0 == result.get(); + } catch (std::exception const& e) { + return false; + } +} + +constexpr std::string_view cRegex = "(\\d{4}[- ]){3}\\d{4}"; +constexpr std::string_view cMatch = "1234-5678 9012-3456"; + +auto test_regex() -> bool { + try { + // NOLINTNEXTLINE(misc-include-cleaner) + boost::regex const e{std::string{cRegex}}; + // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange) + return boost::regex_match(std::string{cMatch}, e); + } catch (std::exception const& e) { + return false; + } +} + +constexpr std::string_view cUrl + = "https://user:pass@example.com:443/path/to/" + "my%2dfile.txt?id=42&name=John%20Doe+Jingleheimer%2DSchmidt#page%20anchor"; + +auto test_url() -> bool { + boost::system::result result = boost::urls::parse_uri(cUrl); + if (result.has_error()) { + return false; + } + boost::urls::url_view const url_view = result.value(); + return "example.com" == url_view.encoded_host_address(); +} + +constexpr int cCmdArgParseErr = 1; +constexpr int cSizeErr = 2; +constexpr int cFileSystemErr = 3; +constexpr int cIoStreamsErr = 4; +constexpr int cProcessErr = 5; +constexpr int cRegexErr = 6; +constexpr int cUrlErr = 7; +} // namespace + +auto main(int argc, char** argv) -> int { + boost::program_options::variables_map const args = parse_args(argc, argv); + + std::string input; + int size = 0; + + try { + if (false == args.contains("input")) { + std::cerr << "Error: Missing input argument.\n"; + return cCmdArgParseErr; + } + input = args["input"].as(); + if (false == args.contains("size")) { + std::cerr << "Error: Missing size argument.\n"; + return cCmdArgParseErr; + } + size = args["size"].as(); + } catch (boost::bad_any_cast const& e) { + std::cerr << "Error: Bad any cast: " << e.what() << "\n"; + return cCmdArgParseErr; + } catch (boost::program_options::error const& e) { + std::cerr << "Error: Program options error: " << e.what() << "\n"; + return cCmdArgParseErr; + } + + if (size != input.size()) { + std::cerr << "Error: Size mismatch. Expected " << input.size() << ", got " << size << ".\n"; + return cSizeErr; + } + + if (false == test_filesystem()) { + return cFileSystemErr; + } + + if (false == test_iostreams()) { + return cIoStreamsErr; + } + + if (false == test_process()) { + return cProcessErr; + } + + if (false == test_regex()) { + return cRegexErr; + } + + if (false == test_url()) { + return cUrlErr; + } + + return 0; +} diff --git a/taskfiles/boost/tests.yaml b/taskfiles/boost/tests.yaml new file mode 100644 index 0000000..f6544bc --- /dev/null +++ b/taskfiles/boost/tests.yaml @@ -0,0 +1,70 @@ +version: "3" + +includes: + utils: "../../exports/taskfiles/utils/utils.yaml" + +vars: + G_BOOST_BUILD_DIR: "{{.ROOT_DIR}}/build" + G_BOOST_DEPS_DIR: "{{.G_BOOST_BUILD_DIR}}/deps" + G_BOOST_DEPS_CMAKE_SETTINGS_DIR: "{{.G_BOOST_DEPS_DIR}}/cmake-settings" + + G_BOOST_TEST_BUILD_DIR: "{{.G_BOOST_BUILD_DIR}}/boost-test" + G_BOOST_TEST_EXECUTABLE: "{{.G_BOOST_TEST_BUILD_DIR}}/boost-test" + +tasks: + test: + internal: true + cmds: + - task: "init" + - task: "utils:cmake:install-deps-and-generate-settings" + vars: + CMAKE_SETTINGS_DIR: "{{.G_BOOST_DEPS_CMAKE_SETTINGS_DIR}}" + DEP_TASK: "install-boost" + - task: "utils:cmake:generate" + vars: + SOURCE_DIR: "{{.TASKFILE_DIR}}" + BUILD_DIR: "{{.G_BOOST_TEST_BUILD_DIR}}" + - task: "utils:cmake:build" + vars: + BUILD_DIR: "{{.G_BOOST_TEST_BUILD_DIR}}" + - task: "run-boost-test" + + clean: + internal: true + cmds: + - "rm -rf {{.G_BOOST_TEST_BUILD_DIR}}" + + init: + internal: true + silent: true + run: "once" + cmds: + - "mkdir -p {{.G_BOOST_TEST_BUILD_DIR}}" + + install-boost: + internal: true + run: "once" + cmds: + - task: "utils:boost:download-and-install" + vars: + WORK_DIR: "{{.G_BOOST_DEPS_DIR}}/boost" + FILE_SHA256: "2128a4c96862b5c0970c1e34d76b1d57e4a1016b80df85ad39667f30b1deba26" + URL: "https://github.com/boostorg/boost/releases/download/boost-1.86.0/\ + boost-1.86.0-b2-nodocs.tar.gz" + CMAKE_SETTINGS_DIR: "{{.G_BOOST_DEPS_CMAKE_SETTINGS_DIR}}" + TARGETS: + - "filesystem" + - "headers" + - "iostreams" + - "process" + - "program_options" + - "regex" + - "system" + - "url" + + run-boost-test: + internal: true + sources: + - "{{.G_BOOST_TEST_EXECUTABLE}}" + cmds: + - "{{.G_BOOST_TEST_EXECUTABLE}} --input 'testtest' --size 8" diff --git a/taskfiles/remote/tests.yaml b/taskfiles/remote/tests.yaml new file mode 100644 index 0000000..59cffa7 --- /dev/null +++ b/taskfiles/remote/tests.yaml @@ -0,0 +1,97 @@ +version: "3" + +includes: + remote: "../../exports/taskfiles/utils/remote.yaml" + +vars: + G_EXTRACTED_ZIP_CODEOWNERS_PATH: "yscope-dev-utils-main/.github/CODEOWNERS" + G_EXTRACTED_ZIP_LICENSE_PATH: "yscope-dev-utils-main/LICENSE" + G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH: >- + yscope-dev-utils-main/.github/PULL_REQUEST_TEMPLATE.md + G_TEST_ZIP_FILE_SHA256: "2c9a21f83484e004c41c28be759451dbdc787190eb044365ba58f7bb846418f6" + G_TEST_ZIP_FILE_URL: "https://github.com/y-scope/yscope-dev-utils/archive/refs/heads/main.zip" + +tasks: + default: + internal: true + cmds: + - task: "download-and-extract-zip-test-basic" + - task: "download-and-extract-zip-test-exclusions" + - task: "download-and-extract-zip-test-inclusions" + + download-and-extract-zip-test-basic: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + cmds: + - task: "download-and-extract-zip-test-cleaner" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "remote:download-and-extract-zip" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + URL: "{{.G_TEST_ZIP_FILE_URL}}" + FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" + + # Test that an expected file exists + - "diff -q '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_LICENSE_PATH}}' '{{.ROOT_DIR}}/LICENSE'" + + # Test that the output files are in the expected locations + - "test -e '{{.OUTPUT_DIR}}.md5'" + - "test -e '{{.OUTPUT_DIR}}.zip'" + + download-and-extract-zip-test-exclusions: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + cmds: + - task: "download-and-extract-zip-test-cleaner" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "remote:download-and-extract-zip" + vars: + EXCLUDE_PATTERNS: + - "*/CODEOWNERS" + - "{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}" + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + URL: "{{.G_TEST_ZIP_FILE_URL}}" + FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" + + # Test that the excluded files don't exist + - "test ! -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_CODEOWNERS_PATH}}'" + - "test ! -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}'" + + # Test that other files do exist + - "test -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_LICENSE_PATH}}'" + + download-and-extract-zip-test-inclusions: + vars: + OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + cmds: + - task: "download-and-extract-zip-test-cleaner" + vars: + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + - task: "remote:download-and-extract-zip" + vars: + INCLUDE_PATTERNS: + - "*/CODEOWNERS" + - "{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}" + OUTPUT_DIR: "{{.OUTPUT_DIR}}" + URL: "{{.G_TEST_ZIP_FILE_URL}}" + FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" + + # Test that only the included files exist + - "test ! -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_LICENSE_PATH}}'" + - "test -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_CODEOWNERS_PATH}}'" + - "test -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}'" + + # Cleans up the files output by download-and-extract-zip (assuming their default paths weren't + # changed). + # + # @param {string} OUTPUT_DIR Output directory passed to download-and-extract-zip. + download-and-extract-zip-test-cleaner: + internal: true + requires: + vars: ["OUTPUT_DIR"] + cmds: + - "rm -rf '{{.OUTPUT_DIR}}'" + - "rm -f '{{.OUTPUT_DIR}}.md5'" + - "rm -f '{{.OUTPUT_DIR}}.zip'" diff --git a/taskfiles/tests.yaml b/taskfiles/tests.yaml index a330305..b979eca 100644 --- a/taskfiles/tests.yaml +++ b/taskfiles/tests.yaml @@ -1,96 +1,20 @@ version: "3" includes: - remote: "../exports/taskfiles/utils/remote.yaml" - -vars: - G_EXTRACTED_ZIP_CODEOWNERS_PATH: "yscope-dev-utils-main/.github/CODEOWNERS" - G_EXTRACTED_ZIP_LICENSE_PATH: "yscope-dev-utils-main/LICENSE" - G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH: >- - yscope-dev-utils-main/.github/PULL_REQUEST_TEMPLATE.md - G_TEST_ZIP_FILE_SHA256: "2c9a21f83484e004c41c28be759451dbdc787190eb044365ba58f7bb846418f6" - G_TEST_ZIP_FILE_URL: "https://github.com/y-scope/yscope-dev-utils/archive/refs/heads/main.zip" + boost: "boost/tests.yaml" + remote: "remote/tests.yaml" tasks: - default: - cmds: - - task: "download-and-extract-zip-test-basic" - - task: "download-and-extract-zip-test-exclusions" - - task: "download-and-extract-zip-test-inclusions" - - download-and-extract-zip-test-basic: - vars: - OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" - cmds: - - task: "download-and-extract-zip-test-cleaner" - vars: - OUTPUT_DIR: "{{.OUTPUT_DIR}}" - - task: "remote:download-and-extract-zip" - vars: - OUTPUT_DIR: "{{.OUTPUT_DIR}}" - URL: "{{.G_TEST_ZIP_FILE_URL}}" - FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" - - # Test that an expected file exists - - "diff -q '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_LICENSE_PATH}}' '{{.ROOT_DIR}}/LICENSE'" - - # Test that the output files are in the expected locations - - "test -e '{{.OUTPUT_DIR}}.md5'" - - "test -e '{{.OUTPUT_DIR}}.zip'" - - download-and-extract-zip-test-exclusions: - vars: - OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + all: + internal: true cmds: - - task: "download-and-extract-zip-test-cleaner" - vars: - OUTPUT_DIR: "{{.OUTPUT_DIR}}" - - task: "remote:download-and-extract-zip" - vars: - EXCLUDE_PATTERNS: - - "*/CODEOWNERS" - - "{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}" - OUTPUT_DIR: "{{.OUTPUT_DIR}}" - URL: "{{.G_TEST_ZIP_FILE_URL}}" - FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" - - # Test that the excluded files don't exist - - "test ! -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_CODEOWNERS_PATH}}'" - - "test ! -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}'" + - task: "boost" + - task: "remote" - # Test that other files do exist - - "test -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_LICENSE_PATH}}'" - - download-and-extract-zip-test-inclusions: - vars: - OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" + boost: cmds: - - task: "download-and-extract-zip-test-cleaner" - vars: - OUTPUT_DIR: "{{.OUTPUT_DIR}}" - - task: "remote:download-and-extract-zip" - vars: - INCLUDE_PATTERNS: - - "*/CODEOWNERS" - - "{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}" - OUTPUT_DIR: "{{.OUTPUT_DIR}}" - URL: "{{.G_TEST_ZIP_FILE_URL}}" - FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" - - # Test that only the included files exist - - "test ! -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_LICENSE_PATH}}'" - - "test -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_CODEOWNERS_PATH}}'" - - "test -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}'" + - task: "boost:test" - # Cleans up the files output by download-and-extract-zip (assuming their default paths weren't - # changed). - # - # @param {string} OUTPUT_DIR Output directory passed to download-and-extract-zip. - download-and-extract-zip-test-cleaner: - internal: true - requires: - vars: ["OUTPUT_DIR"] + remote: cmds: - - "rm -rf '{{.OUTPUT_DIR}}'" - - "rm -f '{{.OUTPUT_DIR}}.md5'" - - "rm -f '{{.OUTPUT_DIR}}.zip'" + - task: "remote:default"