Skip to content

Python on path

Python on path #999

Workflow file for this run

name: Pull Request
on:
pull_request
# A note on debugging a github step:
# You can ssh into the github action environment and poke around by using
# https://github.com/marketplace/actions/debugging-with-tmate
# Use `limit-access-to-actor: true` so only you can ssh into the environment!
#
# For example, to debug a failure, append this to the jobs list within the failing step
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
#
# build docker image: actions/upload-artifact@v3, with path: /bin
# - build UX
# - validate codebase
# - test UX unit tests
# - agent tests
# - build agent
# - UX e2e tests
jobs:
build-docker-image:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Buildx
uses: docker/setup-buildx-action@v2
-
name: Restore Cache docker image
id: cache-docker-image-restore
uses: actions/cache/restore@v3
env:
cache-name: cache-docker-image
with:
path: /tmp/build-image.tar
key: ${{ runner.os }}-docker-image-${{ env.cache-name }}-${{ hashFiles('build/package/Dockerfile') }}
-
if: ${{ steps.cache-docker-image-restore.outputs.cache-hit != 'true' }}
name: Build and Export Docker Image
uses: docker/build-push-action@v3
with:
context: .
build-args: BUILDKIT_INLINE_CACHE=1
pull: True
file: build/package/Dockerfile
tags: rstudio/connect-client:latest
outputs: type=docker,dest=/tmp/build-image.tar
-
if: ${{ steps.cache-docker-image-restore.outputs.cache-hit != 'true' }}
name: Cache docker image (update)
id: cache-docker-image-save
uses: actions/cache/save@v3
env:
cache-name: cache-docker-image
with:
path: /tmp/build-image.tar
key: ${{ runner.os }}-docker-image-${{ env.cache-name }}-${{ hashFiles('build/package/Dockerfile') }}
build-ux:
needs: build-docker-image
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache docker image (restore)
id: cache-docker-image
uses: actions/cache/restore@v3
env:
cache-name: cache-docker-image
with:
path: /tmp/build-image.tar
key: ${{ runner.os }}-docker-image-${{ env.cache-name }}-${{ hashFiles('/tmp/build-image.tar') }}
-
name: Load Docker Image
run: |
docker load --input /tmp/build-image.tar
-
name: Restore Cache UX node_modules
id: node_modules
uses: actions/cache/restore@v3
env:
cache-name: node-modules
with:
path: ./web/node_modules
key: ${{ runner.os }}-node-modules-${{ env.cache-name }}-${{ hashFiles('./web/package.json') }}
-
if: ${{ steps.node_modules.outputs.cache-hit != 'true' }}
name: Build up node_modules
run: |
just web/bootstrap
-
if: ${{ steps.node_modules.outputs.cache-hit != 'true' }}
name: Create the cache of UX node_modules (save)
id: create_node_modules
uses: actions/cache/save@v3
env:
cache-name: node-modules
with:
path: ./web/node_modules
key: ${{ runner.os }}-node-modules-${{ env.cache-name }}-${{ hashFiles('./web/package.json') }}
-
name: Build the UX
run: |
just build-web
-
name: Upload Web-UX Artifacts
uses: actions/upload-artifact@v3
with:
name: web-ux
path: ./web/dist
validate-codebase:
needs: build-ux
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore Cache docker image
id: cache-docker-image
uses: actions/cache/restore@v3
env:
cache-name: cache-docker-image
with:
path: /tmp/build-image.tar
key: ${{ runner.os }}-docker-image-${{ env.cache-name }}-${{ hashFiles('/tmp/build-image.tar') }}
-
name: Load Docker Image
run: |
docker load --input /tmp/build-image.tar
-
name: Download Web-UX Artifacts
uses: actions/download-artifact@v3
with:
name: web-ux
path: ./web/dist
-
name: Restore Cache UX node_modules
id: node_modules
uses: actions/cache/restore@v3
env:
cache-name: node-modules
with:
path: ./web/node_modules
key: ${{ runner.os }}-node-modules-${{ env.cache-name }}-${{ hashFiles('./web/package.json') }}
-
name: Validate the codebase
# Docker run will only fail step if last command fails... so must do multiple commands as one.
run: |
just validate
test-ux:
needs: build-ux
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore Cache docker image
id: cache-docker-image
uses: actions/cache/restore@v3
env:
cache-name: cache-docker-image
with:
path: /tmp/build-image.tar
key: ${{ runner.os }}-docker-image-${{ env.cache-name }}-${{ hashFiles('/tmp/build-image.tar') }}
-
name: Load Docker Image
run: |
docker load --input /tmp/build-image.tar
-
name: Restore Cache UX node_modules
id: node_modules
uses: actions/cache/restore@v3
env:
cache-name: node-modules
with:
path: ./web/node_modules
key: ${{ runner.os }}-node-modules-${{ env.cache-name }}-${{ hashFiles('./web/package.json') }}
-
name: Download Web-UX Artifacts
uses: actions/download-artifact@v3
with:
name: web-ux
path: ./web/dist
-
name: UX Unit Tests
run: |
just web/test-unit
-
name: UX Go Race Tests
run: |
just web/test-race
agent-tests:
needs: build-ux
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore Cache docker image
id: cache-docker-image
uses: actions/cache/restore@v3
env:
cache-name: cache-docker-image
with:
path: /tmp/build-image.tar
key: ${{ runner.os }}-docker-image-${{ env.cache-name }}-${{ hashFiles('/tmp/build-image.tar') }}
-
name: Load Docker Image
run: |
docker load --input /tmp/build-image.tar
-
name: Download Web-UX SPA Artifacts
uses: actions/download-artifact@v3
with:
name: web-ux
path: ./web/dist
-
name: Agent Unit Tests
run: |
just test-agent
build-agent:
needs: build-ux
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore Cache docker image
id: cache-docker-image
uses: actions/cache/restore@v3
env:
cache-name: cache-docker-image
with:
path: /tmp/build-image.tar
key: ${{ runner.os }}-docker-image-${{ env.cache-name }}-${{ hashFiles('/tmp/build-image.tar') }}
-
name: Load Docker Image
run: |
docker load --input /tmp/build-image.tar
-
name: Download Web-UX SPA Artifacts
uses: actions/download-artifact@v3
with:
name: web-ux
path: ./web/dist
-
name: Build agent
run: |
just build-agent
-
name: Make agents executable
run: |
sudo chmod -R +x ./bin/**/connect-client
-
name: Agent build artifacts
uses: actions/upload-artifact@v3
with:
name: agent-artifacts
path: bin/
ux-e2e-tests:
needs: build-agent
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore Cache docker image
id: cache-docker-image
uses: actions/cache/restore@v3
env:
cache-name: cache-docker-image
with:
path: /tmp/build-image.tar
key: ${{ runner.os }}-docker-image-${{ env.cache-name }}-${{ hashFiles('/tmp/build-image.tar') }}
-
name: Load Docker Image
run: |
docker load --input /tmp/build-image.tar
-
name: Download built agents
uses: actions/download-artifact@v3
with:
name: agent-artifacts
path: ./bin
-
name: Make agents executable
run: |
chmod -R +x ./bin/**/connect-client
-
name: Restore Cache UX node_modules
id: node_modules
uses: actions/cache/restore@v3
env:
cache-name: node-modules
with:
path: ./web/node_modules
key: ${{ runner.os }}-node-modules-${{ env.cache-name }}-${{ hashFiles('./web/package.json') }}
-
name: UX E2E Tests
run: |
PATH="${PATH}:/usr/local/bin" just web/test-e2e
test-windows:
needs: build-agent
runs-on: windows-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
-
name: Download binary
uses: actions/download-artifact@v3
with:
name: agent-artifacts
path: bin/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Make agents executable
run: |
chmod -R +x ./bin/**/connect-client
-
name: Run Windows CLI Tests
env:
os: windows-latest
# bats reads the load libraries from relative path only in Windows
BATS_SUPPORT_LIB: ..\..\libs\bats-support\load.bash
BATS_ASSERT_LIB: ..\..\libs\bats-assert\load
# WARNING: Docker run will only fail step if last command fails...
run: |
just test/bats-install
$env:Path += ";$env:GITHUB_WORKSPACE\test\libs\bats-core\bin"
$env:BINARY_PATH = "$env:GITHUB_WORKSPACE\bin\windows-amd64\connect-client"
cd $env:GITHUB_WORKSPACE\test
just run-client $env:os
-
name: Run Windows Cypress Tests
env:
os: windows-latest
DOCKER: "false"
run: |
just web/build-and-test-ci-e2e $env:os
test-macos:
needs: build-agent
runs-on: macos-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
-
name: Download binary
uses: actions/download-artifact@v3
with:
name: agent-artifacts
path: bin/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Make agents executable
run: |
chmod -R +x ./bin/**/connect-client
-
name: Run MacOs CLI Tests
env:
os: macos-latest
BATS_SUPPORT_LIB: ${{ github.workspace }}/test/libs/bats-support/load
BATS_ASSERT_LIB: ${{ github.workspace }}/test/libs/bats-assert/load
BINARY_PATH: ${{ github.workspace }}/bin/darwin-amd64/connect-client
# WARNING Docker run will only fail step if last command fails...
run: |
just test/bats-install
PATH="$PATH:${{ github.workspace }}/test/libs/bats-core/bin"
cd ${{ github.workspace }}/test
just run-client ${os}
-
name: Run MacOS Cypress Tests
env:
os: macos-latest
DOCKER: "false"
run: |
just web/build-and-test-ci-e2e ${os}
build-linux-amd64:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
needs: build-agent
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Download artifacts
uses: actions/download-artifact@v3
with:
path: bin/
# these are required to run docker on amd64 and arm64 platforms
-
name: Setup qemu
uses: docker/setup-qemu-action@v2
-
name: Setup buildx
uses: docker/setup-buildx-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Restore Cached linux-amd64 image
id: cache-linux-amd64-restore
uses: actions/cache/restore@v3
with:
path: /tmp/linux-amd64-image.tar
key: ${{ env.cache-name }}-${{ hashFiles('test/docker/Dockerfile') }}
env:
cache-name: cache-linux-amd64-image
os: linux-amd64
-
if: ${{ steps.cache-linux-amd64-restore.outputs.cache-hit != 'true' }}
name: Build and Export Docker Image
uses: docker/build-push-action@v3
with:
context: .
build-args: |
BUILDKIT_INLINE_CACHE=1
platform=linux-amd64
pull: True
file: test/docker/Dockerfile
platforms: linux/amd64
tags: rstudio/connect-client-linux-amd64:latest
outputs: type=docker,dest=/tmp/linux-amd64-image.tar
-
if: ${{ steps.cache-linux-amd64-restore.outputs.cache-hit != 'true' }}
name: Cache docker image (update)
id: cache-linux-amd64-image-save
uses: actions/cache/save@v3
env:
cache-name: cache-linux-amd64-image
with:
path: /tmp/linux-amd64-image.tar
key: ${{ env.cache-name }}-${{ hashFiles('test/docker/Dockerfile') }}
test-linux-amd64:
needs: build-linux-amd64
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Get binary
uses: actions/download-artifact@v3
with:
name: agent-artifacts
path: bin/
-
name: Make agents executable
run: |
chmod -R +x ./bin/**/connect-client
-
name: Cache docker image (restore)
id: cache-linux-amd64-image
uses: actions/cache/restore@v3
env:
cache-name: cache-linux-amd64-image
with:
path: /tmp/linux-amd64-image.tar
key: ${{ env.cache-name }}-${{ hashFiles('test/docker/Dockerfile') }}
-
name: Load Docker Image
run: |
docker load --input /tmp/linux-amd64-image.tar
-
name: Run linux-amd64 CLI Tests
env:
os: linux-amd64
run: |
just test/run-client ${os}
-
name: Run linux-amd64 Cypress Tests
env:
os: linux-amd64
DOCKER: "false"
run: |
just test/ui-client ${os}
build-linux-arm64:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
needs: build-agent
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Download artifacts
uses: actions/download-artifact@v3
with:
path: bin/
# these are required to run docker on amd64 and arm64 platforms
-
name: Setup qemu
uses: docker/setup-qemu-action@v2
-
name: Setup buildx
uses: docker/setup-buildx-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Restore Cached linux-arm64 image
id: cache-linux-arm64-restore
uses: actions/cache/restore@v3
with:
path: /tmp/linux-arm64-image.tar
key: ${{ env.cache-name }}-${{ hashFiles('test/docker/Dockerfile') }}
env:
cache-name: cache-linux-arm64-image
os: linux-arm64
-
if: ${{ steps.cache-linux-arm64-restore.outputs.cache-hit != 'true' }}
name: Build and Export Docker Image
uses: docker/build-push-action@v3
with:
context: .
build-args: |
BUILDKIT_INLINE_CACHE=1
platform=linux-arm64
pull: True
file: test/docker/Dockerfile
platforms: linux/arm64
tags: rstudio/connect-client-linux-arm64:latest
outputs: type=docker,dest=/tmp/linux-arm64-image.tar
-
if: ${{ steps.cache-linux-arm64-restore.outputs.cache-hit != 'true' }}
name: Cache docker image (update)
id: cache-linux-arm64-image-save
uses: actions/cache/save@v3
env:
cache-name: cache-linux-arm64-image
with:
path: /tmp/linux-arm64-image.tar
key: ${{ env.cache-name }}-${{ hashFiles('test/docker/Dockerfile') }}
test-linux-arm64:
needs: build-linux-arm64
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Get binary
uses: actions/download-artifact@v3
with:
name: agent-artifacts
path: bin/
-
name: Make agents executable
run: |
chmod -R +x ./bin/**/connect-client
# these are required to run docker on amd64 and arm64 platforms
-
name: Setup qemu
uses: docker/setup-qemu-action@v2
-
name: Setup buildx
uses: docker/setup-buildx-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Cache docker image (restore)
id: cache-linux-arm64-image
uses: actions/cache/restore@v3
env:
cache-name: cache-linux-arm64-image
with:
path: /tmp/linux-arm64-image.tar
key: ${{ env.cache-name }}-${{ hashFiles('test/docker/Dockerfile') }}
-
name: Load Docker Image
run: |
docker load --input /tmp/linux-arm64-image.tar
-
name: Run linux-arm64 CLI Tests
env:
os: linux-arm64
run: |
just test/run-client ${os}
# -
# name: Run linux-arm64 Cypress Tests
# env:
# os: linux-arm64
# DOCKER: "false"
# run: |
# just web/build && \
# just test/ui-client ${os}
validate-jupyterlab-plugin:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./extensions/jupyterlab/connect_jupyterlab
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install Python dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
- name: Install JS dependencies
run: jlpm install
- name: Install connect_jupyterlab package
run: just install
- name: Validate extension code
run: just validate
- name: Test extension code
run: just test