thatsIch/sublime-rainmeter

View on GitHub
appveyor.yml

Summary

Maintainability
Test Coverage
environment:
    global:
        # The package name
        PACKAGE: "Rainmeter"
        SUBLIME_TEXT_VERSION : "3"

matrix:
    fast_finish: true
    allow_failures: 
        - platform: x86
        - platform: x64

# enable for debugging purposes
# init:
#   - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

install:
    # check versions for curling
    # - curl --version
    # - grep --version
    # - head --version
    # - cut --version
    # - xargs --version

    # check github API status
    # - curl -i https://api.github.com/repos/rainmeter/rainmeter/releases

    # install rainmeter
    # we use the github API to determine the latest rainmeter
    # we assume that the first entry is the latest
    # using the API and /releases/latest only results in releases and not pre-releases
    # rainmeter is typically offered as a pre-release

    # requests all releases from rainmeter                              | search for field bdu      | first entry| easier delimiter | 4th col without *        | pass url to curl -L to follow redirect
    # - curl -s https://api.github.com/repos/rainmeter/rainmeter/releases
    # - curl -s https://api.github.com/repos/rainmeter/rainmeter/releases | grep browser_download_url
    # - curl -s https://api.github.com/repos/rainmeter/rainmeter/releases | grep browser_download_url | head -n 1
    # - curl -s https://api.github.com/repos/rainmeter/rainmeter/releases | grep browser_download_url | head -n 1 | sed -e "s/""/*/g"
    # - curl -s https://api.github.com/repos/rainmeter/rainmeter/releases | grep browser_download_url | head -n 1 | sed -e "s/""/*/g" | cut --delimiter="*" -f 4
    - 'curl -s -H "Authorization: token %GITHUB_ACCESS_TOKEN%" https://api.github.com/repos/rainmeter/rainmeter/releases | grep browser_download_url | head -n 1 | sed -e "s/""/*/g" | cut --delimiter="*" -f 4 | xargs curl -o C:\rainmeter-setup.exe -L'

    # the project is installed into C:\projects\sublime-rainmeter via AppVeyor
    # the installer is located in the tests folder since this is used for integration testing
    # this will silently install rainmeter
    # we do not need to handle UAC since it is disabled in workers
    - C:\projects\sublime-rainmeter\tests\rainmeter-installer.exe
    
    # we download the special test environment for sublime text which can run commands from within the VM
    - ps: appveyor DownloadFile "https://raw.githubusercontent.com/randy3k/UnitTesting/master/sbin/appveyor.ps1"
    - ps: .\appveyor.ps1 "bootstrap" -verbose
    # install Package Control
    - ps: .\appveyor.ps1 "install_package_control" -verbose

build: off

test_script:
    - ps: .\appveyor.ps1 "run_tests" -coverage -verbose
    # testing syntax_test files
    # - ps: .\appveyor.ps1 "run_syntax_tests" -verbose

after_test:
    # upgrade to latest pip first
    - python -m pip install --upgrade pip
    - pip install coveralls

    # check if actually copied
    - coverage report
    
    # set via AppVeyor environment token for privacy
    # or use encrypted versions and decrypt it here
    # - bat: set COVERALLS_REPO_TOKEN=XXXX
    # coveralls generally requires the .coverage file to be in the root folder
    # this is already copied for us from the "%appdata%\Roaming\Sublime Text 3\Packages\User\UnitTesting\Rainmeter\coverage" folder
    # - bat: copy "%appdata%\Roaming\Sublime Text 3\Packages\User\UnitTesting\Rainmeter\coverage" .coverage
    - coveralls


    # additional support for codacy
    - pip install codacy-coverage

    # To generate the required coverage XML file, calculate coverage for your project as normal, by running:
    - coverage xml

    # Next, simply run the Codacy reporter. It will find the current commit and send all details to your project dashboard:
    - python-codacy-coverage -r coverage.xml


    # additional support for codeclimate
    - pip install codeclimate-test-reporter==0.2.1
    - codeclimate-test-reporter


    # additional support for codecov
    # no token required for Travis-CI, CircleCI and AppVeyor for public repositories 
    # -X gcov disables gcov input if not needed
    - pip install codecov==2.0.5
    - codecov

    # this needs to be here in after_test and not in on_success because artifacts are collected directly after after_test
    # package application without ps
    - gradlew.bat distribute

    # stop the daemon to cache gradle files later on
    - gradlew.bat --stop

artifacts:
    - path: build\Rainmeter.sublime-package

cache:
    - .gradle -> build.gradle
    - '%userprofile%\.gradle -> build.gradle'

# enable this to block the VM from closing
# on_finish:
#   - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))