Skip to content

chore(deps): lock file maintenance #486

chore(deps): lock file maintenance

chore(deps): lock file maintenance #486

Workflow file for this run

---
name: test
on:
push:
branches-ignore:
- "coverage"
- "renovate/**"
pull_request:
workflow_dispatch:
inputs:
main_branch:
description: "Main branch for coverage/tmate."
type: string
required: false
default: "main"
main_os:
description: "Main os for coverage/tmate."
type: choice
default: "macos-12"
options:
- "macos-12"
- "ubuntu-latest"
main_py_ver:
description: "Main python version for coverage/tmate."
type: choice
default: "3.9"
options:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
tmate:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate). This is only for main strategy and others will be stopped.'
required: false
default: false
env:
main_branch: ${{ inputs.main_branch || 'main' }}
main_os: ${{ inputs.main_os || 'macos-12' }}
main_py_ver: ${{ inputs.main_py_ver || '3.9' }}
tmate: ${{ inputs.tmate || 'false' }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
install:
strategy:
matrix:
os: [macos-12, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Exit workflow
if: ${{ github.event_name == 'workflow_dispatch' && env.tmate == 'true' }}
run: exit 1
- name: Install test
run: |
curl -o install.sh -fsSL https://raw.github.com/rcmdnk/homebrew-file/install/install.sh
chmod 755 ./install.sh
./install.sh
rm -f install.sh
test:
strategy:
fail-fast: false
matrix:
os: [macos-12, ubuntu-latest]
python-version: ['3.12', '3.11', '3.10', '3.9', '3.8']
permissions:
contents: write
runs-on: ${{ matrix.os }}
steps:
- name: Check is main
id: is_main
run: |
if [ "${{ github.ref }}" = "refs/heads/${{ env.main_branch }}" ] && [ "${{ matrix.os }}" = "${{ env.main_os }}" ] && [ "${{ matrix.python-version }}" = "${{ env.main_py_ver }}" ];then
echo "is_main=1" >> $GITHUB_ENV
is_main=1
else
echo "is_main=0" >> $GITHUB_ENV
is_main=0
fi
if [ "${{ env.tmate }}" = "true" ];then
if [ "$is_main" = 0 ];then
echo "Tmate is enabled and this is not main, skip tests"
exit 1
fi
echo "debug=1" >> $GITHUB_ENV
else
echo "debug=0" >> $GITHUB_ENV
fi
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
test-bot: false
- uses: rcmdnk/python-action@v2
with:
python-version: "${{ matrix.python-version }}"
pytest-cov-path: "bin"
coverage-push: "${{ env.is_main }}"
coverage-push-condition: "branch=${{ env.main_branch }}, os=${{ env.main_os }}, python_version=${{ env.main_py_ver }}"
pre-commit: "1"
tmate: "${{ env.debug }}"