<commit_before>init:
  - echo %PATH%
  # We use a clean PATH to avoid interferences with the hundreds of installed programs.
  - set PATH=c:/Program Files/Git/cmd;c:/ProgramData/chocolatey/bin;c:/Program Files (x86)/Inno Setup 5;c:/Windows/system32;C:/Windows/System32/WindowsPowerShell/v1.0

install:
  - choco install -y InnoSetup
  # Update pacman database.
  - c:/msys64/usr/bin/bash -lc "pacman -Sy --noconfirm"
  # Update ruby dependencies, because the pre-installed are outdated.
  # Keep this in sync with the "depends" list in PKGBUILD files.
  - c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed ${MINGW_PACKAGE_PREFIX}-toolchain ${MINGW_PACKAGE_PREFIX}-gcc-libs ${MINGW_PACKAGE_PREFIX}-gdbm ${MINGW_PACKAGE_PREFIX}-gmp ${MINGW_PACKAGE_PREFIX}-libffi ${MINGW_PACKAGE_PREFIX}-libyaml ${MINGW_PACKAGE_PREFIX}-openssl ${MINGW_PACKAGE_PREFIX}-zlib"

build_script:
  - set PATH=C:/ruby%build_ruby%/bin;%PATH%
  - ruby --version
  - c:/msys64/%MSYSTEM%/bin/gcc.exe --version
  - echo %PATH%

  # Build the installer
  - rake rubyinstaller:ruby-%target_ruby%-%arch%
  ## Reuse installed ruby
  #- c:/msys64/usr/bin/mkdir -p packages/rubybundle/recipes/
  #- c:/msys64/usr/bin/cp -a packages/rubyinstaller/recipes/unpack packages/rubybundle/recipes/
  ## Remove broken pkg files from cache
  #- c:/msys64/usr/bin/rm -f c:/msys64/var/cache/pacman/pkg/{autoconf,automake,bash-completion,ca-certificates}*
  ## Build the rubybundle installer
  #- rake rubybundle:ruby-%target_ruby%-%arch%

