Repository navigation
Add test that reproduces load_stac issue. https://github.com/cloudins… #421
This file contains hidden or 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: Docker Build Test Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| pull_request: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: openeo_insar # ${{ github.repository }} | |
| jobs: | |
| build-and-publish-job: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| TIME_TAG: ${{ steps.time-tag-step.outputs.TIME_TAG }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: OpenEO_Dockerfile | |
| load: true | |
| tags: ${{ env.IMAGE_NAME }} | |
| labels: runnumber=${{ github.run_id }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Push image | |
| id: time-tag-step | |
| # Assume that this job takes more than a minute to run. Then concurrency will ensure a unique TIME_TAG. | |
| # The docker build takes 3 minutes, so this should be safe. | |
| run: | | |
| set -euxo pipefail | |
| IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
| IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| TIME_TAG=$(date +'%Y%m%dT%H%M') | |
| if [[ "${GITHUB_REF##*/}" != "main" && "${GITHUB_REF##*/}" != "master" ]]; then | |
| TIME_TAG="${TIME_TAG}-${GITHUB_REF##*/}" | |
| fi | |
| echo "TIME_TAG=$TIME_TAG" >> $GITHUB_OUTPUT | |
| docker tag $IMAGE_NAME $IMAGE_ID:$TIME_TAG | |
| docker push $IMAGE_ID:$TIME_TAG | |
| test-job: | |
| runs-on: ubuntu-latest | |
| needs: build-and-publish-job | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| TIME_TAG: ${{ needs.build-and-publish-job.outputs.TIME_TAG }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Log in to registry | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Run run_pytest.sh | |
| run: | | |
| set -euxo pipefail | |
| IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
| IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| docker run --rm \ | |
| -v $(pwd):/src \ | |
| -w /src \ | |
| -e AWS_ACCESS_KEY_ID="${{ secrets.AWS_ACCESS_KEY_ID }}" \ | |
| -e AWS_SECRET_ACCESS_KEY="${{ secrets.AWS_SECRET_ACCESS_KEY }}" \ | |
| $IMAGE_ID:$TIME_TAG bash /src/run_pytest.sh |