Skip to content

Commit

Permalink
Add minimal test for dev container
Browse files Browse the repository at this point in the history
This is a separate job so that we can easily and cleanly have the
research-template repository checked out.

We could consider moving the smoke test here, although it's maybe
advantageous to have that fail early, before the Docker image is
compressed (because that's a slow step).
  • Loading branch information
StevenMaude committed May 15, 2024
1 parent e97af58 commit 297d3e9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 33 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,40 @@ jobs:
# Disable compression; the file is already compressed
compression-level: 0

publish:
test-devcontainer:
needs: [build-and-test]
runs-on: ubuntu-latest

steps:
- name: Download Docker image
uses: actions/download-artifact@v4
with:
name: research-template-image
path: /tmp/image

- name: Import Docker image
run: docker load --input /tmp/image/research-template.tar.gz

- name: Tag Docker image for use with dev container
run: docker tag $IMAGE_NAME $PUBLIC_IMAGE_NAME:v0

- name: Checkout research template temporary devcontainer dev branch
uses: actions/checkout@v4
with:
repository: opensafely/research-template

- name: Checkout research-template-docker repository in subdirectory
uses: actions/checkout@v4
with:
path: 'research-template/research-template-docker'

- name: Build and run dev container task
uses: devcontainers/[email protected]
with:
runCmd: ./research-template/research-template-docker/tests/dev_container.sh

publish:
needs: [build-and-test, test-devcontainer]

runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions tests/dev_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
opensafely run run_all

0 comments on commit 297d3e9

Please sign in to comment.