test_script:
  # Run the built Ruby installer and install to c:/ri2-ruby
  - ruby -e "Dir['packages/rubyinstaller/recipes/installer-inno/rubyinstaller-%target_ruby%-*-%arch%.exe'].each{|f| system(f, '/verysilent', '/dir=c:/ri2-ruby', '/tasks=assocfiles,modpath,defaultutf8')}"
  # Activate the environment variables set by the installer, but exclude
  # git's /usr/bin, because it conflicts with one RubyInstaller test.
  - ps: $env:PATH = [Environment]::GetEnvironmentVariable("PATH","Machine") -replace ";C:\\Program Files\\Git\\usr\\bin" -replace ";C:\\Ruby193\\bin"
  - ps: $env:RUBYOPT = [Environment]::GetEnvironmentVariable("RUBYOPT","Machine")
  - echo %PATH%
  - echo %RUBYOPT%
  - ridk version
  # Install dependent gems
  - IF "%target_ruby%" LSS "2.5" ( gem install bundler )
  - bundle install
  # Run all tests against the new installed Ruby
  - rake test
  # Verify that the used CA list is still the latest.
  - rake ssl:update_check

  # Run the Ruby Spec Suite
  - git clone https://github.com/ruby/mspec
  - git clone https://github.com/ruby/spec
  - ridk exec ruby -C spec ../mspec/bin/mspec -j --exclude "BasicObject#instance_eval evaluates string with given filename and negative linenumber"

  # Run upload to github only on tag builds
  - set DEPLOY_TAG=%APPVEYOR_REPO_TAG_NAME%
  - IF DEFINED DEPLOY_TAG (
    echo.%DEPLOY_TAG% | findstr /C:"%target_ruby%">nul && (
      echo Upload %DEPLOY_TAG% &
      ridk enable &&
      c:/msys64/usr/bin/mkdir -p /home/appveyor/.gnupg &&
      gpg --passphrase %GPGPASSWD% --decrypt appveyor-key.asc.asc | gpg --import &&
      c:/msys64/usr/bin/mkdir artifacts &&
      cp -v packages/rubyinstaller/recipes/installer-inno/%DEPLOY_TAG%-%arch%.exe packages/rubyinstaller/recipes/archive-7z/%DEPLOY_TAG%-%arch%.7z artifacts/ &&
      ls artifacts/* | xargs -n1 gpg --verbose --detach-sign --armor &&
      rake release:upload -- artifacts/* || ( exit 1 ) )
    ) || ( ruby -e "puts 'No release upload'" )

# Provide the rubyinstaller.exe files for download
artifacts:
  - path: packages/rubyinstaller/recipes/installer-inno/ruby*-$(target_ruby)-*-$(arch).exe
    name: Executable installer
  - path: packages/rubyinstaller/recipes/archive-7z/ruby*-$(target_ruby)-*-$(arch).7z
    name: Plain archive file
  - path: packages/rubybundle/recipes/installer-inno/ruby*-$(target_ruby)-*-$(arch).exe
    name: Executable installer with MYS2
  - path: packages/rubybundle/recipes/archive-7z/ruby*-$(target_ruby)-*-$(arch).7z
    name: Plain archive file with MYS2

environment:
  GPGPASSWD:
    secure: <KEY>
  DEPLOY_REPO_NAME: oneclick/rubyinstaller2
  DEPLOY_TOKEN:
    secure: <KEY>
  matrix:
    - target_ruby: "2.5.0"
      arch: "x86"
      build_ruby: "24"
      MINGW_PACKAGE_PREFIX: "mingw-w64-i686"
      MSYSTEM: "MINGW32"

    - target_ruby: "2.5.0"
      arch: "x64"
      build_ruby: "24"
      MINGW_PACKAGE_PREFIX: "mingw-w64-x86_64"
      MSYSTEM: "MINGW64"

    - target_ruby: "2.5.0.rc1"
      arch: "x86"
      build_ruby: "24"
      MINGW_PACKAGE_PREFIX: "mingw-w64-i686"
      MSYSTEM: "MINGW32"

    - target_ruby: "2.5.0.rc1"
      arch: "x64"
      build_ruby: "24"
      MINGW_PACKAGE_PREFIX: "mingw-w64-x86_64"
      MSYSTEM: "MINGW64"

    - target_ruby: "2.4.3"
      arch: "x86"
      build_ruby: "22"
      MINGW_PACKAGE_PREFIX: "mingw-w64-i686"
      MSYSTEM: "MINGW32"

    - target_ruby: "2.4.3"
      arch: "x64"
      build_ruby: "23"
      MINGW_PACKAGE_PREFIX: "mingw-w64-x86_64"
      MSYSTEM: "MINGW64"<commit_msg>Use MRI copy of Ruby Spec for trunk builds<commit_after>init:
  - echo %PATH%
  # We use a clean PATH to avoid interferences with the hundreds of installed programs.
  - set PATH=c:/Program Files/Git/cmd;c:/ProgramData/chocolatey/bin;c:/Program Files (x86)/Inno Setup 5;c:/Windows/system32;C:/Windows/System32/WindowsPowerShell/v1.0

install:
  - choco install -y InnoSetup
  # Update pacman database.
  - c:/msys64/usr/bin/bash -lc "pacman -Sy --noconfirm"
  # Update ruby dependencies, because the pre-installed are outdated.
  # Keep this in sync with the "depends" list in PKGBUILD files.
  - c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed ${MINGW_PACKAGE_PREFIX}-toolchain ${MINGW_PACKAGE_PREFIX}-gcc-libs ${MINGW_PACKAGE_PREFIX}-gdbm ${MINGW_PACKAGE_PREFIX}-gmp ${MINGW_PACKAGE_PREFIX}-libffi ${MINGW_PACKAGE_PREFIX}-libyaml ${MINGW_PACKAGE_PREFIX}-openssl ${MINGW_PACKAGE_PREFIX}-zlib"

build_script:
  - set PATH=C:/ruby%build_ruby%/bin;%PATH%
  - ruby --version
  - c:/msys64/%MSYSTEM%/bin/gcc.exe --version
  - echo %PATH%

  # Build the installer
  - rake rubyinstaller:ruby-%target_ruby%-%arch%
  ## Reuse installed ruby
  #- c:/msys64/usr/bin/mkdir -p packages/rubybundle/recipes/
  #- c:/msys64/usr/bin/cp -a packages/rubyinstaller/recipes/unpack packages/rubybundle/recipes/
  ## Remove broken pkg files from cache
  #- c:/msys64/usr/bin/rm -f c:/msys64/var/cache/pacman/pkg/{autoconf,automake,bash-completion,ca-certificates}*
  ## Build the rubybundle installer
  #- rake rubybundle:ruby-%target_ruby%-%arch%

test_script:
  # Run the built Ruby installer and install to c:/ri2-ruby
  - ruby -e "Dir['packages/rubyinstaller/recipes/installer-inno/rubyinstaller-%target_ruby%-*-%arch%.exe'].each{|f| system(f, '/verysilent', '/dir=c:/ri2-ruby', '/tasks=assocfiles,modpath,defaultutf8')}"
  # Activate the environment variables set by the installer, but exclude
  # git's /usr/bin, because it conflicts with one RubyInstaller test.
  - ps: $env:PATH = [Environment]::GetEnvironmentVariable("PATH","Machine") -replace ";C:\\Program Files\\Git\\usr\\bin" -replace ";C:\\Ruby193\\bin"
  - ps: $env:RUBYOPT = [Environment]::GetEnvironmentVariable("RUBYOPT","Machine")
  - echo %PATH%
  - echo %RUBYOPT%
  - ridk version
  # Install dependent gems
  - IF "%target_ruby%" LSS "2.5" ( gem install bundler )
  - bundle install
  # Run all tests against the new installed Ruby
  - rake test
  # Verify that the used CA list is still the latest.
  - rake ssl:update_check

  # Run the Ruby Spec Suite
  - IF DEFINED run_ruby_spec (
      git clone --depth 1 https://github.com/ruby/mspec &&
      git clone --depth 1 https://github.com/ruby/spec &&
      ridk exec ruby -C spec ../mspec/bin/mspec -j --exclude "BasicObject#instance_eval evaluates string with given filename and negative linenumber"
    )

  # Run the MRI copy of Ruby Spec Suite
  - IF DEFINED run_mri_spec (
      git clone --depth 1 https://github.com/ruby/ruby -b %run_mri_spec% &&
      ridk exec ruby -C ruby/spec/ruby ../mspec/bin/mspec -j --exclude "BasicObject#instance_eval evaluates string with given filename and negative linenumber"
    )

  # Run upload to github only on tag builds
  - set DEPLOY_TAG=%APPVEYOR_REPO_TAG_NAME%
  - IF DEFINED DEPLOY_TAG (
    echo.%DEPLOY_TAG% | findstr /C:"%target_ruby%">nul && (
      echo Upload %DEPLOY_TAG% &
      ridk enable &&
      c:/msys64/usr/bin/mkdir -p /home/appveyor/.gnupg &&
      gpg --passphrase %GPGPASSWD% --decrypt appveyor-key.asc.asc | gpg --import &&
      c:/msys64/usr/bin/mkdir artifacts &&
      cp -v packages/rubyinstaller/recipes/installer-inno/%DEPLOY_TAG%-%arch%.exe packages/rubyinstaller/recipes/archive-7z/%DEPLOY_TAG%-%arch%.7z artifacts/ &&
      ls artifacts/* | xargs -n1 gpg --verbose --detach-sign --armor &&
      rake release:upload -- artifacts/* || ( exit 1 ) )
    ) || ( ruby -e "puts 'No release upload'" )

# Provide the rubyinstaller.exe files for download
artifacts:
  - path: packages/rubyinstaller/recipes/installer-inno/ruby*-$(target_ruby)-*-$(arch).exe
    name: Executable installer
  - path: packages/rubyinstaller/recipes/archive-7z/ruby*-$(target_ruby)-*-$(arch).7z
    name: Plain archive file
  - path: packages/rubybundle/recipes/installer-inno/ruby*-$(target_ruby)-*-$(arch).exe
    name: Executable installer with MYS2
  - path: packages/rubybundle/recipes/archive-7z/ruby*-$(target_ruby)-*-$(arch).7z
    name: Plain archive file with MYS2

environment:
  GPGPASSWD:
    secure: <KEY>
  DEPLOY_REPO_NAME: oneclick/rubyinstaller2
  DEPLOY_TOKEN:
    secure: <KEY>
  matrix:
    - target_ruby: "2.4.3"
      arch: "x86"
      build_ruby: "22"
      MINGW_PACKAGE_PREFIX: "mingw-w64-i686"
      MSYSTEM: "MINGW32"
      run_ruby_spec: true

    - target_ruby: "2.4.3"
      arch: "x64"
      build_ruby: "23"
      MINGW_PACKAGE_PREFIX: "mingw-w64-x86_64"
      MSYSTEM: "MINGW64"
      run_ruby_spec: true

    - target_ruby: "2.5.0"
      arch: "x86"
      build_ruby: "24"
      MINGW_PACKAGE_PREFIX: "mingw-w64-i686"
      MSYSTEM: "MINGW32"
      run_mri_spec: trunk

    - target_ruby: "2.5.0"
      arch: "x64"
      build_ruby: "24"
      MINGW_PACKAGE_PREFIX: "mingw-w64-x86_64"
      MSYSTEM: "MINGW64"
      run_mri_spec: trunk

    - target_ruby: "2.5.0.rc1"
      arch: "x86"
      build_ruby: "24"
      MINGW_PACKAGE_PREFIX: "mingw-w64-i686"
      MSYSTEM: "MINGW32"
      run_mri_spec: v2_5_0_rc1

    - target_ruby: "2.5.0.rc1"
      arch: "x64"
      build_ruby: "24"
      MINGW_PACKAGE_PREFIX: "mingw-w64-x86_64"
      MSYSTEM: "MINGW64"
      run_mri_spec: v2_5_0_rc1
{'fraction_non_alphanumeric': 0.138676484470877, 'fraction_numerical': 0.02652695176059662, 'mean_word_length': 3.332924335378323, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4571413', 'n_tokens_mistral': 4273, 'n_tokens_neox': 3874, 'n_words': 829}