Skip to content

Commit

Permalink
caching npm and fixes for puppeteer
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbie1977 authored Oct 31, 2024
1 parent 5b4d3cf commit b06b8d5
Showing 1 changed file with 154 additions and 80 deletions.
234 changes: 154 additions & 80 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This is a basic workflow to help you get started with Actions

# Main workflow for VFB Geppetto Application
name: CI

# Controls when the action will run. Triggers the workflow on push only. ToDo: handle pull requests for testing only
#######################
# Workflow Triggers
#######################
on:
push:
branches: '**'
Expand All @@ -14,100 +15,109 @@ on:
workflows: [Build]
types: [completed]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
#######################
# Jobs Configuration
#######################
jobs:
# Deploy the local and remote versions of geppetto-vfb
deploy-test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# total job timeout:
timeout-minutes: 590

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
#######################
# Initial Setup
#######################
- name: Checkout code
uses: actions/checkout@v4

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Decide based on branch which servers to use
#######################
# Branch Configuration
#######################
- name: Pass branch
id: branch
run: echo "::set-output name=value::$(echo ${GITHUB_REF} | sed 's@refs/heads/@@g' | sed 's@refs/tags/@@g' )";
echo "::set-output name=clean::$(echo ${GITHUB_REF} | sed 's@refs/heads/@@g' | sed 's@refs/tags/@@g' | sed 's@[/\\]@-@g')";
run: |
echo "::set-output name=value::$(echo ${GITHUB_REF} | sed 's@refs/heads/@@g' | sed 's@refs/tags/@@g' )"
echo "::set-output name=clean::$(echo ${GITHUB_REF} | sed 's@refs/heads/@@g' | sed 's@refs/tags/@@g' | sed 's@[/\\]@-@g')"
#######################
# Server Configuration
#######################
- name: Setup local servers
id: local-servers
shell: bash
run: if [ "${GITHUB_REF#refs/heads/}" == master ] || [[ "${GITHUB_REF#refs/heads/}" == v* ]]; then
echo "::debug::Set to master setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474";
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
run: |
if [ "${GITHUB_REF#refs/heads/}" == master ] || [[ "${GITHUB_REF#refs/heads/}" == v* ]]; then
echo "::debug::Set to master setup"
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474"
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/"
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast"
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org"
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select"
echo "::set-output name=BUILD_TYPE::release"
elif [ "${GITHUB_REF#refs/heads/}" == debug ] || [ "${GITHUB_REF#refs/heads/}" == pipeline2 ] || [ "${GITHUB_REF#refs/heads/}" == vfb_geppetto_application ] || [ "${GITHUB_REF#refs/heads/}" == development ] || [[ "${GITHUB_REF#refs/heads/}" == f* ]]; then
echo "::debug::Set to dev setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474";
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-dev.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr-dev.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::development";
echo "::debug::Set to dev setup"
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474"
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/"
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast"
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-dev.virtualflybrain.org"
echo "::set-output name=SOLR_SERVER::https://solr-dev.virtualflybrain.org/solr/ontology/select"
echo "::set-output name=BUILD_TYPE::development"
elif [ "${GITHUB_REF#refs/heads/}" == alpha ] ; then
echo "::debug::Set to alpha setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474";
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-alpha.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr-alpha.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::staging";
echo "::debug::Set to alpha setup"
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474"
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/"
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast"
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-alpha.virtualflybrain.org"
echo "::set-output name=SOLR_SERVER::https://solr-alpha.virtualflybrain.org/solr/ontology/select"
echo "::set-output name=BUILD_TYPE::staging"
else
echo "::debug::Set to default setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474";
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
echo "::debug::Set to default setup"
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474"
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/"
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast"
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org"
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select"
echo "::set-output name=BUILD_TYPE::release"
fi
- name: Setup remote servers
id: remote-servers
shell: bash
run: if [ "${GITHUB_REF#refs/heads/}" == master ] || [[ "${GITHUB_REF#refs/heads/}" == v* ]]; then
echo "::debug::Set to master setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb.v4.virtualflybrain.org";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org";
echo "::set-output name=VFB_OWL_SERVER::http://owl.virtualflybrain.org/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
run: |
if [ "${GITHUB_REF#refs/heads/}" == master ] || [[ "${GITHUB_REF#refs/heads/}" == v* ]]; then
echo "::debug::Set to master setup"
echo "::set-output name=VFB_PDB_SERVER::http://pdb.v4.virtualflybrain.org"
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org"
echo "::set-output name=VFB_OWL_SERVER::http://owl.virtualflybrain.org/kbs/vfb/"
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast"
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select"
echo "::set-output name=BUILD_TYPE::release"
elif [ "${GITHUB_REF#refs/heads/}" == debug ] || [ "${GITHUB_REF#refs/heads/}" == pipeline2 ] || [ "${GITHUB_REF#refs/heads/}" == vfb_geppetto_application ] || [ "${GITHUB_REF#refs/heads/}" == development ] || [[ "${GITHUB_REF#refs/heads/}" == f* ]]; then
echo "::debug::Set to dev setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb-dev.virtualflybrain.org";
echo "::set-output name=VFB_OWL_SERVER::http://owl-dev.virtualflybrain.org/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-dev.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr-dev.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
echo "::debug::Set to dev setup"
echo "::set-output name=VFB_PDB_SERVER::http://pdb-dev.virtualflybrain.org"
echo "::set-output name=VFB_OWL_SERVER::http://owl-dev.virtualflybrain.org/kbs/vfb/"
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast"
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-dev.virtualflybrain.org"
echo "::set-output name=SOLR_SERVER::https://solr-dev.virtualflybrain.org/solr/ontology/select"
echo "::set-output name=BUILD_TYPE::release"
elif [ "${GITHUB_REF#refs/heads/}" == alpha ] ; then
echo "::debug::Set to alpha setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb-alpha.virtualflybrain.org";
echo "::set-output name=VFB_OWL_SERVER::http://owl-alpha.virtualflybrain.org/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-alpha.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr-alpha.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
echo "::debug::Set to alpha setup"
echo "::set-output name=VFB_PDB_SERVER::http://pdb-alpha.virtualflybrain.org"
echo "::set-output name=VFB_OWL_SERVER::http://owl-alpha.virtualflybrain.org/kbs/vfb/"
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast"
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-alpha.virtualflybrain.org"
echo "::set-output name=SOLR_SERVER::https://solr-alpha.virtualflybrain.org/solr/ontology/select"
echo "::set-output name=BUILD_TYPE::release"
else
echo "::debug::Set to default setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb.v4.virtualflybrain.org";
echo "::set-output name=VFB_OWL_SERVER::http://owl.virtualflybrain.org/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
echo "::debug::Set to default setup"
echo "::set-output name=VFB_PDB_SERVER::http://pdb.v4.virtualflybrain.org"
echo "::set-output name=VFB_OWL_SERVER::http://owl.virtualflybrain.org/kbs/vfb/"
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast"
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org"
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select"
echo "::set-output name=BUILD_TYPE::release"
fi

