Skip to content

Merge pull request #97 from neutrons/remove_spec_file_requires #98

Merge pull request #97 from neutrons/remove_spec_file_requires

Merge pull request #97 from neutrons/remove_spec_file_requires #98

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: main
tags: ['v*']
workflow_dispatch:
env:
PACKAGE_NAME: postprocessing
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
environments: test
- name: Unit test with code coverage
run: pixi run test-cov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
if:
github.actor != 'dependabot[bot]'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
integration-tests:
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
environments: test
- name: Start docker containers
run: docker compose -f tests/integration/docker-compose.yml up --build -d
- name: Sleep, wait for containers to start up
run: sleep 5
- name: Run integration tests
run: pixi run test-integration
- name: Stop but dont remove docker containers
# Stopping the containers allows the code coverage to be written to disk
run: docker compose -f tests/integration/docker-compose.yml stop
- name: Copy code coverage out of docker container
run: docker cp integration-post_processing_agent-1:/opt/postprocessing/ /tmp/
- name: Combine and show code coverage
run: |
cd /tmp/postprocessing
pixi run -e test python -m coverage combine
pixi run -e test python -m coverage xml
cp coverage.xml $OLDPWD
pixi run -e test python -m coverage report
- name: Bring down docker containers completely now
# This will completely remove the containers
run: docker compose -f tests/integration/docker-compose.yml down
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
if:
github.actor != 'dependabot[bot]'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build:
runs-on: ubuntu-latest
needs: integration-tests
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
environments: build
- name: Build package
run: pixi run -e build build
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: dist
path: dist/
rpm:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Build RPM inside Docker
run: |
docker build --tag postprocess -f Dockerfile .
fname=`docker run --name postprocess postprocess ls /root/rpmbuild/RPMS/noarch`
docker cp postprocess:/root/rpmbuild/RPMS/noarch/$fname .
one=${fname#*postprocessing-}
two=${one%.noarch*}
echo "{version}={$two}" >> $GITHUB_OUTPUT
echo "{fname}={$fname}" >> $GITHUB_OUTPUT
continue-on-error: false
# now run a couple integration test with RPM installed package
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
environments: test
- name: Start docker containers
run: docker compose -f tests/integration/docker-compose-rpm.yml up --build -d
- name: Sleep, wait for containers to start up
run: sleep 5
- name: Run basic smoke tests for RPM
run: |
# Test basic functionality without requiring ActiveMQ connectivity
pixi run -e test python -c "
import sys, os
sys.path.append('/opt/postprocessing')
try:
import postprocessing
from postprocessing.Configuration import Configuration
from scripts.mantidpython import generate_subprocess_command
print('✓ RPM package imports successfully')
print('✓ Core modules accessible')
except ImportError as e:
print(f'✗ Import failed: {e}')
sys.exit(1)
"
- name: Bring down docker containers
run: docker compose -f tests/integration/docker-compose-rpm.yml down
verify:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Download build artifacts
uses: actions/download-artifact@v7
with:
name: dist
path: dist/
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.3
- name: Test package install and import
run: |
pixi run pip install dist/*.whl
pixi run python -c 'import postprocessing; print("Successfully imported " + postprocessing.__name__)'