Build unstable (#1736)

* Add build unstable

* update publish snapshot

* naming action and steps
This commit is contained in:
Ted Patrick
2023-09-20 14:30:21 -05:00
committed by GitHub
parent fd307e52ae
commit 91ae242e49
8 changed files with 53 additions and 223 deletions

View File

@@ -8,6 +8,10 @@ on:
type: string
required: true
defaults:
run:
working-directory: pyscript.core
jobs:
publish-snapshot:
runs-on: ubuntu-latest
@@ -17,8 +21,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Install node
uses: actions/setup-node@v3
@@ -38,12 +40,10 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
working-directory: ./pyscript.core
- name: Install Dependencies
run: npm install
- name: Build Pyscript.core
working-directory: ./pyscript.core
run: npm run build
- name: Configure AWS credentials
@@ -57,6 +57,5 @@ jobs:
run: sed 's#_PATH_#https://pyscript.net/snapshots/${{ inputs.snapshot_version }}/#' ./public/index.html > ./pyscript.core/dist/index.html
- name: Copy to Snapshot
working-directory: ./pyscript.core/dist
run: >
aws s3 sync . s3://pyscript.net/snapshots/${{ inputs.snapshot_version }}/
aws s3 sync ./dist/ s3://pyscript.net/snapshots/${{ inputs.snapshot_version }}/

View File

@@ -1,11 +1,11 @@
name: "[CI] Build Unstable"
name: "Publish Unstable"
on:
push: # Only run on merges into main that modify files under pyscriptjs/ and examples/
branches:
- main
paths:
- pyscriptjs/**
- pyscript.core/**
- examples/**
- .github/workflows/build-unstable.yml # Test that workflow works when changed
@@ -19,17 +19,14 @@ on:
workflow_dispatch:
jobs:
BuildAndTest:
build-unstable:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pyscriptjs
env:
MINICONDA_PYTHON_VERSION: py38
MINICONDA_VERSION: 4.11.0
working-directory: pyscript.core
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v3
@@ -49,49 +46,32 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: setup Miniconda
uses: conda-incubator/setup-miniconda@v2
- name: Setup Environment
run: make setup
- name: NPM Install
run: npm install
- 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
- name: Examples Tests
run: make test-examples
run: npm run build
- name: Generate index.html in snapshot
working-directory: .
run: sed 's#_PATH_#https://pyscript.net/unstable/#' ./public/index.html > ./pyscript.core/dist/index.html
- uses: actions/upload-artifact@v3
with:
name: pyscript
path: |
pyscriptjs/build/
pyscript.core/dist/
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
working-directory: pyscript.core
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v3
@@ -117,9 +97,12 @@ jobs:
- name: Eslint
run: npx eslint src -c .eslintrc.js
Deploy:
publish-unstable:
runs-on: ubuntu-latest
needs: BuildAndTest
defaults:
run:
working-directory: pyscript.core
needs: build-unstable
if: github.ref == 'refs/heads/main' # Only deploy on merge into main
permissions:
contents: read
@@ -129,7 +112,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: pyscript
path: ./build/
path: ./dist/
# Deploy to S3
- name: Configure AWS credentials
@@ -139,4 +122,4 @@ jobs:
role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }}
- name: Sync to S3
run: aws s3 sync --quiet ./build/ s3://pyscript.net/unstable/
run: aws s3 sync --quiet ./dist/ s3://pyscript.net/unstable/

View File

@@ -5,20 +5,16 @@ on:
tags:
- "[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9]+" # YYYY.MM.MICRO
env:
MINICONDA_PYTHON_VERSION: py38
MINICONDA_VERSION: 4.11.0
defaults:
run:
working-directory: pyscriptjs
working-directory: pyscript.core
jobs:
build:
prepare-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v3
@@ -38,17 +34,18 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: setup Miniconda
uses: conda-incubator/setup-miniconda@v2
- name: NPM Install
run: npm install
- name: Setup Environment
run: make setup
- name: Build
run: npm run build
- name: Build and Test
run: make test
- name: Generate index.html
working-directory: .
run: sed 's#_PATH_#https://pyscript.net/snapshots/${{ inputs.snapshot_version }}/#' ./public/index.html > ./pyscript.core/dist/index.html
- name: Zip build folder
run: zip -r -q ./build.zip ./build
- name: Zip dist folder
run: zip -r -q ./build.zip ./dist
- name: Prepare Release
uses: softprops/action-gh-release@v1

View File

@@ -4,23 +4,19 @@ on:
release:
types: [published]
env:
MINICONDA_PYTHON_VERSION: py38
MINICONDA_VERSION: 4.11.0
defaults:
run:
working-directory: pyscriptjs
working-directory: pyscript.core
jobs:
build:
publish-release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v3
@@ -40,16 +36,16 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: setup Miniconda
uses: conda-incubator/setup-miniconda@v2
- name: npm install
run: npm install
- name: Setup Environment
run: make setup
- name: build
run: npm run build
- name: Generate index.html in snapshot
working-directory: .
run: sed 's#_PATH_#https://pyscript.net/snapshots/${{ inputs.snapshot_version }}/#' ./public/index.html > ./pyscript.core/dist/index.html
- name: Build and Test
run: make test
# Upload to S3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1.6.1
with:
@@ -59,5 +55,5 @@ jobs:
- name: Sync to S3
run:
| # Update /latest and create an explicitly versioned directory under releases/YYYY.MM.MICRO/
aws s3 sync --quiet ./build/ s3://pyscript.net/latest/
aws s3 sync --quiet ./build/ s3://pyscript.net/releases/${{ github.ref_name }}/
aws s3 sync --quiet ./dist/ s3://pyscript.net/latest/
aws s3 sync --quiet ./dist/ s3://pyscript.net/releases/${{ github.ref_name }}/

View File

@@ -1,26 +0,0 @@
name: "[CI] Publish Snapshot"
# Copy /unstable/ to /snapshots/2022.09.1.RC1/
on:
workflow_dispatch:
inputs:
snapshot_version:
description: "The calver version of this snapshot: 2022.09.1 or 2022.09.1.RC1"
type: string
required: true
jobs:
snapshot:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- 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 s3://pyscript.net/unstable/ s3://pyscript.net/snapshots/${{ inputs.snapshot_version }}/

View File

@@ -1,29 +0,0 @@
name: "[CI] Sync Examples"
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: examples
steps:
# Deploy to S3
- name: Checkout
uses: actions/checkout@v3
- 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
# Sync outdated or new files, delete ones no longer in source
run: aws s3 sync --quiet --delete . s3://pyscript.net/examples/ # Sync directory, delete what is not in source

View File

@@ -1,74 +0,0 @@
name: "[CI] Test Next"
on:
push: # Only run on merges into main that modify files under pyscriptjs/ and examples/
branches:
- next
paths:
- pyscript.core/**
- .github/workflows/test-next.yml # Test that workflow works when changed
pull_request: # Run on any PR that modifies files under pyscriptjs/ and examples/
branches:
- next
paths:
- pyscript.core/**
- .github/workflows/test-next.yml # Test that workflow works when changed
workflow_dispatch:
jobs:
TestNext:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pyscript.core
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 20.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 }}-
# TODO: this will likely change soon to pyscript.next
# - name: install next deps
# working-directory: pyscript.core
# run: npm i; npx playwright install
# - name: build next
# working-directory: pyscript.core
# run: npm run build
# - name: Run next tests
# working-directory: pyscript.core
# run: npm run test
# TODO: DO we want to upload next yet?
# - 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

View File

@@ -1,16 +0,0 @@
name: Test Report
on:
workflow_run:
workflows: ['\[CI\] Build Unstable']
types:
- completed
jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: dorny/test-reporter@v1.6.0
with:
artifact: test_results
name: Test reports
path: "*.xml"
reporter: java-junit