Split build jobs, add S3 push (#307)

* split files, add s3 push

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* dedent

* indent

* alpha directory

* remove on: PR from alpha

* workflow names

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove js-lint.yml (replaced by pre-commit); add sync-examples.yml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update sync-examples.yml

* change unstable to latest, master -> main

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Peter W
2022-05-09 17:28:51 -05:00
committed by GitHub
parent 3dc90c4efe
commit bc4581d9e5
3 changed files with 70 additions and 15 deletions

View File

@@ -1,23 +1,23 @@
name: Build
name: '[CI] Build Alpha'
on:
push: # Only run on merges into master that modify files under pyscriptjs/
branches: main
push:
tags:
- '**' # Currently any tag, need to slim down
paths:
- pyscriptjs/**
- .github/workflows/** # Test that workflows work when changed
pull_request: # Run on any PR that modifies files in pyscriptjs/
paths:
- pyscriptjs/**
- .github/workflows/**
- .github/workflows/build-alpha.yml # Test that workflow works when changed
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: ./pyscriptjs
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -30,7 +30,7 @@ jobs:
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: |
@@ -43,3 +43,11 @@ jobs:
- name: Build pyscript
run: |
npm run 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 . s3://pyscript-static/alpha/ # What artifacts exactly need to be copied?

View File

@@ -1,18 +1,28 @@
name: Lint
name: '[CI] Build Latest'
on:
push: # Only run on merges into master that modify files under pyscriptjs/
push: # Only run on merges into main that modify files under pyscriptjs/
branches:
- main
paths:
- pyscriptjs/**
- .github/workflows/build-latest.yml # Test that workflow works when changed
pull_request: # Run on any PR that modifies files in pyscriptjs/
paths:
- pyscriptjs/**
- .github/workflows/**
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: ./pyscriptjs
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -25,7 +35,7 @@ jobs:
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: |
@@ -35,6 +45,14 @@ jobs:
- name: Install dependencies
run: |
npm install
- name: Run linter
- name: Build pyscript
run: |
npm run lint
npm run 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 . s3://pyscript-static/unstable/ # What artifacts exactly need to be copied?

29
.github/workflows/sync-examples.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: '[CI] Sync Examples'
on:
push: # Only run on merges into main that modify files under pyscriptjs/examples/
branches:
- main
paths:
- pyscriptjs/examples/**
- .github/workflows/sync-examples.yml # Test that workflow works when changed
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: ./pyscriptjs/examples
steps:
# 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 . s3://pyscript-static/examples/