Skip to content

Commit

Permalink
ci: combine build and test jobs in build-pull-request workflow (#54)
Browse files Browse the repository at this point in the history
It does not seem necessary to save the PR image as an artifact at this
point
  • Loading branch information
plexoos authored May 7, 2024
1 parent 91618f5 commit 55968d3
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true

jobs:
build:
build-test:
runs-on: [gpu]
steps:
- name: Define environment variables
Expand All @@ -29,38 +29,15 @@ jobs:
- name: Set up docker
uses: docker/setup-buildx-action@v3

- name: Build image locally
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ env.IMAGE_NAME }}:${{ env.TAG }}
outputs: type=docker,dest=/tmp/esi-shell-${{ env.TAG }}.tar
load: true
cache-from: ${{ env.IMAGE_NAME }}:latest
cache-to: type=inline

- name: Save built image for test jobs
uses: actions/upload-artifact@v4
with:
name: esi-shell-${{ env.TAG }}
path: /tmp/esi-shell-${{ env.TAG }}.tar

test:
runs-on: [gpu]
needs: build
steps:
- name: Define environment variables
run: |
echo IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
echo TAG=$(echo "PR-${{ github.event.pull_request.number }}") >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: esi-shell-${{ env.TAG }}
path: /tmp

- name: Run tests
run: |
docker load --input /tmp/esi-shell-${{ env.TAG }}.tar
rm -fr /tmp/esi-shell-${{ env.TAG }}.tar
docker run --rm ${{ env.IMAGE_NAME }}:${{ env.TAG }} bash -l -c 'HOME=$ESI_DIR opticks-full-prepare && HOME=$ESI_DIR opticks-t'

0 comments on commit 55968d3

Please sign in to comment.