Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Core Workflow Examples #287

Merged
merged 9 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions .github/workflows/build-python-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,39 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8","3.9","3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set Branch Name
- name: Determine Branch Name
run: |
echo "branch_name=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV

- name: Check Branch
run: echo "$env.branch_name"
if [ "${{ github.event_name }}" == "pull_request" ]; then
branch_name="${{ github.head_ref }}"
else
branch_name="${{ github.ref_name }}"
fi
echo "branch_name=$branch_name" >> $GITHUB_ENV

- name: Get Hash
id: hash
run: echo "git_hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
- name: Sanitize Branch Name and Git Hash
run: |
sanitized_branch_name=$(echo "$branch_name" | sed 's/[^a-zA-Z0-9_-]/_/g') # Preserving hyphens
sanitized_git_hash=$(git rev-parse --short "$GITHUB_SHA" | sed 's/[^a-zA-Z0-9_-]/_/g') # Preserving hyphens
echo "sanitized_branch_name=$sanitized_branch_name" >> $GITHUB_ENV
echo "sanitized_git_hash=$sanitized_git_hash" >> $GITHUB_ENV

- name: Check Hash
run: echo "$env.git_hash"
- name: Check Branch and Hash
run: |
echo "Branch: $sanitized_branch_name"
echo "Hash: $sanitized_git_hash"

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -49,16 +55,15 @@ jobs:
run: python -m pip install --upgrade pip

- name: Build Extension in Dev Mode
run: |
pip install -e .
run: pip install -e .

- name: Build Wheel
run: |
python -m pip install --upgrade build &&
python -m pip install --upgrade build
python -m build

- name: Upload Dist Directory Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: xircuits-wheel-${{ env.branch_name }}-${{ env.git_hash }}
path: dist
name: xircuits-wheel-${{ env.sanitized_branch_name }}-${{ matrix.python-version }}-${{ env.sanitized_git_hash }}
path: dist
8 changes: 4 additions & 4 deletions .github/workflows/pypi-github-release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
Expand All @@ -19,7 +19,7 @@ jobs:
pip install setuptools wheel

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -36,7 +36,7 @@ jobs:
python -m build

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: xircuits-wheel
path: dist
Expand Down
56 changes: 33 additions & 23 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,86 @@ on:
push:
branches: [ master ]
pull_request:
branches: "*"
branches: [ "*" ]
workflow_dispatch:
inputs:
branch:
description: 'Branch to run the tests on'
required: false
default: 'master'

jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8","3.9","3.10","3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set Branch Name
run: |
echo "branch_name=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "branch_name=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
else
echo "branch_name=${{ github.ref_name }}" >> $GITHUB_ENV
fi

- name: Check Branch
run: echo "$env.branch_name"
run: echo "Branch name is ${{ env.branch_name }}"

- name: Get Hash
id: hash
run: echo "git_hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
run: echo "git_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV

- name: Check Hash
run: echo "$env.git_hash"
run: echo "Git hash is ${{ env.git_hash }}"

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install Yarn
run: npm install --global yarn

- name: Build Extension in Dev Mode
run: |
pip install -e .
run: pip install -e .

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Build Wheel
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build &&
python -m pip install --upgrade build
python -m build

- name: Install Xircuits from wheel
run: |
whl_name=$(echo dist/*whl)
whl_name=$(ls dist/*.whl)
pip install $whl_name

- name: Install Xircuits Test Component Library
run: |
xircuits install tests
run: xircuits install tests

- name: Install xvfb
run: |
sudo apt-get install xvfb
run: sudo apt-get install -y xvfb

- name: Test E2E
run: |
( ls && jupyter lab --ServerApp.token= --ServerApp.password= --LabApp.default_url=/lab\?reset ) & cd ui-tests && jlpm install && jlpm playwright install && xvfb-run jlpm playwright test e2e/datatype-test.spec.ts
(jupyter lab --ServerApp.token='' --ServerApp.password='' --LabApp.default_url='/lab?reset' &) && cd ui-tests && jlpm install && jlpm playwright install && xvfb-run jlpm playwright test e2e/datatype-test.spec.ts

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report-${{ matrix.python-version }}
name: playwright-report-${{ matrix.python-version }}-${{ env.branch_name }}-${{ env.git_hash }}
path: ui-tests/playwright-report/
retention-days: 1
retention-days: 1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ tsconfig.tsbuildinfo

# .py files compiled by Xircuits
examples/*.py
!examples/__init__.py

# playwright files
*/test-results/
Expand Down
Loading