<commit_before>#
# Picks up docker image from hub.docker.com as repository.
#
# Pulls without login (public repository only).
# Requires username/repository to match the github repository.
# For example: nerdvegas/rez -> User/Repository: nerdvegas
#
# Uses image tagged as **latest** commit revision of any file within:
#  .github/docker/windows/**
#  .github/workflows/windows-docker-image.yaml
#

name: Windows

on:
  # Do not run if Docker image has been updated
  pull_request:
    paths-ignore:
      - '.github/docker/**'
      - '.github/workflows/windows-docker-image.yaml'
  push:
    paths-ignore:
      - '.github/docker/**'
      - '.github/workflows/windows-docker-image.yaml'

jobs:
  main:
    runs-on: windows-2019

    strategy:
      matrix:
        # Needs to match python version of images (see windows-docker-image.yaml)
        python-version:
          - '2.7.17'
          - '3.6.8'
          - '3.7.5'
      fail-fast: false

    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - name: Pull docker image
        run: |
          ${gh_user} = ("${{ github.repository }}" -Split '/')[0]
          ${Env:LAST_DOCKER_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-py\ .\.github\docker\rez-win-base\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
          echo "Pulling rez-win-py:${{ matrix.python-version }}-${Env:LAST_DOCKER_REVISION}"
          docker pull ${gh_user}/rez-win-py:${{ matrix.python-version }}-${Env:LAST_DOCKER_REVISION}

      - name: Run Docker image (installs and tests rez)
        run: |
          ${gh_user} = ("${{ github.repository }}" -Split '/')[0]
          ${Env:LAST_DOCKER_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-py\ .\.github\docker\rez-win-base\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
          docker run --mount type=bind,src=$pwd,dst=C:\checkout,readonly ${gh_user}/rez-win-py:${{ matrix.python-version }}-${Env:LAST_DOCKER_REVISION}<commit_msg>Fall back to nerdvegas Windows Docker Image<commit_after>#
# Picks up docker image from hub.docker.com as repository.
#
# Pulls without login (public repository only).
# Requires username/repository to match the github repository.
# For example: nerdvegas/rez -> User/Repository: nerdvegas
#
# Uses image tagged as **latest** commit revision of any file within:
#  .github/docker/windows/**
#  .github/workflows/windows-docker-image.yaml
#

name: Windows

on:
  # Do not run if Docker image has been updated
  pull_request:
    paths-ignore:
      - '.github/docker/**'
      - '.github/workflows/windows-docker-image.yaml'
  push:
    paths-ignore:
      - '.github/docker/**'
      - '.github/workflows/windows-docker-image.yaml'

jobs:
  main:
    runs-on: windows-2019
    env:
      IMAGE_NAME_FILE: ImageNameFile.txt

    strategy:

      matrix:
        # Needs to match python version of images (see windows-docker-image.yaml)
        python-version:
          - '2.7.17'
          - '3.6.8'
          - '3.7.5'
      fail-fast: false

    steps:

      - name: Checkout
        uses: actions/checkout@v1

      - name: Pull docker image
        run: |
          ${gh_user} = ("${{ github.repository }}" -Split '/')[0]
          ${Env:LAST_DOCKER_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-py\ .\.github\docker\rez-win-base\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
          ${docker_image} = "${gh_user}/rez-win-py:${{ matrix.python-version }}-${Env:LAST_DOCKER_REVISION}"
          Write-Output "Pulling ${docker_image}"
          
          $ErrorActionPreference = "Continue"
          docker pull ${docker_image}
          
          $ErrorActionPreference = "Stop"
          if ($LastExitCode -ne 0) {
            Write-Output "Trying with nerdvegas instead of ${gh_user}."
            ${docker_image} = ${docker_image}.Replace(${gh_user}, "nerdvegas")
            
            Write-Output "Pulling ${docker_image}"
            docker pull ${docker_image}
          }
          
          ${docker_image} > '${{ env.IMAGE_NAME_FILE }}'

      - name: Run Docker image (installs and tests rez)
        run: |
          ${docker_image} = Get-Content '${{ env.IMAGE_NAME_FILE }}'
          Write-Output "Running ${docker_image}..."
          docker run --mount type=bind,src=$pwd,dst=C:\checkout,readonly ${docker_image}
{'fraction_non_alphanumeric': 0.15022321428571428, 'fraction_numerical': 0.009598214285714286, 'mean_word_length': 2.425840978593272, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '494892', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1449, 'n_words': 320}