Skip to content

Update pre-commit hook pre-commit/pre-commit-hooks to v3.4.0 #835

Update pre-commit hook pre-commit/pre-commit-hooks to v3.4.0

Update pre-commit hook pre-commit/pre-commit-hooks to v3.4.0 #835

Workflow file for this run

name: "Test"
on:
push:
branches: [master]
tags: ["*"]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '43 16 * * 5'
env:
# https://github.com/pypa/pipenv/releases
PIPENV_INSTALL_VERSION: "2023.06.18"
# https://github.com/snyk/cli/releases
SNYK_VERSION: v1.1122.0
# How long to run the executable automated tests
TEST_DURATION_SECONDS: 60
# https://github.com/upx/upx/releases
UPX_VERSION: 4.0.2
jobs:
test:
name: Test
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: '3.11'
cache: 'pipenv'
- name: Enable cache for pre-commit hooks
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Install pipenv
shell: cmd
run: python -m pip install --user pipenv==${{ env.PIPENV_INSTALL_VERSION }}
- name: Initialize virtual environment
shell: cmd
run: pipenv install --deploy --dev --no-site-packages -v
- name: Run pre-commit checks
shell: cmd
run: pipenv run pre-commit run -a
- name: Run tests
shell: cmd
run: pipenv run pytest -v
- name: Build docs
shell: cmd
run: pipenv run make-doc.bat html
- name: Download Snyk CLI
if: ${{ env.SNYK_TOKEN != '' }}
shell: cmd
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: curl -OsL https://github.com/snyk/cli/releases/download/${{ env.SNYK_VERSION }}/snyk-win.exe
- name: Run Snyk CLI
if: ${{ env.SNYK_TOKEN != '' }}
shell: cmd
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: snyk-win monitor --fail-on=all --dev --print-deps --remote-repo-url=https://github.com/${{ github.repository }} --target-reference=${{ github.ref_name }} --file=Pipfile --project-name=${{ github.repository }}
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: '3.11'
cache: 'pipenv'
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Install pipenv
shell: cmd
run: python -m pip install --user pipenv==${{ env.PIPENV_INSTALL_VERSION }}
- name: Initialize virtual environment
shell: cmd
run: pipenv install --deploy --no-site-packages -v
- name: Install UPX
shell: cmd
run: choco install -y upx --version ${{ env.UPX_VERSION }}
- name: Build executable
shell: cmd
env:
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: pipenv run python build.py
- name: Save executable as artifact
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: wahoo-results.exe
path: wahoo-results.exe
if-no-files-found: error
autotest:
name: Autotest
needs: [build]
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- name: Load executable artifact
# https://github.com/actions/download-artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: wahoo-results.exe
- name: Ensure config file does not exist
shell: bash
run: |
[[ ! -e wahoo-results.ini ]]
- name: Run autotest (no config file)
shell: cmd
run: wahoo-results.exe --loglevel=debug --test scripted:${{ env.TEST_DURATION_SECONDS }}
- name: Ensure config file exists
shell: bash
run: |
[[ -e wahoo-results.ini ]]
- name: Run autotest (with config file)
shell: cmd
run: wahoo-results.exe --loglevel=debug --test scripted:${{ env.TEST_DURATION_SECONDS }}
success:
name: Successful CI
needs: [autotest, test]
runs-on: windows-latest
steps:
- name: Success
shell: cmd
run: echo "CI was successful"
release:
name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
needs: [success]
runs-on: windows-latest
permissions:
contents: write
discussions: write
steps:
- name: Download executable as artifact
# https://github.com/actions/download-artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: wahoo-results.exe
- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
# https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
with:
name: Release ${{ github.ref_name }}
draft: true
files: |
wahoo-results.exe