|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - 'v[0-9]+.[0-9]+.[0-9]+' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + workflow_dispatch: {} |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: fast-${{ github.head_ref || github.run_id }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + test_qek_ubuntu: |
| 20 | + name: Run unit/integration tests (ubuntu) |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + python-version: ["3.10", "3.11"] |
| 25 | + steps: |
| 26 | + - name: Checkout QEK |
| 27 | + uses: actions/checkout@v4 |
| 28 | + - name: Set up Python ${{ matrix.python-version }} |
| 29 | + uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: ${{ matrix.python-version }} |
| 32 | + - name: Install Hatch |
| 33 | + run: | |
| 34 | + pip install hatch |
| 35 | + - name: Run tests |
| 36 | + run: | |
| 37 | + hatch -v run test |
| 38 | + - name: Upload coverage data |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: "coverage-data" |
| 42 | + path: .coverage.* |
| 43 | + if-no-files-found: ignore |
| 44 | + |
| 45 | + test_notebook: |
| 46 | + name: Run the Jupyter notebook tutorial (ubuntu) |
| 47 | + runs-on: ubuntu-latest |
| 48 | + strategy: |
| 49 | + matrix: |
| 50 | + python-version: ["3.10", "3.11"] |
| 51 | + steps: |
| 52 | + - name: Checkout QEK |
| 53 | + uses: actions/checkout@v4 |
| 54 | + - name: Set up Python ${{ matrix.python-version }} |
| 55 | + uses: actions/setup-python@v5 |
| 56 | + with: |
| 57 | + python-version: ${{ matrix.python-version }} |
| 58 | + - name: Install Hatch |
| 59 | + run: | |
| 60 | + pip install hatch |
| 61 | + - name: Copy samples |
| 62 | + run: | |
| 63 | + cp examples/ptcfm_processed_dataset.json . |
| 64 | + - name: Run notebook |
| 65 | + run: | |
| 66 | + hatch run pip install jupyter |
| 67 | + hatch run jupyter execute examples/pipeline.ipynb |
| 68 | +
|
| 69 | + # publish: |
| 70 | + # name: Publish to PyPI |
| 71 | + # if: startsWith(github.ref, 'refs/tags/v') |
| 72 | + # needs: test_qek_ubuntu |
| 73 | + # runs-on: ubuntu-latest |
| 74 | + # permissions: |
| 75 | + # # IMPORTANT: this permission is mandatory for trusted publishing |
| 76 | + # id-token: write |
| 77 | + # steps: |
| 78 | + # - name: Check out Qek |
| 79 | + # uses: actions/checkout@v4 |
| 80 | + # with: |
| 81 | + # ref: ${{ github.ref }} |
| 82 | + # - name: Set up Python |
| 83 | + # uses: actions/setup-python@v5 |
| 84 | + # with: |
| 85 | + # python-version: "3.10" |
| 86 | + # - name: Install Python dependencies |
| 87 | + # run: | |
| 88 | + # python -m pip install --upgrade pip |
| 89 | + # pip install hatch |
| 90 | + # - name: Build and publish package |
| 91 | + # run: | |
| 92 | + # hatch build |
| 93 | + # - name: Publish to PyPI |
| 94 | + # uses: pypa/gh-action-pypi-publish@release/v1 |
| 95 | + # - name: Confirm deployment |
| 96 | + # timeout-minutes: 5 |
| 97 | + # run: | |
| 98 | + # VERSION=${GITHUB_REF#refs/tags/v} |
| 99 | + # until pip download qek==$VERSION |
| 100 | + # do |
| 101 | + # echo "Failed to download from PyPI, will wait for upload and retry." |
| 102 | + # sleep 1 |
| 103 | + # done |
| 104 | + |
| 105 | + deploy_docs: |
| 106 | + name: Deploy QEK docs (ubuntu) |
| 107 | + if: startsWith(github.ref, 'refs/tags/v') |
| 108 | + needs: test_qek_ubuntu |
| 109 | + runs-on: ubuntu-latest |
| 110 | + steps: |
| 111 | + - name: Checkout QEK |
| 112 | + uses: actions/checkout@v4 |
| 113 | + - name: Install JetBrains Mono font |
| 114 | + run: | |
| 115 | + sudo apt install -y wget unzip fontconfig |
| 116 | + wget https://download.jetbrains.com/fonts/JetBrainsMono-2.304.zip |
| 117 | + unzip JetBrainsMono-2.304.zip -d JetBrainsMono |
| 118 | + mkdir -p /usr/share/fonts/truetype/jetbrains |
| 119 | + cp JetBrainsMono/fonts/ttf/*.ttf /usr/share/fonts/truetype/jetbrains/ |
| 120 | + fc-cache -f -v |
| 121 | + - name: Install graphviz |
| 122 | + run: sudo apt-get install -y graphviz |
| 123 | + - name: Set up Python 3.10 |
| 124 | + uses: actions/setup-python@v5 |
| 125 | + with: |
| 126 | + python-version: '3.10' |
| 127 | + - name: Install Hatch |
| 128 | + run: | |
| 129 | + pip install hatch |
| 130 | + - name: Deploy docs |
| 131 | + run: | |
| 132 | + git config user.name "GitHub Actions" |
| 133 | + git config user.email "actions@github.com" |
| 134 | + git fetch origin gh-pages |
| 135 | + hatch -v run docs:mike deploy --push --update-aliases ${{ github.ref_name }} latest |
0 commit comments