Updated R env (#63) #115
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
name: Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
matrix-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
IMAGE: [python, r, gpu-pytorch, gpu-tensorflow, qgis] | |
name: ${{ matrix.IMAGE }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Set the tags for docker | |
id: tags | |
run: | | |
tag=pcccr.azurecr.io/public/planetary-computer/${{ matrix.IMAGE }}:latest | |
echo "::set-output name=tag::${tag}" | |
- name: Check for changes | |
id: changes | |
run: | | |
if ! git diff --quiet HEAD~ -- ${{ matrix.IMAGE }}; then | |
echo "${{ matrix.IMAGE }} changed, building!" | |
echo "::set-output name=build::true" | |
else | |
echo "::set-output name=build::false" | |
fi | |
tag=`git name-rev --tags --name-only $(git rev-parse HEAD)` | |
if [ $tag != undefined ]; then | |
echo "Release build $tag. Skipping" | |
echo "::set-output name=build::false" | |
fi | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
if: ${{ steps.changes.outputs.build == 'true' }} | |
- name: Docker login | |
run: | |
docker login pcccr.azurecr.io --username ${{ secrets.AZURE_CLIENT_ID}} --password ${{ secrets.AZURE_CLIENT_SECRET }} | |
if: ${{ steps.changes.outputs.build == 'true' }} | |
- name: Build image | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
push: false | |
context: ${{ matrix.IMAGE }} | |
tags: ${{ steps.tags.outputs.tag }} | |
outputs: type=docker,dest=image.tar | |
if: ${{ steps.changes.outputs.build == 'true' }} | |
- name: Test image | |
id: test | |
run: | | |
docker load --input image.tar | |
docker run --rm -v ${PWD}/.github/workflows/scripts:/scripts ${{ steps.tags.outputs.tag }} /scripts/${{ matrix.IMAGE }} | |
if: ${{ steps.changes.outputs.build == 'true' }} |