Skip to content

Commit

Permalink
use vdelev_selfhosted as main branch and add enable_cache flags
Browse files Browse the repository at this point in the history
  • Loading branch information
puehringer committed May 8, 2024
1 parent 2fae667 commit a4e2897
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .github/actions/build-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
description: "npm registry"
default: "https://registry.npmjs.org/"
required: true
enable_cache:
description: "enables the yarn cache download and upload"
required: false
default: true
download_yarn_lock:
description: "downloads the node-yarn-lock artifact (only available when build-node was called before)"
required: false
Expand Down Expand Up @@ -64,6 +68,7 @@ runs:
# Enable yarn download cache, @see https://github.com/actions/cache/tree/main/save#always-save-cache and https://github.com/actions/setup-node/issues/325
- name: Restore yarn cache
uses: actions/cache/restore@v3
if: inputs.enable_cache == 'true'
with:
# This path is the global yarn cache, because for some reason the local .yarn/cache is not used. Maybe we need to set the cacheFolder, enableGlobalCache, ... options differently? @see https://yarnpkg.com/configuration/yarnrc#cacheFolder
path: ~/.yarn/berry/cache/
Expand All @@ -76,7 +81,7 @@ runs:
shell: bash
- name: Save yarn cache
uses: actions/cache/save@v3
if: steps.install.outcome == 'success'
if: steps.install.outcome == 'success' && inputs.enable_cache == 'true'
with:
# This path is the global yarn cache, because for some reason the local .yarn/cache is not used. Maybe we need to set the cacheFolder, enableGlobalCache, ... options differently? @see https://yarnpkg.com/configuration/yarnrc#cacheFolder
path: ~/.yarn/berry/cache/
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/build-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
description: "github read-only token"
default: "admin"
required: true
enable_cache:
description: "enables the pip cache download and upload"
required: false
default: true
run_lint:
default: true
required: false
Expand All @@ -28,7 +32,7 @@ runs:
uses: actions/setup-python@v3
with:
python-version: ${{ inputs.python_version }}
cache: 'pip'
cache: ${{ inputs.enable_cache == 'true' && 'pip' }}
# needs wheel for make
- name: install additional requirements
run: |
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/build-node-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ env:
PYPI_REGISTRY: "https://upload.pypi.org/legacy/"
PYPI_USERNAME: "datavisyn"
PYTHON_VERSION: "3.10"
WORKFLOW_BRANCH: "main"
WORKFLOW_BRANCH: "vdelev_selfhosted" # TODO: revert to main
POSTGRES_HOSTNAME: postgres_${{ github.job }}_${{ inputs.deduplication_id }}_${{ github.run_id }}_${{ github.run_attempt }}

permissions:
Expand Down Expand Up @@ -136,6 +136,7 @@ jobs:
npm_registry: ${{ env.NPM_REGISTRY }}
github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
run_webpack: ${{ inputs.node_run_webpack }}
enable_cache: ${{ inputs.runs_on != 'self-hosted' }}
- name: Run Chromatic
if: ${{ inputs.chromatic_enable }}
uses: chromaui/[email protected]
Expand Down Expand Up @@ -166,6 +167,7 @@ jobs:
with:
python_version: ${{ secrets.PYTHON_VERSION || env.PYTHON_VERSION }}
github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
enable_cache: ${{ inputs.runs_on != 'self-hosted' }}

# If cypress is used, build node and python sequentially as it is avoiding the duplicate install overhead
build-node-python-cypress:
Expand Down Expand Up @@ -230,11 +232,13 @@ jobs:
npm_registry: ${{ env.NPM_REGISTRY }}
github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
run_webpack: false # Disable the build here and call afterwards, as otherwise the yarn run env:decrypt will fail due to a missing yarn install
enable_cache: ${{ inputs.cypress_runs_on != 'self-hosted' && inputs.runs_on != 'self-hosted' }}
- name: Build python
uses: ./tmp/github-workflows/.github/actions/build-python
with:
python_version: ${{ secrets.PYTHON_VERSION || env.PYTHON_VERSION }}
github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
enable_cache: ${{ inputs.cypress_runs_on != 'self-hosted' && inputs.runs_on != 'self-hosted' }}
- name: Decrypt .env.enc and <app>/.env.enc
run: |
yarn run env:decrypt -pass env:ENV_PASSWORD || true
Expand Down Expand Up @@ -347,11 +351,13 @@ jobs:
npm_registry: ${{ env.NPM_REGISTRY }}
github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
run_webpack: false # Disable the build here and call afterwards, as otherwise the yarn run env:decrypt will fail due to a missing yarn install
enable_cache: ${{ inputs.playwright_runs_on != 'self-hosted' && inputs.runs_on != 'self-hosted' }}
- name: Build python
uses: ./tmp/github-workflows/.github/actions/build-python
with:
python_version: ${{ secrets.PYTHON_VERSION || env.PYTHON_VERSION }}
github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
enable_cache: ${{ inputs.playwright_runs_on != 'self-hosted' && inputs.runs_on != 'self-hosted' }}
- name: Decrypt .env.enc and <app>/.env.enc
run: |
yarn run env:decrypt -pass env:ENV_PASSWORD || true
Expand Down

0 comments on commit a4e2897

Please sign in to comment.