|
| 1 | +name: Scalar Functional Tests |
| 2 | + |
| 3 | +env: |
| 4 | + SCALAR_REPOSITORY: derrickstolee/scalar |
| 5 | + SCALAR_REF: test-scalar-in-c |
| 6 | + DEBUG_WITH_TMATE: false |
| 7 | + SCALAR_TEST_SKIP_VSTS_INFO: true |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [ vfs-* ] |
| 12 | + pull_request: |
| 13 | + branches: [ vfs-* ] |
| 14 | + |
| 15 | +jobs: |
| 16 | + scalar: |
| 17 | + name: "Scalar Functional Tests" |
| 18 | + |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + # Order by runtime (in descending order) |
| 23 | + os: [windows-2019, macos-10.15, ubuntu-18.04, ubuntu-20.04] |
| 24 | + # Scalar.NET used to be tested using `features: [false, experimental]` |
| 25 | + # But currently, Scalar/C ignores `feature.scalar` altogether, so let's |
| 26 | + # save some electrons and run only one of them... |
| 27 | + features: [ignored] |
| 28 | + exclude: |
| 29 | + # The built-in FSMonitor is not (yet) supported on Linux |
| 30 | + - os: ubuntu-18.04 |
| 31 | + features: experimental |
| 32 | + - os: ubuntu-20.04 |
| 33 | + features: experimental |
| 34 | + runs-on: ${{ matrix.os }} |
| 35 | + |
| 36 | + env: |
| 37 | + BUILD_FRAGMENT: bin/Release/netcoreapp3.1 |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: Check out Git's source code |
| 41 | + uses: actions/checkout@v2 |
| 42 | + |
| 43 | + - name: Setup build tools on Windows |
| 44 | + if: runner.os == 'Windows' |
| 45 | + uses: git-for-windows/setup-git-for-windows-sdk@v1 |
| 46 | + |
| 47 | + - name: Provide a minimal `install` on Windows |
| 48 | + if: runner.os == 'Windows' |
| 49 | + shell: bash |
| 50 | + run: | |
| 51 | + test -x /usr/bin/install || |
| 52 | + tr % '\t' >/usr/bin/install <<-\EOF |
| 53 | + #!/bin/sh |
| 54 | +
|
| 55 | + cmd=cp |
| 56 | + while test $# != 0 |
| 57 | + do |
| 58 | + %case "$1" in |
| 59 | + %-d) cmd="mkdir -p";; |
| 60 | + %-m) shift;; # ignore mode |
| 61 | + %*) break;; |
| 62 | + %esac |
| 63 | + %shift |
| 64 | + done |
| 65 | +
|
| 66 | + exec $cmd "$@" |
| 67 | + EOF |
| 68 | +
|
| 69 | + - name: Install build dependencies for Git (Linux) |
| 70 | + if: runner.os == 'Linux' |
| 71 | + run: | |
| 72 | + sudo apt-get update |
| 73 | + sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev gettext |
| 74 | +
|
| 75 | + - name: Build and install Git |
| 76 | + shell: bash |
| 77 | + env: |
| 78 | + NO_TCLTK: Yup |
| 79 | + run: | |
| 80 | + # We do require a VFS version |
| 81 | + def_ver="$(sed -n 's/DEF_VER=\(.*vfs.*\)/\1/p' GIT-VERSION-GEN)" |
| 82 | + test -n "$def_ver" |
| 83 | +
|
| 84 | + # Ensure that `git version` reflects DEF_VER |
| 85 | + case "$(git describe --match "v[0-9]*vfs*" HEAD)" in |
| 86 | + ${def_ver%%.vfs.*}.vfs.*) ;; # okay, we can use this |
| 87 | + *) git -c user.name=ci -c user.email=ci@github tag -m for-testing ${def_ver}.NNN.g$(git rev-parse --short HEAD);; |
| 88 | + esac |
| 89 | +
|
| 90 | + SUDO= |
| 91 | + extra= |
| 92 | + case "${{ runner.os }}" in |
| 93 | + Windows) |
| 94 | + extra=DESTDIR=/c/Progra~1/Git |
| 95 | + cygpath -aw "/c/Program Files/Git/cmd" >>$GITHUB_PATH |
| 96 | + ;; |
| 97 | + Linux) |
| 98 | + SUDO=sudo |
| 99 | + extra=prefix=/usr |
| 100 | + ;; |
| 101 | + macOS) |
| 102 | + SUDO=sudo |
| 103 | + extra=prefix=/usr/local |
| 104 | + ;; |
| 105 | + esac |
| 106 | +
|
| 107 | + $SUDO make -j5 INCLUDE_SCALAR=AbsolutelyYes $extra install |
| 108 | +
|
| 109 | + - name: Ensure that we use the built Git and Scalar |
| 110 | + shell: bash |
| 111 | + run: | |
| 112 | + type -p git |
| 113 | + git version |
| 114 | + case "$(git version)" in *.vfs.*) echo Good;; *) exit 1;; esac |
| 115 | + type -p scalar |
| 116 | + scalar version |
| 117 | + case "$(scalar version 2>&1)" in *.vfs.*) echo Good;; *) exit 1;; esac |
| 118 | +
|
| 119 | + - name: Check out Scalar's source code |
| 120 | + uses: actions/checkout@v2 |
| 121 | + with: |
| 122 | + fetch-depth: 0 # Indicate full history so Nerdbank.GitVersioning works. |
| 123 | + path: scalar |
| 124 | + repository: ${{ env.SCALAR_REPOSITORY }} |
| 125 | + ref: ${{ env.SCALAR_REF }} |
| 126 | + |
| 127 | + - name: Setup .NET Core |
| 128 | + uses: actions/setup-dotnet@v1 |
| 129 | + with: |
| 130 | + dotnet-version: 3.1.302 |
| 131 | + |
| 132 | + - name: Install dependencies |
| 133 | + run: dotnet restore |
| 134 | + working-directory: scalar |
| 135 | + env: |
| 136 | + DOTNET_NOLOGO: 1 |
| 137 | + |
| 138 | + - name: Build |
| 139 | + working-directory: scalar |
| 140 | + run: dotnet build --configuration Release --no-restore -p:UseAppHost=true # Force generation of executable on macOS. |
| 141 | + |
| 142 | + - name: Setup platform (Linux) |
| 143 | + if: runner.os == 'Linux' |
| 144 | + run: | |
| 145 | + echo "BUILD_PLATFORM=${{ runner.os }}" >>$GITHUB_ENV |
| 146 | + echo "TRACE2_BASENAME=Trace2.${{ github.run_id }}__${{ github.run_number }}__${{ matrix.os }}__${{ matrix.features }}" >>$GITHUB_ENV |
| 147 | +
|
| 148 | + - name: Setup platform (Mac) |
| 149 | + if: runner.os == 'macOS' |
| 150 | + run: | |
| 151 | + echo 'BUILD_PLATFORM=Mac' >>$GITHUB_ENV |
| 152 | + echo "TRACE2_BASENAME=Trace2.${{ github.run_id }}__${{ github.run_number }}__${{ matrix.os }}__${{ matrix.features }}" >>$GITHUB_ENV |
| 153 | +
|
| 154 | + - name: Setup platform (Windows) |
| 155 | + if: runner.os == 'Windows' |
| 156 | + run: | |
| 157 | + echo "BUILD_PLATFORM=${{ runner.os }}" >>$env:GITHUB_ENV |
| 158 | + echo 'BUILD_FILE_EXT=.exe' >>$env:GITHUB_ENV |
| 159 | + echo "TRACE2_BASENAME=Trace2.${{ github.run_id }}__${{ github.run_number }}__${{ matrix.os }}__${{ matrix.features }}" >>$env:GITHUB_ENV |
| 160 | +
|
| 161 | + - name: Configure feature.scalar |
| 162 | + run: git config --global feature.scalar ${{ matrix.features }} |
| 163 | + |
| 164 | + - id: functional_test |
| 165 | + name: Functional test |
| 166 | + timeout-minutes: 60 |
| 167 | + working-directory: scalar |
| 168 | + shell: bash |
| 169 | + run: | |
| 170 | + export GIT_TRACE2_EVENT="$PWD/$TRACE2_BASENAME/Event" |
| 171 | + export GIT_TRACE2_PERF="$PWD/$TRACE2_BASENAME/Perf" |
| 172 | + export GIT_TRACE2_EVENT_BRIEF=true |
| 173 | + export GIT_TRACE2_PERF_BRIEF=true |
| 174 | + mkdir -p "$TRACE2_BASENAME" |
| 175 | + mkdir -p "$TRACE2_BASENAME/Event" |
| 176 | + mkdir -p "$TRACE2_BASENAME/Perf" |
| 177 | + git version --build-options |
| 178 | + cd ../out |
| 179 | + Scalar.FunctionalTests/$BUILD_FRAGMENT/Scalar.FunctionalTests$BUILD_FILE_EXT --test-scalar-on-path --test-git-on-path --timeout=300000 --full-suite |
| 180 | +
|
| 181 | + - name: Force-stop FSMonitor daemons and Git processes (Windows) |
| 182 | + if: runner.os == 'Windows' && (success() || failure()) |
| 183 | + shell: bash |
| 184 | + run: | |
| 185 | + set -x |
| 186 | + wmic process get CommandLine,ExecutablePath,HandleCount,Name,ParentProcessID,ProcessID |
| 187 | + wmic process where "CommandLine Like '%fsmonitor--daemon %run'" delete |
| 188 | + wmic process where "ExecutablePath Like '%git.exe'" delete |
| 189 | +
|
| 190 | + - id: trace2_zip_unix |
| 191 | + if: runner.os != 'Windows' && ( success() || failure() ) && ( steps.functional_test.conclusion == 'success' || steps.functional_test.conclusion == 'failure' ) |
| 192 | + name: Zip Trace2 Logs (Unix) |
| 193 | + shell: bash |
| 194 | + working-directory: scalar |
| 195 | + run: zip -q -r $TRACE2_BASENAME.zip $TRACE2_BASENAME/ |
| 196 | + |
| 197 | + - id: trace2_zip_windows |
| 198 | + if: runner.os == 'Windows' && ( success() || failure() ) && ( steps.functional_test.conclusion == 'success' || steps.functional_test.conclusion == 'failure' ) |
| 199 | + name: Zip Trace2 Logs (Windows) |
| 200 | + working-directory: scalar |
| 201 | + run: Compress-Archive -DestinationPath ${{ env.TRACE2_BASENAME }}.zip -Path ${{ env.TRACE2_BASENAME }} |
| 202 | + |
| 203 | + - name: Archive Trace2 Logs |
| 204 | + if: ( success() || failure() ) && ( steps.trace2_zip_unix.conclusion == 'success' || steps.trace2_zip_windows.conclusion == 'success' ) |
| 205 | + uses: actions/upload-artifact@v2 |
| 206 | + with: |
| 207 | + name: ${{ env.TRACE2_BASENAME }}.zip |
| 208 | + path: scalar/${{ env.TRACE2_BASENAME }}.zip |
| 209 | + retention-days: 3 |
| 210 | + |
| 211 | + # The GitHub Action `action-tmate` allows developers to connect to the running agent |
| 212 | + # using SSH (it will be a `tmux` session; on Windows agents it will be inside the MSYS2 |
| 213 | + # environment in `C:\msys64`, therefore it can be slightly tricky to interact with |
| 214 | + # Git for Windows, which runs a slightly incompatible MSYS2 runtime). |
| 215 | + - name: action-tmate |
| 216 | + if: env.DEBUG_WITH_TMATE == 'true' && failure() |
| 217 | + uses: mxschmitt/action-tmate@v3 |
| 218 | + with: |
| 219 | + limit-access-to-actor: true |
0 commit comments