-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: restore build-pull-request workflow
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build Pull Request | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-container: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Define environment variables | ||
run: | | ||
echo REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | ||
echo TAG=$(echo "PR-${{ github.event.pull_request.number }}") >> $GITHUB_ENV | ||
- name: Set up docker | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build container | ||
uses: docker/build-push-action@v5 | ||
with: | ||
tags: ghcr.io/${{ env.REPOSITORY }}:${{ env.TAG }} | ||
outputs: type=docker,dest=/tmp/esi-opticks-${{ env.TAG }}.tar | ||
|
||
- name: Save built image for test jobs | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: esi-opticks-${{ env.TAG }} | ||
path: /tmp/esi-opticks-${{ env.TAG }}.tar | ||
|
||
test-container: | ||
runs-on: ubuntu-latest | ||
needs: build-container | ||
steps: | ||
- name: Define environment variables | ||
run: | | ||
echo REPOSITORY=$(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-opticks-${{ env.TAG }} | ||
path: /tmp | ||
|
||
- name: Run tests | ||
run: | | ||
docker load --input /tmp/esi-opticks-${{ env.TAG }}.tar | ||
docker run ghcr.io/${{ env.REPOSITORY }}:${{ env.TAG }} bash -l -c opticks-info |