Skip to content

Refactor unqualified imports to qualified imports #275

Refactor unqualified imports to qualified imports

Refactor unqualified imports to qualified imports #275

Workflow file for this run

name: Run
on:
pull_request:
branches:
- main
paths:
- "**.py"
push:
branches:
- main
paths:
- "**.py"
workflow_dispatch:
# Cancel previous runs of the same PR but do not cancel previous runs on main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
TERM: linux
TERMINFO: /etc/terminfo
MODAL_TOKEN_ID: ${{ secrets.MODAL_MODAL_LABS_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_MODAL_LABS_TOKEN_SECRET }}
MODAL_ENVIRONMENT: main
jobs:
# Output all changed files in a JSON format compatible with GitHub Actions job matrices
diff-matrix:
name: Generate matrix of changed examples
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.diff.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Find changed examples
id: diff
uses: tj-actions/changed-files@v44
with:
files: "**.py"
files_ignore: "internal/**,misc/**"
matrix: true
- name: List all changed examples
run: echo '${{ steps.diff.outputs.all_changed_files }}'
# Run each changed example, using the output of the previous step as a job matrix
run-changed:
name: Run changed example
needs: [diff-matrix]
if:
${{ needs.diff-matrix.outputs.matrix != '[]' &&
needs.diff-matrix.outputs.matrix != '' }}
runs-on: ubuntu-20.04
strategy:
matrix:
file: ${{ fromJson(needs.diff-matrix.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: ./.github/actions/setup
- name: Run example
run: |
echo "Running ${{ matrix.file }}"
stem=$(basename "${{ matrix.file }}" .py)
python3 -m internal.run_example $stem || exit $?