mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-23 08:03:01 -05:00
precommit.ci seems to have different results than when I run eslint locally. At least at first glance, github seems to behave the same as local. So this turns off eslint in pre-commit.ci and turns it on in gha.
140 lines
4.3 KiB
YAML
140 lines
4.3 KiB
YAML
name: "[CI] Build Unstable"
|
|
|
|
on:
|
|
push: # Only run on merges into main that modify files under pyscriptjs/ and examples/
|
|
branches:
|
|
- main
|
|
paths:
|
|
- pyscriptjs/**
|
|
- examples/**
|
|
- .github/workflows/build-unstable.yml # Test that workflow works when changed
|
|
|
|
pull_request: # Run on any PR that modifies files under pyscriptjs/ and examples/
|
|
branches:
|
|
- main
|
|
paths:
|
|
- pyscriptjs/**
|
|
- examples/**
|
|
- .github/workflows/build-unstable.yml # Test that workflow works when changed
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
BuildAndTest:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: pyscriptjs
|
|
env:
|
|
MINICONDA_PYTHON_VERSION: py38
|
|
MINICONDA_VERSION: 4.11.0
|
|
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
|
|
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: Setup Environment
|
|
run: make setup
|
|
|
|
- name: Build
|
|
run: make build
|
|
|
|
- name: TypeScript Tests
|
|
run: make test-ts
|
|
|
|
- name: Python Tests
|
|
run: make test-py
|
|
|
|
- name: Integration Tests
|
|
run: make test-integration-parallel
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: pyscript
|
|
path: |
|
|
pyscriptjs/build/
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
if: success() || failure()
|
|
with:
|
|
name: test_results
|
|
path: pyscriptjs/test_results
|
|
if-no-files-found: error
|
|
eslint:
|
|
runs-on: ubuntu-latest
|
|
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
|
|
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: npm install
|
|
run: npm install
|
|
|
|
- name: Eslint
|
|
run: npx eslint src -c .eslintrc.js
|
|
|
|
Deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: BuildAndTest
|
|
if: github.ref == 'refs/heads/main' # Only deploy on merge into main
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
|
|
steps:
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: pyscript
|
|
path: ./build/
|
|
|
|
# Deploy to S3
|
|
- name: Configure AWS credentials
|
|
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
|
|
run: aws s3 sync --quiet ./build/ s3://pyscript.net/unstable/
|