Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing around with reusable workflows #924

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,37 +130,10 @@ jobs:
browser-backend: ["electron", "chrome", "firefox"]

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set some environment variables for CI containers pre-build
run: |
cp webapp/.env.test_e2e .env
echo "PYDATALAB_TESTING=true" >> pydatalab/.env

- name: Load previously built Docker images
uses: docker/bake-action@v5
with:
files: docker-compose.yml
load: true
targets: 'app,api,database'
set: |
app.cache-to=type=gha,scope=build-app,mode=max
app.cache-from=type=gha,scope=build-app
app.tags=datalab-app:latest
api.cache-to=type=gha,scope=build-api,mode=max
api.cache-from=type=gha,scope=build-api
api.tags=datalab-api:latest
database.cache-to=type=gha,scope=build-database,mode=max
database.cache-from=type=gha,scope=build-database
database.tags=datalab-database:latest

- name: Start services
run: |
# Launch production container profiles and wait for them to come up
docker compose up database api app --no-build --force-recreate -d --wait
- uses: actions/checkout@v4
- name: Start test servers
uses: './.github/workflows/launch_services.yml'

- name: Run end-to-end tests
uses: cypress-io/github-action@v6
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/launch_services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Start datalab test services

on:
workflow_call:
inputs:
# ref:
# description: The commit or tag to run the test server from
# type: string
# Using the current commit by default; if called from outside this repo, the SHA will not exist, so will fallback to `main`
# default: ${{ github.sha }}
jobs:
start-services:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# ref: ${{ inputs.ref }}
repository: datalab-org/datalab
path: /opt/datalab

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set some environment variables for CI containers pre-build
working-directory: /opt/datalab
run: |
cp webapp/.env.test_e2e .env
echo "PYDATALAB_TESTING=true" >> pydatalab/.env

- name: Load previously built Docker images
uses: docker/bake-action@v5
with:
files: /opt/datalab/docker-compose.yml
load: true
targets: 'app,api,database'
set: |
app.cache-to=type=gha,scope=build-app,mode=max
app.cache-from=type=gha,scope=build-app
app.tags=datalab-app:latest
api.cache-to=type=gha,scope=build-api,mode=max
api.cache-from=type=gha,scope=build-api
api.tags=datalab-api:latest
database.cache-to=type=gha,scope=build-database,mode=max
database.cache-from=type=gha,scope=build-database
database.tags=datalab-database:latest

- name: Start services
working-directory: /opt/datalab
run: |
# Launch production container profiles and wait for them to come up
docker compose up database api app --no-build --force-recreate -d --wait
Loading