# Output the chosen servers
- name: Used remote servers
run: |
echo PDB:${{ steps.remote-servers.outputs.VFB_PDB_SERVER }}
Expand All @@ -116,6 +126,9 @@ jobs:
echo TREE_PDB:${{ steps.remote-servers.outputs.VFB_TREE_PDB_SERVER }}
echo R:${{ steps.remote-servers.outputs.VFB_R_SERVER }}
#######################
# Docker Setup
#######################
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

Expand All @@ -127,7 +140,10 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}


#######################
# Docker Build & Push
#######################
- name: Build and push local wss
id: docker_build_local
timeout-minutes: 290
Expand All @@ -146,7 +162,7 @@ jobs:
originBranch=${{ steps.branch.outputs.value }}
defaultBranch=development
finalBuild=true
- name: Build and push remote
id: docker_build_remote
timeout-minutes: 290
Expand All @@ -165,14 +181,72 @@ jobs:
originBranch=${{ steps.branch.outputs.value }}
defaultBranch=development
finalBuild=false
- name: Image digest
run: |
echo "local:${{ steps.docker_build_local.outputs.digest }}"
echo "remote:${{ steps.docker_build_remote.outputs.digest }}"
- name: Install Puppeteer
run: npm install [email protected] [email protected] [email protected] [email protected] @babel/[email protected] [email protected] @babel/[email protected]
#######################
# Testing Environment Setup
#######################
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '16'

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup package.json and install dependencies
run: |
# Create package.json if it doesn't exist
if [ ! -f package.json ]; then
echo '{
"name": "vfb-testing",
"version": "1.0.0",
"private": true,
"resolutions": {
"three": "0.115.0"
},
"overrides": {
"three": "0.115.0"
}
}' > package.json
else
# Add resolutions to existing package.json
npm pkg set resolutions.three="0.115.0"
npm pkg set overrides.three="0.115.0"
fi
- name: Install Chrome dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
wget \
libxss1 \
libxtst6 \
libxkbcommon0 \
libgtk-3-0 \
libasound2 \
libatk-bridge2.0-0 \
libgbm1
- name: Install Puppeteer and test dependencies
run: |
npm install --save-exact \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
@babel/[email protected] \
[email protected]
- name: Start VFB server
run: docker run -t -dit --name=testServer -p 8080:8080 "virtualflybrain/geppetto-vfb:${{ steps.branch.outputs.clean}}-remote";
sleep 100;
Expand Down

0 comments on commit b06b8d5

Please sign in to comment.