Skip to content

fix(qpi-driver): Fix NoMemory: Out of memory #133

fix(qpi-driver): Fix NoMemory: Out of memory

fix(qpi-driver): Fix NoMemory: Out of memory #133

Workflow file for this run

name: CI/CD Workflow
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
concurrency:
# cancel any previous run on this branch or tag that is still in progress
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
RAW_VERSION: ${{ github.ref_name }}
jobs:
# -------------------------------------------------------------------------
# Core lint-and-test matrix (server + driver)
# -------------------------------------------------------------------------
lint-and-test-server-and-driver:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.25.x', '1.26.x']
python-version: ['3.12']
node-version: ['20.x', '22.x']
extra: ['mock', 'aer', 'quantify', 'qblox']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: 'qpi-ui/go.sum'
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "qpi-driver/pyproject.toml"
- name: Set up nodejs
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies & formatting tools
run: |
if [ "${{ matrix.extra }}" = "mock" ]; then
uv sync --project qpi-driver --extra cli --dev
elif [ "${{ matrix.extra }}" = "aer" ]; then
uv sync --project qpi-driver --extra cli --extra aer --dev
elif [ "${{ matrix.extra }}" = "quantify" ]; then
uv sync --project qpi-driver --extra cli --extra quantify --dev
elif [ "${{ matrix.extra }}" = "qblox" ]; then
uv sync --project qpi-driver --extra cli --extra qblox --dev
fi
sudo apt-get update && sudo apt-get install -y zip
- name: Build dashboard
run: make build-dashboard
- name: Lint ochestrator
run: make lint-go
- name: Lint driver
run: make lint-py
- name: Test CLI
run: make test-py-cli
- name: Run Python Unit Tests for '${{ matrix.extra }}'
run: |
if [ "${{ matrix.extra }}" = "mock" ]; then
make test-py-base
elif [ "${{ matrix.extra }}" = "aer" ]; then
make test-py-aer
elif [ "${{ matrix.extra }}" = "quantify" ]; then
make test-py-quantify
elif [ "${{ matrix.extra }}" = "qblox" ]; then
make test-py-qblox
fi
- name: Run E2E Integration Tests for driver '${{ matrix.extra }}'
run: make test-e2e-driver EXECUTOR=${{ matrix.extra }}
# -------------------------------------------------------------------------
# qpi-client / Go SDK
# -------------------------------------------------------------------------
lint-and-test-go-client:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.25.x', '1.26.x']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: 'qpi-client/go/go.sum'
- name: Lint Go Client
run: make lint-go-client
- name: Run Go Client Unit Tests
run: make test-go-client
# -------------------------------------------------------------------------
# qpi-client / Python SDK
# -------------------------------------------------------------------------
lint-and-test-py-client:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "qpi-client/py/pyproject.toml"
- name: Install Python client dependencies
run: uv sync --project qpi-client/py --dev
- name: Audit Python Client Formatting & Style
run: make lint-py-client
- name: Run Python Client Unit Tests
run: make test-py-client
# -------------------------------------------------------------------------
# qpi-client / JS SDK
# -------------------------------------------------------------------------
lint-and-test-js-client:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x', '22.x']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: 'qpi-client/js/package-lock.json'
- name: Audit JS Client Type-check
run: make lint-js
- name: Run JS Client Unit Tests
run: make test-js-client
# -------------------------------------------------------------------------
# E2E Cypress Dashboard Tests
# -------------------------------------------------------------------------
test-dashboard-cypress:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.x'
cache-dependency-path: 'qpi-ui/go.sum'
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: '3.12'
enable-cache: true
cache-dependency-glob: "qpi-driver/pyproject.toml"
- name: Install driver dependencies
run: uv sync --project qpi-driver --extra cli --dev
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
cache-dependency-path: 'qpi-ui/internal/dashboard/package-lock.json'
- name: Run E2E Cypress Dashboard Tests
run: make test-e2e-dashboard
# -------------------------------------------------------------------------
# E2E Systemd Installer Tests
# -------------------------------------------------------------------------
test-systemd-installer:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Systemd Installer E2E Test
run: make test-e2e-systemd
# -------------------------------------------------------------------------
# Publish qpi-driver to PyPI
# -------------------------------------------------------------------------
publish-pypi-driver:
needs: lint-and-test-server-and-driver
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_TO_PYPI == 'true'
environment:
name: driver_pypi
url: https://pypi.org/p/qpi-driver
permissions:
id-token: write
contents: read
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: '3.12'
- name: Build Package
run: make package-driver
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: qpi-driver/dist/
print-hash: true
# -------------------------------------------------------------------------
# Publish qpi-client/py to PyPI
# -------------------------------------------------------------------------
publish-pypi-client:
needs: lint-and-test-py-client
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_PY_CLIENT == 'true'
permissions:
id-token: write
contents: read
environment:
name: client_pypi
url: https://pypi.org/p/qpi-client
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
python-version: '3.12'
- name: Build Package
run: make package-py
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: qpi-client/py/dist/
print-hash: true
# -------------------------------------------------------------------------
# Publish qpi-client/js to npm
# -------------------------------------------------------------------------
publish-npm-client:
needs: lint-and-test-js-client
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_JS_CLIENT == 'true'
permissions:
contents: read
id-token: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: 'qpi-client/js/package-lock.json'
- name: Install dependencies & build
run: make package-js
- name: Publish to npm
run: cd qpi-client/js && npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# -------------------------------------------------------------------------
# Publish Go server binaries to GitHub Release
# -------------------------------------------------------------------------
publish-go-release:
needs: [lint-and-test-server-and-driver, test-dashboard-cypress]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_GO_APP == 'true'
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.x'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
# Installs wixl (msitools) onto Ubuntu to compile the .msi package natively
- name: Install MSI Packing Tooling
run: sudo apt-get update && sudo apt-get install -y msitools wixl
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: latest
args: release --clean --config qpi-ui/pkg/.goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Compiles the real .msi Windows package from GoReleaser's output binary
- name: Package Windows MSI Installer
run: |
VERSION="${RAW_VERSION#v}"
sed -i "s/Version=\"[^\"]*\"/Version=\"${VERSION}\"/" qpi-ui/pkg/qpi.wxs
wixl -v qpi-ui/pkg/qpi.wxs -o dist/qpi_windows_amd64.msi
# Appends the new MSI installer asset into the active GitHub release draft
- name: Upload Windows MSI to Release
uses: softprops/action-gh-release@v3
with:
files: dist/qpi_windows_amd64.msi
draft: true
# Independent job to build the official Mac installer natively
package-macos-pkg:
needs: [publish-go-release]
runs-on: macos-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_GO_APP == 'true'
permissions:
contents: write
strategy:
matrix:
goarch: ['amd64', 'arm64']
env:
GOARCH: ${{ matrix.goarch }}
ARTEFACT: "qpi_${{ matrix.goarch }}"
OUTPUT_ARTEFACT: "qpi_macos_${{ matrix.goarch }}.pkg"
PKG_ROOT: "pkg_${{ matrix.goarch }}_root"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.x'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Build Dashboard
run: make build-dashboard
- name: Build Mac ${{ matrix.goarch }} Binary
run: |
GOOS=darwin go build -C "qpi-ui" -ldflags="-X 'main.Version=v${RAW_VERSION#v}'" -o "../${ARTEFACT}" .
# Uses Apple's built-in tool suite to build the native component installer
- name: Build Native ${{ matrix.goarch }} macOS .pkg
run: |
mkdir -p "${PKG_ROOT}/usr/local/bin/"
cp "${ARTEFACT}" "${PKG_ROOT}/usr/local/bin/"
pkgbuild --identifier "com.sopherapps.qpi" --version "${RAW_VERSION#v}" --install-location "/" --root "$PKG_ROOT" "$OUTPUT_ARTEFACT"
- name: Upload macOS PKG to Release
uses: softprops/action-gh-release@v3
with:
files: ${{ env.OUTPUT_ARTEFACT }}
draft: true
publish-release:
needs: [package-macos-pkg]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && vars.PUBLISH_GO_APP == 'true'
permissions:
contents: write
steps:
- name: Publish Release
uses: softprops/action-gh-release@v3
with:
draft: false