From 6e3ff5f7e837c0aa2affb23966ded375628e100f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 24 Mar 2021 15:45:16 +0300 Subject: project.ci: change build directory It's now /../build for consistency. --- .github/workflows/ci_appveyor.yml | 5 +---- .github/workflows/ci_github.yml | 2 +- .github/workflows/ci_travis.yml | 2 +- README.md | 18 +++++++++--------- project/ci/dirs.py | 14 ++------------ 5 files changed, 14 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci_appveyor.yml b/.github/workflows/ci_appveyor.yml index be48ba0..da12953 100644 --- a/.github/workflows/ci_appveyor.yml +++ b/.github/workflows/ci_appveyor.yml @@ -45,9 +45,6 @@ jobs: with: python-version: '3.x' - - name: Create C:\projects - run: mkdir C:\projects - - name: Cache Boost uses: actions/cache@v2.1.4 with: @@ -62,7 +59,7 @@ jobs: - name: Run example project run: | - cd C:\projects\install\bin + cd "$env:APPVEYOR_BUILD_FOLDER/../build/install/bin" $foo_path = Join-Path (Get-Location).Path foo.exe $relative = 'test.txt' diff --git a/.github/workflows/ci_github.yml b/.github/workflows/ci_github.yml index 877e885..91b1c96 100644 --- a/.github/workflows/ci_github.yml +++ b/.github/workflows/ci_github.yml @@ -59,7 +59,7 @@ jobs: - name: Run example project run: | - cd (Join-Path $env:GITHUB_WORKSPACE .. install bin) + cd "$env:GITHUB_WORKSPACE/../build/install/bin" $foo_path = Join-Path (Get-Location).Path foo if ('${{ runner.os }}' -eq 'Windows') { $foo_path += '.exe' diff --git a/.github/workflows/ci_travis.yml b/.github/workflows/ci_travis.yml index 32123a6..c585f57 100644 --- a/.github/workflows/ci_travis.yml +++ b/.github/workflows/ci_travis.yml @@ -56,7 +56,7 @@ jobs: - name: Run example project run: | - cd "$env:HOME/install/bin" + cd "$env:TRAVIS_BUILD_DIR/../build/install/bin" $foo_path = Join-Path (Get-Location).Path foo $relative = 'test.txt' diff --git a/README.md b/README.md index 8362c8a..2de686f 100644 --- a/README.md +++ b/README.md @@ -87,15 +87,15 @@ and CMake projects on multiple CI systems. They work by calling the generic scripts from above, auto-filling some parameters from environment variables. -| | Travis | AppVeyor | GitHub Actions -| ----------------- | ---------------- | --------------------- | ---------------------------- -| `--toolset` | `$toolset` | `$toolset` | `$toolset` -| `--platform` | `$platform` | `$PLATFORM` | `$platform` -| `--configuration` | `$configuration` | `$CONFIGURATION` | `$configuration` -| Boost version | `$boost_version` | `$boost_version` | `$boost_version` -| Boost path | `$HOME/boost/` | `C:\projects\boost` | `$RUNNER_WORKSPACE/boost/` -| Build path | `$HOME/build/` | `C:\projects\build` | `$RUNNER_WORKSPACE/build/` -| Install path | `$HOME/install/` | `C:\projects\install` | `$RUNNER_WORKSPACE/install/` +| | Travis | AppVeyor | GitHub Actions +| ----------------- | ------------------------------------ | ------------------------------------------ | ------------------------------------ +| `--toolset` | `$toolset` | `%toolset%` | `$toolset` +| `--platform` | `$platform` | `%PLATFORM%` | `$platform` +| `--configuration` | `$configuration` | `%CONFIGURATION%` | `$configuration` +| Boost version | `$boost_version` | `%boost_version%` | `$boost_version` +| Boost path | `$TRAVIS_BUILD_DIR/../build/boost` | `%APPVEYOR_BUILD_FOLDER%\..\build\boost` | `$GITHUB_WORKSPACE/../build/boost` +| Build path | `$TRAVIS_BUILD_DIR/../build/cmake` | `%APPVEYOR_BUILD_FOLDER%\..\build\cmake` | `$GITHUB_WORKSPACE/../build/cmake` +| Install path | `$TRAVIS_BUILD_DIR/../build/install` | `%APPVEYOR_BUILD_FOLDER%\..\build\install` | `$GITHUB_WORKSPACE/../build/install` For example, the following Travis workflow: diff --git a/project/ci/dirs.py b/project/ci/dirs.py index 946a315..6513455 100644 --- a/project/ci/dirs.py +++ b/project/ci/dirs.py @@ -56,9 +56,8 @@ class Dirs(abc.ABC): def get_src_dir(self): pass - @abc.abstractmethod def get_build_dir(self): - pass + return os.path.join(os.path.dirname(self.get_src_dir()), 'build') @abc.abstractmethod def get_prebuilt_boost_dir(self): @@ -71,7 +70,7 @@ class Dirs(abc.ABC): return os.path.join(self.get_build_dir(), 'boost') def get_cmake_dir(self): - return os.path.join(self.get_build_dir(), 'build') + return os.path.join(self.get_build_dir(), 'cmake') def get_install_dir(self): return os.path.join(self.get_build_dir(), 'install') @@ -120,9 +119,6 @@ class Travis(Dirs): def get_src_dir(self): return env('TRAVIS_BUILD_DIR') - def get_build_dir(self): - return env('HOME') - def get_prebuilt_boost_dir(self): # Travis doesn't have pre-built Boost (available for installation from # the official Ubuntu repositories though). @@ -149,9 +145,6 @@ class AppVeyor(Dirs): def get_src_dir(self): return env('APPVEYOR_BUILD_FOLDER') - def get_build_dir(self): - return R'C:\projects' - def get_prebuilt_boost_dir(self): return Image.get().get_prebuilt_boost_dir() @@ -176,9 +169,6 @@ class GitHub(Dirs): def get_src_dir(self): return env('GITHUB_WORKSPACE') - def get_build_dir(self): - return os.path.dirname(env('GITHUB_WORKSPACE')) - def get_prebuilt_boost_dir(self): # As of 2021-01-25, Boost 1.72.0 is pre-built (on all images except for # ubuntu-20.04 for some reason). The path is stored in environment -- cgit v1.2.3