Skip to content

Commit b41559d

Browse files
authored
Merge pull request #287 from XpressAI/fahreza/core-examples
✨ Add Core Workflow Examples
2 parents 68651b1 + 27483df commit b41559d

17 files changed

+5643
-85
lines changed

.github/workflows/build-python-wheel.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,39 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ["3.8","3.9","3.10", "3.11"]
15+
python-version: ["3.8", "3.9", "3.10", "3.11"]
1616

1717
steps:
18-
19-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
2019

2120
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v4
21+
uses: actions/setup-python@v5
2322
with:
2423
python-version: ${{ matrix.python-version }}
2524

26-
- name: Set Branch Name
25+
- name: Determine Branch Name
2726
run: |
28-
echo "branch_name=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
29-
30-
- name: Check Branch
31-
run: echo "$env.branch_name"
27+
if [ "${{ github.event_name }}" == "pull_request" ]; then
28+
branch_name="${{ github.head_ref }}"
29+
else
30+
branch_name="${{ github.ref_name }}"
31+
fi
32+
echo "branch_name=$branch_name" >> $GITHUB_ENV
3233
33-
- name: Get Hash
34-
id: hash
35-
run: echo "git_hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
34+
- name: Sanitize Branch Name and Git Hash
35+
run: |
36+
sanitized_branch_name=$(echo "$branch_name" | sed 's/[^a-zA-Z0-9_-]/_/g') # Preserving hyphens
37+
sanitized_git_hash=$(git rev-parse --short "$GITHUB_SHA" | sed 's/[^a-zA-Z0-9_-]/_/g') # Preserving hyphens
38+
echo "sanitized_branch_name=$sanitized_branch_name" >> $GITHUB_ENV
39+
echo "sanitized_git_hash=$sanitized_git_hash" >> $GITHUB_ENV
3640
37-
- name: Check Hash
38-
run: echo "$env.git_hash"
41+
- name: Check Branch and Hash
42+
run: |
43+
echo "Branch: $sanitized_branch_name"
44+
echo "Hash: $sanitized_git_hash"
3945
4046
- name: Setup Node.js
41-
uses: actions/setup-node@v3
47+
uses: actions/setup-node@v4
4248
with:
4349
node-version: 18
4450

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

5157
- name: Build Extension in Dev Mode
52-
run: |
53-
pip install -e .
58+
run: pip install -e .
5459

5560
- name: Build Wheel
5661
run: |
57-
python -m pip install --upgrade build &&
62+
python -m pip install --upgrade build
5863
python -m build
5964
6065
- name: Upload Dist Directory Artifact
61-
uses: actions/upload-artifact@v3
66+
uses: actions/upload-artifact@v4
6267
with:
63-
name: xircuits-wheel-${{ env.branch_name }}-${{ env.git_hash }}
64-
path: dist
68+
name: xircuits-wheel-${{ env.sanitized_branch_name }}-${{ matrix.python-version }}-${{ env.sanitized_git_hash }}
69+
path: dist

.github/workflows/pypi-github-release-publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
- name: Set up Python
13-
uses: actions/setup-python@v4
13+
uses: actions/setup-python@v5
1414
with:
1515
python-version: '3.9'
1616
- name: Install dependencies
@@ -19,7 +19,7 @@ jobs:
1919
pip install setuptools wheel
2020
2121
- name: Setup Node.js
22-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v4
2323
with:
2424
node-version: 18
2525

@@ -36,7 +36,7 @@ jobs:
3636
python -m build
3737
3838
- name: Upload Artifacts
39-
uses: actions/upload-artifact@v2
39+
uses: actions/upload-artifact@v4
4040
with:
4141
name: xircuits-wheel
4242
path: dist

.github/workflows/run-ui-tests.yml

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,86 @@ on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
branches: "*"
7+
branches: [ "*" ]
8+
workflow_dispatch:
9+
inputs:
10+
branch:
11+
description: 'Branch to run the tests on'
12+
required: false
13+
default: 'master'
814

915
jobs:
1016
build_and_test:
1117
runs-on: ubuntu-latest
1218
strategy:
1319
fail-fast: false
1420
matrix:
15-
python-version: ["3.8","3.9","3.10","3.11"]
21+
python-version: ["3.8", "3.9", "3.10", "3.11"]
1622

1723
steps:
18-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event.inputs.branch || github.ref }}
1927

2028
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v4
29+
uses: actions/setup-python@v5
2230
with:
2331
python-version: ${{ matrix.python-version }}
2432

2533
- name: Set Branch Name
2634
run: |
27-
echo "branch_name=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
35+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
36+
echo "branch_name=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
37+
else
38+
echo "branch_name=${{ github.ref_name }}" >> $GITHUB_ENV
39+
fi
2840
2941
- name: Check Branch
30-
run: echo "$env.branch_name"
42+
run: echo "Branch name is ${{ env.branch_name }}"
3143

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

3647
- name: Check Hash
37-
run: echo "$env.git_hash"
48+
run: echo "Git hash is ${{ env.git_hash }}"
3849

3950
- name: Setup Node.js
40-
uses: actions/setup-node@v3
51+
uses: actions/setup-node@v4
4152
with:
4253
node-version: 18
4354

4455
- name: Install Yarn
4556
run: npm install --global yarn
4657

4758
- name: Build Extension in Dev Mode
48-
run: |
49-
pip install -e .
59+
run: pip install -e .
60+
61+
- name: Upgrade pip
62+
run: python -m pip install --upgrade pip
5063

5164
- name: Build Wheel
5265
run: |
53-
python -m pip install --upgrade pip
54-
python -m pip install --upgrade build &&
66+
python -m pip install --upgrade build
5567
python -m build
5668
5769
- name: Install Xircuits from wheel
5870
run: |
59-
whl_name=$(echo dist/*whl)
71+
whl_name=$(ls dist/*.whl)
6072
pip install $whl_name
6173
6274
- name: Install Xircuits Test Component Library
63-
run: |
64-
xircuits install tests
75+
run: xircuits install tests
6576

6677
- name: Install xvfb
67-
run: |
68-
sudo apt-get install xvfb
78+
run: sudo apt-get install -y xvfb
6979

7080
- name: Test E2E
7181
run: |
72-
( 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
82+
(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
7383
74-
- uses: actions/upload-artifact@v3
84+
- uses: actions/upload-artifact@v4
7585
if: failure()
7686
with:
77-
name: playwright-report-${{ matrix.python-version }}
87+
name: playwright-report-${{ matrix.python-version }}-${{ env.branch_name }}-${{ env.git_hash }}
7888
path: ui-tests/playwright-report/
79-
retention-days: 1
89+
retention-days: 1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ tsconfig.tsbuildinfo
143143

144144
# .py files compiled by Xircuits
145145
examples/*.py
146+
!examples/__init__.py
146147

147148
# playwright files
148149
*/test-results/

0 commit comments

Comments
 (0)