From 676b68fc5cfa72fd0c22a9424f1ec8fbeabe62dc Mon Sep 17 00:00:00 2001 From: Karol Harezlak Date: Mon, 30 Jan 2023 13:47:25 -0800 Subject: [PATCH 1/2] - Workflow to build and upload the ide extension binaries (nightly) - Typo in the connection error message. Co-authored-by: Stephen Chin --- .github/workflows/build_upload_extension.yml | 38 ++++ .github/workflows/extension_museum.sh | 25 +++ .github/workflows/genlisting.py | 191 +++++++++++++++++++ src/views/ConnectionStatusBar.ts | 2 +- 4 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build_upload_extension.yml 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 new file mode 100644 index 0000000..40fcdb2 --- /dev/null +++ b/.github/workflows/build_upload_extension.yml @@ -0,0 +1,38 @@ +name: Pyrsia VS Code Extension build and upload extension's binaries + +on: +# 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 + 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 + # 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(""" + + + + + +