-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Build a new image on every PR (with caching). * Test the functionality of the new image on every PR. * Build a new image on every commit to develop/master branch and every time a new tag is created (no caching). Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
- Loading branch information
1 parent
f2367e9
commit 9c7ffc2
Showing
3 changed files
with
107 additions
and
29 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,56 @@ | ||
# Test the Docker image on every pull request. | ||
# | ||
# The steps are: | ||
# 1. Build docker image using cached data. | ||
# 2. Start the docker container. | ||
# 3. Check that AiiDA is responsive. | ||
|
||
name: build-and-test-image-from-pull-request | ||
|
||
on: | ||
pull_request: | ||
path_ignore: | ||
- 'docs/**' | ||
|
||
jobs: | ||
|
||
build-and-test: | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
|
||
steps: | ||
- | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- | ||
name: Build image locally | ||
uses: docker/build-push-action@v2 | ||
with: | ||
load: true | ||
push: false | ||
tags: aiida-core:latest | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
- | ||
name: Start and test the container | ||
run: | | ||
export DOCKERID=`docker run -d aiida-core:latest` | ||
docker exec --tty $DOCKERID wait-for-services | ||
docker logs $DOCKERID | ||
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'verdi profile show default' | ||
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'verdi computer show localhost' | ||
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'verdi daemon status' |
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
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,51 @@ | ||
# Build the new Docker image on every commit to master/develop branch and on every new tag. | ||
# No caching is involved for the image build. The new image is then pushed to the Docker Hub. | ||
|
||
name: build-and-push-to-dockerhub | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+*" | ||
|
||
jobs: | ||
|
||
build-and-push: | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
|
||
steps: | ||
- | ||
uses: actions/checkout@v2 | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- | ||
name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} |