From 670748f46de8432faba82439d81e4be3fa4bb660 Mon Sep 17 00:00:00 2001 From: appel_c Date: Tue, 23 Sep 2025 23:37:40 -0500 Subject: [PATCH 1/2] built: adapt ci for shared action --- .gitea/workflows/ci.yml | 86 ++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 670ae88..9fcd468 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -39,59 +39,57 @@ jobs: env: QTWEBENGINE_DISABLE_SANDBOX: 1 QT_QPA_PLATFORM: "offscreen" - steps: - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "${{ inputs.PYTHON_VERSION || '3.11' }}" - - - name: Checkout BEC Core + - name: Checkout this shared action repository uses: actions/checkout@v4 with: - repository: bec/bec - ref: "${{ inputs.BEC_CORE_BRANCH || 'main' }}" - path: ./bec + repository: bec/bec_shared_actions + ref: main + path: bec_shared_actions - - name: Checkout Ophyd Devices - uses: actions/checkout@v4 + - name: Run shared CI action + uses: ./bec_shared_actions + continue-on-error: true with: - repository: bec/ophyd_devices - ref: "${{ inputs.OPHYD_DEVICES_BRANCH || 'main' }}" - path: ./ophyd_devices - - - name: Checkout BEC Widgets - uses: actions/checkout@v4 - with: - repository: bec/bec_widgets - ref: "${{ inputs.BEC_WIDGETS_BRANCH || 'main' }}" - path: ./bec_widgets + BEC_WIDGETS_BRANCH: "${{ github.event.inputs.BEC_WIDGETS_BRANCH || 'main' }}" + BEC_CORE_BRANCH: "${{ github.event.inputs.BEC_CORE_BRANCH || 'main' }}" + OPHYD_DEVICES_BRANCH: "${{ github.event.inputs.OPHYD_DEVICES_BRANCH || 'main' }}" + BEC_PLUGIN_REPO_BRANCH: "${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.BEC_PLUGIN_REPO_BRANCH || 'main') || github.head_ref || github.ref_name }}" + PYTHON_VERSION: "${{ github.event.inputs.PYTHON_VERSION || '3.11' }}" + BEC_PLUGIN_REPO_URL: "https://gitea.psi.ch/bec/${{ github.event.repository.name }}.git" + APT_PACKAGES: "libgl1 libegl1 x11-utils libxkbcommon-x11-0 libdbus-1-3 xvfb libnss3 libxdamage1 libasound2t64 libatomic1 libxcursor1" - name: Checkout BEC Plugin Repository - uses: actions/checkout@v4 - with: - repository: bec/iss_bec - ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}" - path: ./iss_bec - - - name: Install dependencies - shell: bash run: | - sudo apt-get update - sudo apt-get install -y libgl1 libegl1 x11-utils libxkbcommon-x11-0 libdbus-1-3 xvfb - sudo apt-get -y install libnss3 libxdamage1 libasound2t64 libatomic1 libxcursor1 + chmod +x ./bec_shared_actions/give_runs_log.sh + ./bec_shared_actions/give_runs_log.sh "outputs/checkout.log" + + - name: Checkout BEC Core + run: | + chmod +x ./bec_shared_actions/give_runs_log.sh + ./bec_shared_actions/give_runs_log.sh "outputs/checkout_bec_core.log" + + - name: Checkout Ophyd Devices + run: | + chmod +x ./bec_shared_actions/give_runs_log.sh + ./bec_shared_actions/give_runs_log.sh "outputs/checkout_ophyd_devices.log" + + - name: Checkout BEC Widgets + run: | + chmod +x ./bec_shared_actions/give_runs_log.sh + ./bec_shared_actions/give_runs_log.sh "outputs/checkout_bec_widgets.log" + + - name: Install APT_PACKAGES + run: | + chmod +x ./bec_shared_actions/give_runs_log.sh + ./bec_shared_actions/give_runs_log.sh "outputs/install_apt_packages.log" - name: Install Python dependencies - shell: bash run: | - pip install uv - uv pip install --system -e ./ophyd_devices - uv pip install --system -e ./bec/bec_lib[dev] - uv pip install --system -e ./bec/bec_ipython_client - uv pip install --system -e ./bec/bec_server[dev] - uv pip install --system -e ./bec_widgets[dev,pyside6] - uv pip install --system -e ./iss_bec + chmod +x ./bec_shared_actions/give_runs_log.sh + ./bec_shared_actions/give_runs_log.sh "outputs/install_python_dependencies.log" - - name: Run Pytest with Coverage - id: coverage - run: pytest --random-order --cov=./iss_bec --cov-config=./iss_bec/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./iss_bec/tests/ || test $? -eq 5 + - name: Run pytest for Plugin + run: | + chmod +x ./bec_shared_actions/give_runs_log.sh + ./bec_shared_actions/give_runs_log.sh "outputs/pytest_plugin.log" \ No newline at end of file -- 2.49.1 From 675cc26571ff07f0b9fb14ee5eef01501373afb8 Mon Sep 17 00:00:00 2001 From: appel_c Date: Wed, 24 Sep 2025 12:18:49 -0500 Subject: [PATCH 2/2] refactor ci structure --- .gitea/workflows/ci.yml | 55 +++++++++++++---------------------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 9fcd468..1f4dbb0 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI for iss_bec +name: CI for ISS_bec on: push: pull_request: @@ -40,56 +40,35 @@ jobs: QTWEBENGINE_DISABLE_SANDBOX: 1 QT_QPA_PLATFORM: "offscreen" steps: - - name: Checkout this shared action repository + - name: Checkout shared action repository uses: actions/checkout@v4 with: repository: bec/bec_shared_actions ref: main path: bec_shared_actions - - name: Run shared CI action - uses: ./bec_shared_actions - continue-on-error: true + - name: Checkout Plugin and BEC Repositories + uses: bec/bec_shared_actions/checkout_repositories@main + # uses: ./bec_shared_actions with: BEC_WIDGETS_BRANCH: "${{ github.event.inputs.BEC_WIDGETS_BRANCH || 'main' }}" BEC_CORE_BRANCH: "${{ github.event.inputs.BEC_CORE_BRANCH || 'main' }}" OPHYD_DEVICES_BRANCH: "${{ github.event.inputs.OPHYD_DEVICES_BRANCH || 'main' }}" BEC_PLUGIN_REPO_BRANCH: "${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.BEC_PLUGIN_REPO_BRANCH || 'main') || github.head_ref || github.ref_name }}" - PYTHON_VERSION: "${{ github.event.inputs.PYTHON_VERSION || '3.11' }}" - BEC_PLUGIN_REPO_URL: "https://gitea.psi.ch/bec/${{ github.event.repository.name }}.git" + PLUGIN_REPO_NAME: "${{ github.event.repository.name }}" + + - name: Install external APT packages + uses: bec/bec_shared_actions/install_apt_packages@main + with: APT_PACKAGES: "libgl1 libegl1 x11-utils libxkbcommon-x11-0 libdbus-1-3 xvfb libnss3 libxdamage1 libasound2t64 libatomic1 libxcursor1" - - name: Checkout BEC Plugin Repository - run: | - chmod +x ./bec_shared_actions/give_runs_log.sh - ./bec_shared_actions/give_runs_log.sh "outputs/checkout.log" - - - name: Checkout BEC Core - run: | - chmod +x ./bec_shared_actions/give_runs_log.sh - ./bec_shared_actions/give_runs_log.sh "outputs/checkout_bec_core.log" - - - name: Checkout Ophyd Devices - run: | - chmod +x ./bec_shared_actions/give_runs_log.sh - ./bec_shared_actions/give_runs_log.sh "outputs/checkout_ophyd_devices.log" - - - name: Checkout BEC Widgets - run: | - chmod +x ./bec_shared_actions/give_runs_log.sh - ./bec_shared_actions/give_runs_log.sh "outputs/checkout_bec_widgets.log" - - - name: Install APT_PACKAGES - run: | - chmod +x ./bec_shared_actions/give_runs_log.sh - ./bec_shared_actions/give_runs_log.sh "outputs/install_apt_packages.log" - - name: Install Python dependencies - run: | - chmod +x ./bec_shared_actions/give_runs_log.sh - ./bec_shared_actions/give_runs_log.sh "outputs/install_python_dependencies.log" + uses: bec/bec_shared_actions/install_python_env@main + with: + PYTHON_VERSION: "${{ github.event.inputs.PYTHON_VERSION || '3.11' }}" + PLUGIN_REPO_NAME: "${{ github.event.repository.name }}" - name: Run pytest for Plugin - run: | - chmod +x ./bec_shared_actions/give_runs_log.sh - ./bec_shared_actions/give_runs_log.sh "outputs/pytest_plugin.log" \ No newline at end of file + uses: bec/bec_shared_actions/run_pytest_for_plugin@main + with: + PLUGIN_REPO_NAME: "${{ github.event.repository.name }}" \ No newline at end of file -- 2.49.1