message: Improved sccache random port
diff: @@ -43,7 +43,6 @@ jobs:
  - build: linux
  os: ubuntu-18.04
  rust: 1.47.0
  - target: x86_64-unknown-linux-gnu
  llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/linux-amd64.tar.gz'
  artifact_name: 'wasmer-linux-amd64'
  cross_compilation_artifact_name: 'cross_compiled_from_linux'
  @@ -51,7 +50,6 @@ jobs:
  - build: macos
  os: macos-latest
  rust: 1.47.0
  - target: x86_64-apple-darwin
  llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/darwin-amd64.tar.gz'
  artifact_name: 'wasmer-darwin-amd64'
  cross_compilation_artifact_name: 'cross_compiled_from_mac'
  @@ -70,8 +68,8 @@ jobs:
  run_integration_tests: true
  - build: linux-aarch64
  os: [self-hosted, linux, ARM64]
  + random_sccache_port: true
  rust: 1.47.0
  - target: aarch64-unknown-linux-gnu
  llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/linux-aarch64.tar.gz'
  artifact_name: 'wasmer-linux-aarch64'
  run_integration_tests: false
  @@ -139,12 +137,26 @@ jobs:
  if: matrix.target
  - name: Set sccache port
  run: |
  - echo "SCCACHE_SERVER_PORT=9000" >> $GITHUB_ENV
  - if: matrix.build != 'linux-aarch64'
  + netstat -aln | awk '
  + $6 == "LISTEN" {
  + if ($4 ~ "[.:][0-9]+$") {
  + split($4, a, /[:.]/);
  + port = a[length(a)];
  + p[port] = 1
  + }
  + }
  + END {
  + for (i = 3000; i < 65000 && p[i]; i++){};
  + if (i == 65000) {exit 1};
  + print "SCCACHE_SERVER_PORT=" i
  + }
  + ' >> $GITHUB_ENV
  + # echo "SCCACHE_SERVER_PORT=9000"
  + echo "Setting random sccache port to: $SCCACHE_SERVER_PORT"
  + if: matrix.random_sccache_port
  shell: bash
  - name: Start sccache
  run: |
  - echo "Running sccache on port: $SCCACHE_SERVER_PORT"
  chmod +x ${{ runner.tool_cache }}/cargo-sccache/bin/sccache
  ${{ runner.tool_cache }}/cargo-sccache/bin/sccache --start-server
  ${{ runner.tool_cache }}/cargo-sccache/bin/sccache -s
  