10000 Add testing to CI flow (#418) · sarvjeetdev/pyscript@ee46b46 · GitHub
[go: up one dir, main page]

Skip to content

Commit ee46b46

Browse files
Add testing to CI flow (pyscript#418)
* new testing ci flow * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * install conda * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * test conda * pre-commit fix * remove if * makefile fix * fix pytest install * argument for test * restructure * fix sync * full path filter * use setup-condav2 * syntax * test path * add binary argument * remove which * Update Makefile * remove arguments * trigger CI Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent db49fd4 commit ee46b46

File tree

6 files changed

+56
-15
lines changed

6 files changed

+56
-15
lines changed

.github/workflows/build-alpha.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,65 @@ on:
77
paths:
88
- pyscriptjs/**
99

10+
env:
11+
MINICONDA_PYTHON_VERSION: py38
12+
MINICONDA_VERSION: 4.11.0
13+
14+
defaults:
15+
run:
16+
working-directory: pyscriptjs
17+
1018
jobs:
1119
build:
1220
runs-on: ubuntu-latest
1321
permissions:
1422
contents: read
1523
id-token: write
16-
defaults:
17-
run:
18-
working-directory: pyscriptjs
19-
2024
steps:
25+
2126
- name: Checkout
2227
uses: actions/checkout@v3
28+
2329
- name: Install node
2430
uses: actions/setup-node@v3
2531
with:
2632
node-version: 18.x
33+
2734
- name: Cache node modules
2835
uses: actions/cache@v3
2936
env:
3037
cache-name: cache-node-modules
3138
with:
32-
# npm cache files are stored in `~/.npm` on Linux/macOS
39+
# npm cache files are stored in `~/.npm` on Linux/macOS
3340
path: ~/.npm
3441
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
3542
restore-keys: |
3643
${{ runner.os }}-build-${{ env.cache-name }}-
3744
${{ runner.os }}-build-
3845
${{ runner.os }}-
46+
47+
- name: setup Miniconda
48+
uses: conda-incubator/setup-miniconda@v2
49+
3950
- name: Install dependencies
4051
run: |
4152
npm install
53+
make setup
54+
55+
- name: Test pyscript
56+
run: make test
57+
4258
- name: Build pyscript
43-
run: |
44-
npm run build
59+
run: make build
4560

4661
# Deploy to S3
4762
- name: Configure AWS credentials
63+
if: github.ref == 'refs/heads/main' # Only deploy on merge into main
4864
uses: aws-actions/configure-aws-credentials@v1.6.1
4965
with:
5066
aws-region: ${{secrets.AWS_REGION}}
5167
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}
68+
5269
- name: Sync to S3
70+
if: github.ref == 'refs/heads/main'
5371
run: aws s3 sync --quiet ./examples/build/ s3://pyscript.net/alpha/

.github/workflows/build-latest.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,30 @@ on:
1515
- pyscriptjs/**
1616
- .github/workflows/build-latest.yml # Test that workflow works when changed
1717

18+
env:
19+
MINICONDA_PYTHON_VERSION: py38
20+
MINICONDA_VERSION: 4.11.0
21+
22+
defaults:
23+
run:
24+
working-directory: pyscriptjs
25+
1826
jobs:
1927
build:
2028
runs-on: ubuntu-latest
2129
permissions:
2230
contents: read
2331
id-token: write
24-
defaults:
25-
run:
26-
working-directory: pyscriptjs
27-
2832
steps:
33+
2934
- name: Checkout
3035
uses: actions/checkout@v3
36+
3137
- name: Install node
3238
uses: actions/setup-node@v3
3339
with:
3440
node-version: 18.x
41+
3542
- name: Cache node modules
3643
uses: actions/cache@v3
3744
env:
@@ -44,12 +51,20 @@ jobs:
4451
${{ runner.os }}-build-${{ env.cache-name }}-
4552
${{ runner.os }}-build-
4653
${{ runner.os }}-
54+
55+
- name: setup Miniconda
56+
uses: conda-incubator/setup-miniconda@v2
57+
4758
- name: Install dependencies
4859
run: |
4960
npm install
61+
make setup
62+
63+
- name: Test pyscript
64+
run: make test
65+
5066
- name: Build pyscript
51-
run: |
52-
npm run build
67+
run: make build
5368

5469
# Deploy to S3
5570
- name: Configure AWS credentials
@@ -58,6 +73,7 @@ jobs:
5873
with:
5974
aws-region: ${{secrets.AWS_REGION}}
6075
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}
76+
6177
- name: Sync to S3
6278
if: github.ref == 'refs/heads/main'
6379
run: aws s3 sync --quiet ./examples/build/ s3://pyscript.net/unstable

.github/workflows/docs-latest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
paths:
8+
- docs/**
79

810
jobs:
911
build:

.github/workflows/docs-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
# Any time a tag or branch is created
55
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#create
66
create:
7+
paths:
8+
- docs/**
79

810
jobs:
911
build:

.github/workflows/docs-review.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
branches:
66
- '*'
7+
paths:
8+
- docs/**
79

810
concurrency:
911
# Concurrency group that uses the workflow name and PR number if available

pyscriptjs/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ src_dir ?= $(base_dir)/src
66
examples ?= $(base_dir)/examples
77
app_dir ?= $(shell git rev-parse --show-prefix)
88

9+
CONDA_EXE := conda
910
CONDA_ENV ?= ./env
1011
env := $(CONDA_ENV)
11-
conda_run := conda run -p $(env)
12+
conda_run := $(CONDA_EXE) run -p $(env)
1213

1314
setup:
14-
@if [ -z "$${CONDA_SHLVL:+x}" ]; then echo "Conda is not installed." && exit 1; fi
1515
$(CONDA_EXE) env $(shell [ -d $(env) ] && echo update || echo create) -p $(env) --file environment.yml
1616
$(conda_run) playwright install
17+
$(CONDA_EXE) install -c anaconda pytest
1718

1819
clean:
1920
find . -name \*.py[cod] -delete

0 commit comments

Comments
 (0)
0