From 7dffccbb56a3e013fea7059d15d0861386e41c62 Mon Sep 17 00:00:00 2001 From: Karol Harezlak Date: Mon, 30 Jan 2023 13:47:25 -0800 Subject: [PATCH 1/3] - Workflow to build and upload the ide extension binaries --- .github/workflows/build_upload_extension.yml | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/build_upload_extension.yml diff --git a/.github/workflows/build_upload_extension.yml b/.github/workflows/build_upload_extension.yml new file mode 100644 index 0000000..4523cc8 --- /dev/null +++ b/.github/workflows/build_upload_extension.yml @@ -0,0 +1,21 @@ +name: Pyrsia VS Code Extension build and upload extension's binaries + +on: + schedule: + # scheduled twice a week + - cron: '* * * * 1,5' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 19 + - run: sudo apt-get install xvfb + - run: npm install + - run: npm run compile + - run: npm run lint + - run: xvfb-run --auto-servernum npm run test + - run: npm install -g @vscode/vsce + - run: vsce package -o "pyrsia_vs_code_`date +%Y_%m_%d`.vsix" --allow-star-activation From 87c32a5bf89608cc5495d1d3c843b890f3c2476b Mon Sep 17 00:00:00 2001 From: Karol Harezlak Date: Mon, 30 Jan 2023 18:21:22 -0800 Subject: [PATCH 2/3] Typo in the connection error message. Co-authored-by: Stephen Chin --- src/views/ConnectionStatusBar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ConnectionStatusBar.ts b/src/views/ConnectionStatusBar.ts index 23a8fc9..33eb66f 100644 --- a/src/views/ConnectionStatusBar.ts +++ b/src/views/ConnectionStatusBar.ts @@ -58,7 +58,7 @@ export class ConnectionStatusBar { // check the new url connection const healthy = await client.isNodeHealthy(); if (!healthy) { - vscode.window.showErrorMessage(`Cannot connect to Pyrsi node: '${Util.getNodeConfig().url}', + vscode.window.showErrorMessage(`Cannot connect to Pyrsia node: '${Util.getNodeConfig().url}', please make sure the Pyrsia node is available.'`); } } From b9a4678ee610f70dc7314939a3474e88dd7c1938 Mon Sep 17 00:00:00 2001 From: Karol Harezlak Date: Mon, 6 Feb 2023 10:57:07 -0800 Subject: [PATCH 3/3] - first attempt to test the script to upload the vs code binaries to the GC bucket - python script to generate the list of binary files --- .github/workflows/build_upload_extension.yml | 27 ++- .github/workflows/extension_museum.sh | 25 +++ .github/workflows/genlisting.py | 191 +++++++++++++++++++ 3 files changed, 238 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/extension_museum.sh create mode 100644 .github/workflows/genlisting.py diff --git a/.github/workflows/build_upload_extension.yml b/.github/workflows/build_upload_extension.yml index 4523cc8..40fcdb2 100644 --- a/.github/workflows/build_upload_extension.yml +++ b/.github/workflows/build_upload_extension.yml @@ -1,9 +1,16 @@ name: Pyrsia VS Code Extension build and upload extension's binaries on: - schedule: - # scheduled twice a week - - cron: '* * * * 1,5' +# schedule: +# # scheduled at 3PM and 3AM daily +# - cron: '0 3,15 * * *' + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + jobs: build: runs-on: ubuntu-latest @@ -17,5 +24,15 @@ jobs: - run: npm run compile - run: npm run lint - run: xvfb-run --auto-servernum npm run test - - run: npm install -g @vscode/vsce - - run: vsce package -o "pyrsia_vs_code_`date +%Y_%m_%d`.vsix" --allow-star-activation + # Login to GCS + - name: Google Auth + uses: 'google-github-actions/auth@v1' + with: + workload_identity_provider: 'projects/679352079717/locations/global/workloadIdentityPools/pyrsia-pool/providers/github-provider' + service_account: 'pyrsia-ghaction@pyrsia-sandbox.iam.gserviceaccount.com' + # Add gsutils + - name: Set up Cloud SDK + uses: 'google-github-actions/setup-gcloud@v1' + # Add the updated the vs code extension binary NIGHTLY + - name: Add the vs code extension binary to the vsrepo NIGHTLY repo + run: .github/workflows/extension_museum.sh nightly diff --git a/.github/workflows/extension_museum.sh b/.github/workflows/extension_museum.sh new file mode 100644 index 0000000..555634d --- /dev/null +++ b/.github/workflows/extension_museum.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e + +RELTYPE=$1 + +if [ "$RELTYPE" == "" ]; then + RELTYPE="nightly" +fi + +npm install -g @vscode/vsce +BINARY_FILE_NAME="pyrsia_vs_code_`date +%Y_%m_%d`.vsix" +vsce package -o $BINARY_FILE_NAME --allow-star-activation +WORKSPACE=$PWD +cd installers/vsrepo +mkdir -p repos/$RELTYPE +gsutil -m rsync -r gs://vsrepo/repos repos +mv $BINARY_FILE_NAME repos/$RELTYPE +cd repos/$RELTYPE + +# Generate pretty directory listing web pages +python3 $WORKSPACE/.github/workflows/genlisting.py -r + +# copy new public repo to GCS +gsutil -m rsync -r repos gs://vsrepo/repos diff --git a/.github/workflows/genlisting.py b/.github/workflows/genlisting.py new file mode 100644 index 0000000..e87efa3 --- /dev/null +++ b/.github/workflows/genlisting.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python3 +# --- +# Copyright 2020 glowinthedark +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# +# See the License for the specific language governing permissions and limitations under the License. +# --- +# +# Generate index.html files for +# all subdirectories in a directory tree. + +# handle symlinked files and folders: displayed with custom icons + +# By default only the current folder is processed and hidden files (starting with a dot) are skipped. +# To force inclusion of hidden files pas --include-hidden. + +# Use -r or --recursive to process nested folders. + +import argparse +import datetime +import os +import sys +from pathlib import Path +from urllib.parse import quote + +DEFAULT_OUTPUT_FILE = 'index.html' + + +def process_dir(top_dir, opts): + glob_patt = opts.filter or '*' + + path_top_dir: Path + path_top_dir = Path(top_dir) + index_file = None + + index_path = Path(path_top_dir, opts.output_file) + + if opts.verbose: + print(f'Traversing dir {path_top_dir.absolute()}') + + try: + index_file = open(index_path, 'w') + except Exception as e: + print('cannot create file %s %s' % (index_path, e)) + return + + index_file.write(""" + + + + + +