Skip to content

Commit

Permalink
GHA now allows conditional actions
Browse files Browse the repository at this point in the history
  • Loading branch information
arcivanov committed Nov 6, 2021
1 parent 9cb589c commit 3a1458f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 45 deletions.
77 changes: 33 additions & 44 deletions .github/action.yml
Expand Up @@ -23,50 +23,39 @@ runs:
using: "composite"
steps:
- name: Configure
id: configure
uses: ChristopherHX/conditional@main
with:
if: |
${{ contains(fromJSON(inputs.deploy-on-os), runner.os) &&
contains(fromJSON(inputs.deploy-on-python), inputs.python-version) &&
contains(fromJSON(inputs.deploy-on-branch), github.ref) &&
inputs.with-venv == 'true' }}
step: |
shell: bash
run: |
echo "PYB_EXTRA_ARGS=+upload" >> $GITHUB_ENV
if: |
contains(fromJSON(inputs.deploy-on-os), runner.os) &&
contains(fromJSON(inputs.deploy-on-python), inputs.python-version) &&
contains(fromJSON(inputs.deploy-on-branch), github.ref) &&
inputs.with-venv == 'true'
shell: bash
run: |
echo "PYB_EXTRA_ARGS=+upload" >> $GITHUB_ENV
- name: Build
id: build
uses: ChristopherHX/conditional@main
if: |
!(inputs.with-homebrew == 'true' && runner.os != 'macOS' ||
inputs.with-homebrew == 'true' && runner.os == 'macOS' &&
(inputs.python-version == '3.6' ||
contains(inputs.python-version, '-rc') ||
contains(inputs.python-version, '-b') ||
contains(inputs.python-version, 'pypy-')
)
)
uses: pybuilder/build@master
with:
if: |
${{ !(inputs.with-homebrew == 'true' && runner.os != 'macOS' ||
inputs.with-homebrew == 'true' && runner.os == 'macOS' &&
(inputs.python-version == '3.6' ||
contains(inputs.python-version, '-rc') ||
contains(inputs.python-version, '-b') ||
contains(inputs.python-version, 'pypy-')
)
) }}
step: |
uses: pybuilder/build@master
with:
checkout: 'false'
python-version: '${{ inputs.python-version }}'
homebrew-python: '${{ inputs.with-homebrew }}'
with-venv: '${{ inputs.with-venv }}'
install-pyb: 'false'
pyb-command: $PYTHON build.py
pyb-extra-args: +install ${{ env.PYB_EXTRA_ARGS }}
checkout: 'false'
python-version: '${{ inputs.python-version }}'
homebrew-python: '${{ inputs.with-homebrew }}'
with-venv: '${{ inputs.with-venv }}'
install-pyb: 'false'
pyb-command: $PYTHON build.py
pyb-extra-args: +install ${{ env.PYB_EXTRA_ARGS }}
- name: Print Logs on Failure
uses: ChristopherHX/conditional@main
with:
if: ${{ steps.configure.output == 'failure' || steps.build.output == 'failure' }}
step: |
shell: bash
run: |
for f in $(find . -name \*.log); do
echo ">>>>>> $f"
cat "$f"
done
exit 1
if: failure()
shell: bash
run: |
for f in $(find . -name \*.log); do
echo ">>>>>> $f"
cat "$f"
done
exit 1
4 changes: 3 additions & 1 deletion .github/workflows/pybuilder.yml
Expand Up @@ -20,6 +20,7 @@ jobs:
- '3.7'
- '3.6'
- 'pypy-3.7'
- 'pypy-3.8'
with-venv:
- 'true'
- 'false'
Expand All @@ -34,7 +35,7 @@ jobs:
python-version: '${{ matrix.python-version }}'
with-venv: '${{ matrix.with-venv }}'
with-homebrew: 'false'
deploy-on-python: '["3.9"]'
deploy-on-python: '["3.10"]'
deploy-on-os: '["Linux"]'
deploy-on-branch: '["refs/heads/master"]'
build-secondary:
Expand All @@ -55,6 +56,7 @@ jobs:
- '3.7'
- '3.6'
- 'pypy-3.7'
- 'pypy-3.8'
with-venv:
- 'true'
- 'false'
Expand Down

0 comments on commit 3a1458f

Please sign in to comment.