|
14 | 14 | - flowermd/**
|
15 | 15 | - environment-dev.yml
|
16 | 16 | - .github/workflows/pytest.yml
|
17 |
| - # Allows workflow to be manually triggered |
| 17 | + issue_comment: |
| 18 | + types: [created] |
| 19 | + branches: [ main ] |
| 20 | + paths: |
| 21 | + - flowermd/** |
| 22 | + - environment-dev.yml |
| 23 | + - .github/workflows/pytest.yml |
| 24 | + |
18 | 25 | workflow_dispatch:
|
19 | 26 |
|
20 | 27 | jobs:
|
21 | 28 | pytest:
|
22 |
| - runs-on: ubuntu-latest |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + os: [macOS-latest, ubuntu-latest] |
| 33 | + python-version: ['3.10', '3.11'] |
| 34 | + |
| 35 | + runs-on: ${{ matrix.os }} |
23 | 36 |
|
24 | 37 | steps:
|
25 | 38 | - name: Check out repository
|
|
29 | 42 | uses: conda-incubator/setup-miniconda@v2
|
30 | 43 | with:
|
31 | 44 | environment-file: environment-dev.yml
|
| 45 | + python-version: ${{ matrix.python-version }} |
32 | 46 | miniforge-variant: Mambaforge
|
33 | 47 | miniforge-version: 4.9.2-4
|
34 | 48 | use-mamba: true
|
|
46 | 60 | with:
|
47 | 61 | token: ${{ secrets.CODECOV_TOKEN }}
|
48 | 62 | file: ./coverage.xml
|
| 63 | + |
| 64 | + test-tutorials: |
| 65 | + if: ${{ github.event.issue.pull_request && github.event.comment.body== '/testtutorials'}} |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - name: Put a reaction to the comment |
| 69 | + run: gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}" |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + NODE_ID: ${{ github.event.comment.node_id }} |
| 73 | + - name: Check if PR is open |
| 74 | + run: | |
| 75 | + STATE=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json state --jq .state) |
| 76 | + if [ "$STATE" != "OPEN" ]; then |
| 77 | + echo "Cannot build for closed PRs" |
| 78 | + ( |
| 79 | + echo "**${{ github.workflow }}**" |
| 80 | + echo "Cannot build Kuby for a closed PR. Use the `latest` version (built for the `master` branch) or create a new PR." |
| 81 | + ) | \ |
| 82 | + gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F - |
| 83 | + gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_DOWN}){reaction{content}subject{id}}}" |
| 84 | + gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}" |
| 85 | + exit 1 |
| 86 | + fi |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + PR_NUMBER: ${{ github.event.issue.number }} |
| 90 | + NODE_ID: ${{ github.event.comment.node_id }} |
| 91 | + - name: Get PR HEAD Ref |
| 92 | + id: getRef |
| 93 | + run: echo "pr_ref=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json headRefOid | jq -r '.headRefOid')" >> $GITHUB_OUTPUT |
| 94 | + env: |
| 95 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + PR_NUMBER: ${{ github.event.issue.number }} |
| 97 | + |
| 98 | + - name: Check out repository |
| 99 | + uses: actions/checkout@v2 |
| 100 | + |
| 101 | + - name: Build environment |
| 102 | + uses: conda-incubator/setup-miniconda@v2 |
| 103 | + with: |
| 104 | + environment-file: environment-dev.yml |
| 105 | + miniforge-variant: Mambaforge |
| 106 | + miniforge-version: 4.9.2-4 |
| 107 | + use-mamba: true |
| 108 | + |
| 109 | + - name: Install package |
| 110 | + shell: bash -l {0} |
| 111 | + run: pip install . |
| 112 | + |
| 113 | + - name: Run pytest on tutorials |
| 114 | + shell: bash -l {0} |
| 115 | + run: python -m pytest -rs -v --nbmake tutorials/ |
0 commit comments