<commit_before>name: windows

on:
  pull_request:
    paths:
      - 'src/**'
      - '.github/workflows/windows.yaml'
      - '.github/docker/rez-win-base/**'
      - '.github/docker/rez-win-py/**'
      - '!src/rez/utils/_version.py'
      - '!**.md'
  push:
    paths:
      - 'src/**'
      - '.github/workflows/windows.yaml'
      - '.github/docker/rez-win-base/**'
      - '.github/docker/rez-win-py/**'
      - '!src/rez/utils/_version.py'
      - '!**.md'

jobs:
  check_base_image:
    name: Check for latest base docker image
    runs-on: windows-${{ matrix.os-version }}

    strategy:
      matrix:
        os-version:
          - '2019'

    outputs:
      # boo! https://github.community/t/bug-jobs-output-should-return-a-list-for-a-matrix-job/128626
      image_name_2019: ${{ steps.main.outputs.image_name_2019 }}
      image_exists_2019: ${{ steps.main.outputs.image_exists_2019 }}

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

      - name: Check image exists
        id: main
        run: |
          $ErrorActionPreference = "continue"

          ${gh_user} = ("${{ github.repository }}" -Split '/')[0]

          # base image name on latest commit
          ${rev} = $( `
            git log -n 1 --author-date-order --pretty=format:%H -- `
            .\.github\docker\rez-win-base\ `
          ).SubString(0, 8)

          ${docker_image} = "${gh_user}/rez-win-${{ matrix.os-version }}-base:${rev}"
          Write-Output "::set-output name=image_name_${{ matrix.os-version }}::${docker_image}"

          # log into docker
          '${{ secrets.DOCKERHUB_TOKEN }}' | docker login -u ${gh_user} --password-stdin

          Write-Output "Checking for image ${docker_image}..."
          #$ErrorActionPreference = "Continue"
          #docker manifest inspect ${docker_image}
          /bin/false
          #$ErrorActionPreference = "Stop"

          #if ($LastExitCode -ne 0) {
          #  Write-Output "::set-output name=image_exists_${{ matrix.os-version }}::false"
          #}
          #else {
          #  Write-Output "::set-output name=image_exists_${{ matrix.os-version }}::true"
          #}

  testjob:
    runs-on: ubuntu-latest
    needs: check_base_image
    steps:
      - run: |
          echo "IMAGE NAME IS ${{ needs.check_base_image.outputs.image_name_2019 }}"
          echo "IMAGE EXISTS IS ${{ needs.check_base_image.outputs.image_exists_2019 }}"




#
# 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
#
#jobs:
#  main:
#    runs-on: windows-2019<commit_msg>yeeeah<commit_after>name: windows

on:
  pull_request:
    paths:
      - 'src/**'
      - '.github/workflows/windows.yaml'
      - '.github/docker/rez-win-base/**'
      - '.github/docker/rez-win-py/**'
      - '!src/rez/utils/_version.py'
      - '!**.md'
  push:
    paths:
      - 'src/**'
      - '.github/workflows/windows.yaml'
      - '.github/docker/rez-win-base/**'
      - '.github/docker/rez-win-py/**'
      - '!src/rez/utils/_version.py'
      - '!**.md'

jobs:
  check_base_image:
    name: Check for latest base docker image
    runs-on: windows-${{ matrix.os-version }}

    strategy:
      matrix:
        os-version:
          - '2019'

    outputs:
      # boo! https://github.community/t/bug-jobs-output-should-return-a-list-for-a-matrix-job/128626
      image_name_2019: ${{ steps.main.outputs.image_name_2019 }}
      image_exists_2019: ${{ steps.main.outputs.image_exists_2019 }}

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

      - name: Check image exists
        id: main
        run: |
          $ErrorActionPreference = "continue"

          ${gh_user} = ("${{ github.repository }}" -Split '/')[0]

          # base image name on latest commit
          ${rev} = $( `
            git log -n 1 --author-date-order --pretty=format:%H -- `
            .\.github\docker\rez-win-base\ `
          ).SubString(0, 8)

          ${docker_image} = "${gh_user}/rez-win-${{ matrix.os-version }}-base:${rev}"
          Write-Output "::set-output name=image_name_${{ matrix.os-version }}::${docker_image}"

          # log into docker
          '${{ secrets.DOCKERHUB_TOKEN }}' | docker login -u ${gh_user} --password-stdin

          Write-Output "Checking for image ${docker_image}..."
          #$ErrorActionPreference = "Continue"
          #docker manifest inspect ${docker_image}
          ls fdgfdgfdgfd
          #$ErrorActionPreference = "Stop"

          #if ($LastExitCode -ne 0) {
          #  Write-Output "::set-output name=image_exists_${{ matrix.os-version }}::false"
          #}
          #else {
          #  Write-Output "::set-output name=image_exists_${{ matrix.os-version }}::true"
          #}

  testjob:
    runs-on: ubuntu-latest
    needs: check_base_image
    steps:
      - run: |
          echo "IMAGE NAME IS ${{ needs.check_base_image.outputs.image_name_2019 }}"
          echo "IMAGE EXISTS IS ${{ needs.check_base_image.outputs.image_exists_2019 }}"




#
# 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
#
#jobs:
#  main:
#    runs-on: windows-2019
{'fraction_non_alphanumeric': 0.15691342071257153, 'fraction_numerical': 0.016245154144360348, 'mean_word_length': 2.15, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1659431', 'n_tokens_mistral': 1900, 'n_tokens_neox': 1748, 'n_words': 340}