|
| 1 | +name: CMake Build Cabextract |
| 2 | + |
| 3 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 4 | +# events but only for the master branch |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + |
| 13 | +env: |
| 14 | + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 15 | + BUILD_TYPE: Release |
| 16 | + VCPKG_GIT_REF: 8a9a97315aefb3f8bc5d81bf66ca0025938b9c91 |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-windows: |
| 20 | + runs-on: windows-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v1 |
| 24 | + |
| 25 | + - uses: lukka/get-cmake@latest |
| 26 | + |
| 27 | + # Restore from cache the previously built ports. If cache-miss, download, build vcpkg ports. |
| 28 | + - name: Restore vcpkg ports from cache or install vcpkg |
| 29 | + # Download and build vcpkg, without installing any port. If content is cached already, it is a no-op. |
| 30 | + uses: lukka/run-vcpkg@v5 |
| 31 | + id: runvcpkg |
| 32 | + with: |
| 33 | + vcpkgArguments: "libiconv" |
| 34 | + vcpkgGitCommitId: "${{ env.VCPKG_GIT_REF }}" |
| 35 | + vcpkgTriplet: "x64-windows" |
| 36 | + |
| 37 | + - name: Print the VCPKG_ROOT & VCPKG_TRIPLET (for debugging) |
| 38 | + shell: bash |
| 39 | + run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' " |
| 40 | + |
| 41 | + - name: dir the VCPKG_ROOT |
| 42 | + run: dir ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }} |
| 43 | + |
| 44 | + - name: Create Build Directory |
| 45 | + shell: bash |
| 46 | + # Some projects don't allow in-source building, so create a separate build directory |
| 47 | + # We'll use this as our working directory for all subsequent commands |
| 48 | + run: cmake -E make_directory ${{runner.workspace}}/cabextract-build |
| 49 | + |
| 50 | + - name: Run CMake+Ninja with triplet (cmd) |
| 51 | + uses: lukka/run-cmake@main |
| 52 | + id: runcmake_cmd |
| 53 | + with: |
| 54 | + cmakeGenerator: "Ninja" # Visual Studio 15 2017 |
| 55 | + cmakeListsOrSettingsJson: "CMakeListsTxtBasic" |
| 56 | + cmakeListsTxtPath: "${{runner.workspace}}/libmspack/cabextract/CMakeLists.txt" |
| 57 | + useVcpkgToolchainFile: true |
| 58 | + cmakeAppendedArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -- -v' |
| 59 | + cmakeBuildType: "${{ env.BUILD_TYPE }}" |
| 60 | + vcpkgTriplet: ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }} |
| 61 | + buildDirectory: "${{runner.workspace}}/cabextract-build" |
| 62 | + |
| 63 | + - name: Test |
| 64 | + working-directory: ${{runner.workspace}}/cabextract-build |
| 65 | + # Execute tests defined by the CMake configuration. |
| 66 | + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
| 67 | + run: ctest -C ${{ env.BUILD_TYPE }} -V |
| 68 | + |
| 69 | + build-macos: |
| 70 | + runs-on: macos-latest |
| 71 | + |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v1 |
| 74 | + |
| 75 | + - uses: lukka/get-cmake@latest |
| 76 | + |
| 77 | + - name: Create Build Directory |
| 78 | + shell: bash |
| 79 | + # Some projects don't allow in-source building, so create a separate build directory |
| 80 | + # We'll use this as our working directory for all subsequent commands |
| 81 | + run: cmake -E make_directory ${{runner.workspace}}/cabextract-build |
| 82 | + |
| 83 | + - name: Configure CMake |
| 84 | + # Use a bash shell so we can use the same syntax for environment variable |
| 85 | + # access regardless of the host operating system |
| 86 | + working-directory: ${{runner.workspace}}/cabextract-build |
| 87 | + # Note the current convention is to use the -S and -B options here to specify source |
| 88 | + # and build directories, but this is only available with CMake 3.13 and higher. |
| 89 | + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 |
| 90 | + run: |
| 91 | + cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} |
| 92 | + |
| 93 | + - name: Build |
| 94 | + shell: bash |
| 95 | + working-directory: ${{runner.workspace}}/cabextract-build |
| 96 | + # Execute the build. You can specify a specific target with "--target <NAME>" |
| 97 | + run: cmake --build . --config ${{ env.BUILD_TYPE }} |
| 98 | + |
| 99 | + - name: Test |
| 100 | + shell: bash |
| 101 | + working-directory: ${{runner.workspace}}/cabextract-build |
| 102 | + # Execute tests defined by the CMake configuration. |
| 103 | + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
| 104 | + run: ctest -C ${{ env.BUILD_TYPE }} -V |
| 105 | + |
| 106 | + build-ubuntu: |
| 107 | + runs-on: ubuntu-latest |
| 108 | + |
| 109 | + steps: |
| 110 | + - uses: actions/checkout@v1 |
| 111 | + |
| 112 | + - uses: lukka/get-cmake@latest |
| 113 | + |
| 114 | + - name: Create Build Directory |
| 115 | + shell: bash |
| 116 | + # Some projects don't allow in-source building, so create a separate build directory |
| 117 | + # We'll use this as our working directory for all subsequent commands |
| 118 | + run: cmake -E make_directory ${{runner.workspace}}/cabextract-build |
| 119 | + |
| 120 | + - name: Configure CMake |
| 121 | + # Use a bash shell so we can use the same syntax for environment variable |
| 122 | + # access regardless of the host operating system |
| 123 | + working-directory: ${{runner.workspace}}/cabextract-build |
| 124 | + # Note the current convention is to use the -S and -B options here to specify source |
| 125 | + # and build directories, but this is only available with CMake 3.13 and higher. |
| 126 | + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 |
| 127 | + run: |
| 128 | + cmake ${{runner.workspace}}/libmspack/libmspack -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} |
| 129 | + |
| 130 | + - name: Build |
| 131 | + shell: bash |
| 132 | + working-directory: ${{runner.workspace}}/cabextract-build |
| 133 | + # Execute the build. You can specify a specific target with "--target <NAME>" |
| 134 | + run: cmake --build . --config ${{ env.BUILD_TYPE }} |
| 135 | + |
| 136 | + - name: Test |
| 137 | + shell: bash |
| 138 | + working-directory: ${{runner.workspace}}/cabextract-build |
| 139 | + # Execute tests defined by the CMake configuration. |
| 140 | + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
| 141 | + run: ctest -C ${{ env.BUILD_TYPE }} -V |
0 commit comments