8000 Add testing to CI flow by pww217 · Pull Request #418 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Add testing to CI flow #418

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

Merged
merged 25 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from 22 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
32 changes: 25 additions & 7 deletions .github/workflows/build-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,65 @@ on:
- pyscriptjs/**
- .github/workflows/build-alpha.yml # Test that workflow works when changed

env:
MINICONDA_PYTHON_VERSION: py38
MINICONDA_VERSION: 4.11.0

defaults:
run:
working-directory: pyscriptjs

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: pyscriptjs

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: setup Miniconda
uses: conda-incubator/setup-miniconda@v2

- name: Install dependencies
run: |
npm install
make setup CONDA_EXE=conda

- name: Test pyscript
run: make test CONDA_EXE=conda

- name: Build pyscript
run: |
npm run build
run: make build

# Deploy to S3
- name: Configure AWS credentials
if: github.ref == 'refs/heads/main' # Only deploy on merge into main
uses: aws-actions/configure-aws-credentials@v1.6.1
with:
aws-region: ${{secrets.AWS_REGION}}
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}

- name: Sync to S3
if: github.ref == 'refs/heads/main'
run: aws s3 sync --quiet ./examples/build/ s3://pyscript.net/alpha/
28 changes: 22 additions & 6 deletions .github/workflows/build-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,30 @@ on:
- pyscriptjs/**
- .github/workflows/build-latest.yml # Test that workflow works when changed

env:
MINICONDA_PYTHON_VERSION: py38
MINICONDA_VERSION: 4.11.0

defaults:
run:
working-directory: pyscriptjs

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: pyscriptjs

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Cache node modules
uses: actions/cache@v3
env:
Expand All @@ -44,12 +51,20 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: setup Miniconda
uses: conda-incubator/setup-miniconda@v2

- name: Install dependencies
run: |
npm install
make setup CONDA_EXE=conda

- name: Test pyscript
run: make test CONDA_EXE=conda

- name: Build pyscript
run: |
npm run build
run: make build

# Deploy to S3
- name: Configure AWS credentials
Expand All @@ -58,6 +73,7 @@ jobs:
with:
aws-region: ${{secrets.AWS_REGION}}
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}

- name: Sync to S3
if: github.ref == 'refs/heads/main'
run: aws s3 sync --quiet ./examples/build/ s3://pyscript.net/unstable
2 changes: 2 additions & 0 deletions .github/workflows/docs-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
paths:
- docs/**

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
# Any time a tag or branch is created
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#create
create:
paths:
- docs/**

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
branches:
- '*'
paths:
- docs/**

concurrency:
# Concurrency group that uses the workflow name and PR number if available
Expand Down
5 changes: 3 additions & 2 deletions pyscriptjs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ src_dir ?= $(base_dir)/src
examples ?= $(base_dir)/examples
app_dir ?= $(shell git rev-parse --show-prefix)

CONDA_EXE := conda
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jezdez do you have any opinions about this? Is that fine from a pure conda perspective?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, it's basically just conda from PATH as the setup-conda action allows, but this variable existed in the makefile previously and was undefined.

CONDA_ENV ?= ./env
env := $(CONDA_ENV)
conda_run := conda run -p $(env)
conda_run := $(CONDA_EXE) run -p $(env)

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

clean:
find . -name \*.py[cod] -delete
Expand Down
0