Skip to content

Update actions/deploy-pages action to v4 #1246

Update actions/deploy-pages action to v4

Update actions/deploy-pages action to v4 #1246

Workflow file for this run

---
name: "Test"
on: # yamllint disable-line rule:truthy
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.11.15"
PYTHON_VERSION: "3.11"
# How long to run the executable automated tests
TEST_DURATION_SECONDS: 60
# https://github.com/upx/upx/releases
UPX_VERSION: "4.2.1"
jobs:
pipenv-cache:
# This job is used to refresh the pipenv cache so that both the test and
# build job can use it.
name: Refresh pipenv cache
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
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 sync --dev --no-site-packages -v
test:
name: Test
runs-on: windows-latest
needs: [pipenv-cache]
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pipenv'
- name: Enable cache for pre-commit hooks
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit|${{ env.pythonLocation }}
pre-commit|
# 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 sync --dev --no-site-packages -v
- name: Run pre-commit checks
shell: cmd
run: pipenv run pre-commit run -a
- name: Run pre-commit gc
shell: cmd
run: pipenv run pre-commit gc
- name: Run tests
shell: cmd
run: pipenv run pytest -v
- name: Build docs
shell: cmd
run: pipenv run mkdocs build --verbose --strict
build:
name: Build
runs-on: windows-latest
needs: [pipenv-cache]
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
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 sync --no-site-packages -v
pipenv clean -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
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
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
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Load executable 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)
timeout-minutes: 3
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)
timeout-minutes: 3
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: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
# Add Scripts directory to the path so that 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 sentry-cli
shell: cmd
run: python -m pip install --user sentry-cli
- name: Download executable as artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: wahoo-results.exe
- name: Create sentry release
shell: cmd
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: wahoo-results
SENTRY_PROJECT: wahoo-results
run: |
sentry-cli releases new --finalize wahoo-results@${{ github.ref_name }}
sentry-cli releases set-commits wahoo-results@${{ github.ref_name }} --commit JohnStrunk/wahoo-results@${{ github.ref_name }}
- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
with:
name: Release ${{ github.ref_name }}
draft: true
files: |
wahoo-results.exe