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 15 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
34 changes: 27 additions & 7 deletions .github/workflows/build-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,67 @@ 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: Install miniconda
run: |
curl -L -O https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_PYTHON_VERSION}_${MINICONDA_VERSION}-Linux-x86_64.sh \
&& bash Miniconda3-${MINICONDA_PYTHON_VERSION}_${MINICONDA_VERSION}-Linux-x86_64.sh -b -p conda/

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

- name: Test pyscript
run: make test CONDA_EXE=conda/bin/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/
29 changes: 23 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,21 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install miniconda
run: |
curl -L -O https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_PYTHON_VERSION}_${MINICONDA_VERSION}-Linux-x86_64.sh \
&& bash Miniconda3-${MINICONDA_PYTHON_VERSION}_${MINICONDA_VERSION}-Linux-x86_64.sh -b -p conda/

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

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

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

# Deploy to S3
- name: Configure AWS credentials
Expand All @@ -58,6 +74,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
4 changes: 2 additions & 2 deletions pyscriptjs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ app_dir ?= $(shell git rev-parse --show-prefix)

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

setup:
@if [ -z "$${CONDA_SHLVL: 4FD0 +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