improve pipeline speed #22
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: CI | |
on: | |
push: | |
branches: | |
- master | |
env: | |
GDAL_VERSION: 3.8.4 | |
GDAL_VERSION_TAG: 3.8 | |
GO_VERSION: 1.22.0 | |
GO_VERSION_TAG: 1.22 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Set environment variable with lowercase username | |
run: | | |
USERNAME_LOWER=$(echo "${{ github.actor }}" | tr '[:upper:]' '[:lower:]') | |
echo "USERNAME_LOWER=${USERNAME_LOWER}" >> $GITHUB_ENV | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/setup-buildx-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-central-1 | |
- name: Build Gdal AL2023 Docker | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64 | |
context: . | |
load: true | |
file: dockerfiles/Dockerfile | |
build-args: | | |
GDAL_VERSION=${{ env.GDAL_VERSION }} | |
tags: ghcr.io/${{ env.USERNAME_LOWER }}/al2023-gdal:${{ env.GDAL_VERSION_TAG }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Test Gdal Docker | |
run: | | |
docker run \ | |
--platform=linux/amd64 \ | |
--entrypoint bash \ | |
-v ${{ github.workspace }}:/local \ | |
--rm ghcr.io/${{ env.USERNAME_LOWER }}/al2023-gdal:${{ env.GDAL_VERSION_TAG }} \ | |
/local/tests/tests.sh | |
- name: Publish gdal docker image | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64 | |
context: . | |
file: dockerfiles/Dockerfile | |
build-args: | | |
GDAL_VERSION=${{ env.GDAL_VERSION }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ghcr.io/${{ env.USERNAME_LOWER }}/al2023-gdal:${{ env.GDAL_VERSION_TAG }} | |
- name: Publish gdal docker image for GO build | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64 | |
context: . | |
file: dockerfiles/runtimes/go.Dockerfile | |
build-args: | | |
GDAL_VERSION=${{ env.GDAL_VERSION_TAG }} | |
GO_VERSION=${{ env.GO_VERSION }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ghcr.io/${{ env.USERNAME_LOWER }}/al2023-gdal-go:${{ env.GDAL_VERSION_TAG }}-${{ env.GO_VERSION_TAG }} | |
- name: Build and Deploy layers | |
run: | | |
python -m pip install boto3 click | |
docker run \ | |
--platform=linux/amd64 \ | |
--entrypoint bash \ | |
-v ${{ github.workspace }}:/local \ | |
--rm ghcr.io/${{ env.USERNAME_LOWER }}/al2023-gdal:${{ env.GDAL_VERSION_TAG }} \ | |
/local/scripts/create-layer.sh | |
python scripts/deploy-layer.py ${{ env.GDAL_VERSION_TAG }} |