From f63811eb002d15fca0b2bb0f122b3815a13ca173 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Tue, 7 Dec 2021 03:21:47 +0900 Subject: [PATCH 01/12] Add test for "" as directory --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d49ad40..9589975f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,8 @@ jobs: wget -P $temp https://github.com/Matts966/alphasql/releases/latest/download/alphasql_linux_x86_64.tar.gz \ && sudo tar -zxvf $temp/alphasql_linux_x86_64.tar.gz -C /usr/local/bin --strip=1 alphadag ./samples/sample + alphadag --output_path=dag.dot ./samples/sample + alphadag --external_required_tables_output_path=dag.dot ./samples/sample osx: From afaa31660d1c11f0e704a5e0fc0756434e13bd08 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Tue, 7 Dec 2021 03:22:12 +0900 Subject: [PATCH 02/12] fix --- alphasql/alphadag.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alphasql/alphadag.cc b/alphasql/alphadag.cc index fc328eed..6491569e 100644 --- a/alphasql/alphadag.cc +++ b/alphasql/alphadag.cc @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) { !std::filesystem::exists(output_path)) { std::filesystem::path parent = std::filesystem::path(output_path).parent_path(); - if (!std::filesystem::is_directory(parent)) { + if (parent != "" && !std::filesystem::is_directory(parent)) { std::filesystem::create_directories(parent); } std::ofstream out(output_path); @@ -274,7 +274,7 @@ int main(int argc, char *argv[]) { std::filesystem::path parent = std::filesystem::path(external_required_tables_output_path) .parent_path(); - if (!std::filesystem::is_directory(parent)) { + if (parent != "" && !std::filesystem::is_directory(parent)) { std::filesystem::create_directories(parent); } std::ofstream out(external_required_tables_output_path); From 0bd773bd903e6532e74a19c4adc457377587b577 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Tue, 7 Dec 2021 04:03:10 +0900 Subject: [PATCH 03/12] Use empty method --- alphasql/alphadag.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alphasql/alphadag.cc b/alphasql/alphadag.cc index 6491569e..1446a488 100644 --- a/alphasql/alphadag.cc +++ b/alphasql/alphadag.cc @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) { !std::filesystem::exists(output_path)) { std::filesystem::path parent = std::filesystem::path(output_path).parent_path(); - if (parent != "" && !std::filesystem::is_directory(parent)) { + if (!parent.empty() && !std::filesystem::is_directory(parent)) { std::filesystem::create_directories(parent); } std::ofstream out(output_path); @@ -274,7 +274,7 @@ int main(int argc, char *argv[]) { std::filesystem::path parent = std::filesystem::path(external_required_tables_output_path) .parent_path(); - if (parent != "" && !std::filesystem::is_directory(parent)) { + if (!parent.empty() && !std::filesystem::is_directory(parent)) { std::filesystem::create_directories(parent); } std::ofstream out(external_required_tables_output_path); From c8232615b88c18303a42b1044e8b5176583ced7a Mon Sep 17 00:00:00 2001 From: Matts966 Date: Thu, 23 Dec 2021 01:48:38 +0900 Subject: [PATCH 04/12] fix --- alphasql/alphadag.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/alphasql/alphadag.cc b/alphasql/alphadag.cc index 1446a488..d3c5fabc 100644 --- a/alphasql/alphadag.cc +++ b/alphasql/alphadag.cc @@ -248,8 +248,14 @@ int main(int argc, char *argv[]) { !std::filesystem::exists(output_path)) { std::filesystem::path parent = std::filesystem::path(output_path).parent_path(); - if (!parent.empty() && !std::filesystem::is_directory(parent)) { - std::filesystem::create_directories(parent); + if (!std::filesystem::is_directory(parent)) { + try { + std::filesystem::create_directories(parent); + } catch (const std::filesystem::filesystem_error &e) { + std::cerr << "Failed to create directory: " << parent << std::endl; + std::cerr << e.what() << std::endl; + std::cerr << "This seems to be the current directory. Skipping..." << std::endl; + } } std::ofstream out(output_path); write_graphviz_dp(out, g, dp); @@ -275,7 +281,13 @@ int main(int argc, char *argv[]) { std::filesystem::path(external_required_tables_output_path) .parent_path(); if (!parent.empty() && !std::filesystem::is_directory(parent)) { - std::filesystem::create_directories(parent); + try { + std::filesystem::create_directories(parent); + } catch (const std::filesystem::filesystem_error &e) { + std::cerr << "Failed to create directory: " << parent << std::endl; + std::cerr << e.what() << std::endl; + std::cerr << "This seems to be the current directory. Skipping..." << std::endl; + } } std::ofstream out(external_required_tables_output_path); for (const auto &required_table : external_required_tables) { From 7301988bbb76b86239d69d3959ec559d738501b1 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Thu, 23 Dec 2021 02:12:33 +0900 Subject: [PATCH 05/12] fix --- alphasql/alphadag.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alphasql/alphadag.cc b/alphasql/alphadag.cc index d3c5fabc..e6aea082 100644 --- a/alphasql/alphadag.cc +++ b/alphasql/alphadag.cc @@ -251,7 +251,7 @@ int main(int argc, char *argv[]) { if (!std::filesystem::is_directory(parent)) { try { std::filesystem::create_directories(parent); - } catch (const std::filesystem::filesystem_error &e) { + } catch (const std::exception &e) { std::cerr << "Failed to create directory: " << parent << std::endl; std::cerr << e.what() << std::endl; std::cerr << "This seems to be the current directory. Skipping..." << std::endl; @@ -280,10 +280,10 @@ int main(int argc, char *argv[]) { std::filesystem::path parent = std::filesystem::path(external_required_tables_output_path) .parent_path(); - if (!parent.empty() && !std::filesystem::is_directory(parent)) { + if (!std::filesystem::is_directory(parent)) { try { std::filesystem::create_directories(parent); - } catch (const std::filesystem::filesystem_error &e) { + } catch (const std::exception &e) { std::cerr << "Failed to create directory: " << parent << std::endl; std::cerr << e.what() << std::endl; std::cerr << "This seems to be the current directory. Skipping..." << std::endl; From 9f199c34b14b2abaceef905a2e4a9650aefc6cd7 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Thu, 23 Dec 2021 02:43:59 +0900 Subject: [PATCH 06/12] fix --- alphasql/alphadag.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alphasql/alphadag.cc b/alphasql/alphadag.cc index e6aea082..bd85319e 100644 --- a/alphasql/alphadag.cc +++ b/alphasql/alphadag.cc @@ -251,7 +251,7 @@ int main(int argc, char *argv[]) { if (!std::filesystem::is_directory(parent)) { try { std::filesystem::create_directories(parent); - } catch (const std::exception &e) { + } catch (const std::filesystem::__cxx11::filesystem_error &e) { std::cerr << "Failed to create directory: " << parent << std::endl; std::cerr << e.what() << std::endl; std::cerr << "This seems to be the current directory. Skipping..." << std::endl; @@ -283,7 +283,7 @@ int main(int argc, char *argv[]) { if (!std::filesystem::is_directory(parent)) { try { std::filesystem::create_directories(parent); - } catch (const std::exception &e) { + } catch (const std::filesystem::__cxx11::filesystem_error &e) { std::cerr << "Failed to create directory: " << parent << std::endl; std::cerr << e.what() << std::endl; std::cerr << "This seems to be the current directory. Skipping..." << std::endl; From 10b658ce521589df9e91cbb6af5ee954b68d27cd Mon Sep 17 00:00:00 2001 From: Matts966 Date: Tue, 28 Dec 2021 23:00:20 +0900 Subject: [PATCH 07/12] fix --- alphasql/alphadag.cc | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/alphasql/alphadag.cc b/alphasql/alphadag.cc index bd85319e..05da6569 100644 --- a/alphasql/alphadag.cc +++ b/alphasql/alphadag.cc @@ -17,6 +17,7 @@ #include "absl/flags/flag.h" #include "alphasql/dag_lib.h" #include +#include #include std::regex DEFAULT_EXCLUDES(".*(.git/.*|.hg/.*|.svn/.*)"); @@ -248,14 +249,10 @@ int main(int argc, char *argv[]) { !std::filesystem::exists(output_path)) { std::filesystem::path parent = std::filesystem::path(output_path).parent_path(); - if (!std::filesystem::is_directory(parent)) { - try { - std::filesystem::create_directories(parent); - } catch (const std::filesystem::__cxx11::filesystem_error &e) { - std::cerr << "Failed to create directory: " << parent << std::endl; - std::cerr << e.what() << std::endl; - std::cerr << "This seems to be the current directory. Skipping..." << std::endl; - } + if (!std::filesystem::is_directory(parent) && parent != "") { + // Ignore error code for empty directory + std::error_code ec; + std::filesystem::create_directories(parent, ec); } std::ofstream out(output_path); write_graphviz_dp(out, g, dp); @@ -281,13 +278,9 @@ int main(int argc, char *argv[]) { std::filesystem::path(external_required_tables_output_path) .parent_path(); if (!std::filesystem::is_directory(parent)) { - try { - std::filesystem::create_directories(parent); - } catch (const std::filesystem::__cxx11::filesystem_error &e) { - std::cerr << "Failed to create directory: " << parent << std::endl; - std::cerr << e.what() << std::endl; - std::cerr << "This seems to be the current directory. Skipping..." << std::endl; - } + // Ignore error code for empty directory + std::error_code ec; + std::filesystem::create_directories(parent, ec); } std::ofstream out(external_required_tables_output_path); for (const auto &required_table : external_required_tables) { From b77a4d30566bad438110df451936d3985ccedc63 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Tue, 28 Dec 2021 23:48:47 +0900 Subject: [PATCH 08/12] fix --- .github/workflows/test.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9589975f..9eb32cc5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,11 +25,7 @@ jobs: --slave /usr/bin/g++ g++ /usr/bin/g++-9 bazelisk build //alphasql/... bazelisk test --test_output=errors //alphasql/... - - name: Test installation - run: | - temp=$(mktemp -d) - wget -P $temp https://github.com/Matts966/alphasql/releases/latest/download/alphasql_linux_x86_64.tar.gz \ - && sudo tar -zxvf $temp/alphasql_linux_x86_64.tar.gz -C /usr/local/bin --strip=1 + alphadag ./samples/sample alphadag --output_path=dag.dot ./samples/sample alphadag --external_required_tables_output_path=dag.dot ./samples/sample @@ -52,10 +48,7 @@ jobs: - name: Test the repository run: | make test - - name: Test installation - shell: bash - run: | - temp=$(mktemp -d) - wget -P $temp https://github.com/Matts966/alphasql/releases/latest/download/alphasql_darwin_x86_64.tar.gz \ - && sudo tar -zxvf $temp/alphasql_darwin_x86_64.tar.gz -C /usr/local/bin --strip=1 + alphadag ./samples/sample + alphadag --output_path=dag.dot ./samples/sample + alphadag --external_required_tables_output_path=dag.dot ./samples/sample From 9fd547b6ad3bc8adf030e729a76e5c37e9a7854c Mon Sep 17 00:00:00 2001 From: Matts966 Date: Wed, 29 Dec 2021 00:17:51 +0900 Subject: [PATCH 09/12] runs-on --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 639e4a2d..6a6c016c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ env: jobs: osx: name: Create artifacts on macOS-latest - runs-on: macOS-latest + runs-on: macos-10.15 steps: - name: Checkout the repository uses: actions/checkout@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9eb32cc5..ce8d6e7d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: osx: name: Test the repository on Mac - runs-on: macOS-latest + runs-on: macos-10.15 steps: - name: Checkout the repository uses: actions/checkout@v2 From d85a9f25bf78a2bbd69fd24c7c5e648506d3b2cf Mon Sep 17 00:00:00 2001 From: Matts966 Date: Wed, 29 Dec 2021 00:53:26 +0900 Subject: [PATCH 10/12] xcode-select && bazel shutdown --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce8d6e7d..1b0a115d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,9 @@ jobs: restore-keys: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build- - name: Test the repository run: | - make test + sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer + bazel shutdown + make alphadag ./samples/sample alphadag --output_path=dag.dot ./samples/sample From a11faaa3cc79f5aaf7ff407df894c56ef98c2a05 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Wed, 29 Dec 2021 01:01:41 +0900 Subject: [PATCH 11/12] Install graphviz --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1b0a115d..f03dd4c8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,6 +47,7 @@ jobs: restore-keys: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build- - name: Test the repository run: | + brew install graphviz sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer bazel shutdown make From d92c41b707b50abda2a36c665f89965c14efa111 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Wed, 29 Dec 2021 02:00:05 +0900 Subject: [PATCH 12/12] fix --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f03dd4c8..a2369110 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,9 +26,9 @@ jobs: bazelisk build //alphasql/... bazelisk test --test_output=errors //alphasql/... - alphadag ./samples/sample - alphadag --output_path=dag.dot ./samples/sample - alphadag --external_required_tables_output_path=dag.dot ./samples/sample + ./bazel-bin/alphasql/alphadag ./samples/sample + ./bazel-bin/alphasql/alphadag --output_path=dag.dot ./samples/sample + ./bazel-bin/alphasql/alphadag --external_required_tables_output_path=dag.dot ./samples/sample osx: