From b79bb46b411990b14fb26754ed2120e96821c0b0 Mon Sep 17 00:00:00 2001 From: Etienne Wodey Date: Fri, 23 Feb 2024 15:15:04 +0100 Subject: [PATCH] workflows/tests: build packages separately --- .github/workflows/tests.yml | 46 +++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bdecbb4..4955834 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,8 +9,27 @@ on: env: PYTHONIOENCODING: utf-8 jobs: - package-tests: - name: tests-${{ matrix.os }}-py${{ matrix.python-version }}-qiskit${{ matrix.qiskit-version }} + build-packages: + name: build-packages + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Build packages + run: | + pip install hatch + hatch build + - name: Store packages + uses: actions/upload-artifact@v4 + with: + name: packages + path: dist/ + examples: + needs: build-packages + name: examples-${{ matrix.os }}-py${{ matrix.python-version }}-qiskit${{ matrix.qiskit-version }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -18,9 +37,6 @@ jobs: python-version: ['3.12'] os: ["ubuntu-latest"] steps: - - uses: actions/checkout@v4 - - name: Check shell scripts - uses: ludeeus/action-shellcheck@2.0.0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -31,10 +47,10 @@ jobs: # https://github.com/astral-sh/uv/issues/1386#issuecomment-1947801083 echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV pip install uv - - name: Build package - run: | - uv pip install hatch - hatch build + - name: Restore packages + uses: actions/download-artifact@v4 + with: + name: packages - name: Install package wheel run: | # there is only one wheel in dist/ @@ -43,6 +59,18 @@ jobs: - name: Run examples run: | ./examples/run_all.sh + # tests: + # name: tests-${{ matrix.os }}-py${{ matrix.python-version }}-qiskit${{ matrix.qiskit-version }} + # runs-on: ${{ matrix.os }} + # strategy: + # matrix: + # qiskit-version: ['0.46.0', '1.0.1'] + # python-version: ['3.12'] + # os: ['ubuntu-latest'] + # steps: + # - uses: actions/checkout@v4 + # - name: Check shell scripts + # uses: ludeeus/action-shellcheck@2.0.0 # - name: Lock # run: poetry install --sync # - name: Check version numbers consistency