Skip to content

Commit

Permalink
Merge pull request openwallet-foundation#66 from Indicio-tech/test/gh…
Browse files Browse the repository at this point in the history
…a-image-builds

Github actions
  • Loading branch information
dbluhm authored Aug 16, 2022
2 parents 2f403b0 + 4c9795f commit 9084229
Show file tree
Hide file tree
Showing 12 changed files with 727 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ build
docs
dist
test-reports
.python-version
.python-version
docker
env
86 changes: 86 additions & 0 deletions .github/workflows/nightly-indy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Nightly Build (Indy)
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

env:
NAME: aries-cloudagent-python
PYTHON_VERSION: 3.7
INDY_VERSION: 1.16.0

jobs:
nightly:
name: Nightly (Indy)
runs-on: ubuntu-latest
steps:
- name: Gather image info
id: info
run: |
echo "::set-output name=repo-owner::${GITHUB_REPOSITORY_OWNER,,}"
- name: Check image exists
id: image-exists
uses: dbluhm/image-tag-exists@257851f02e3473a75719e26b5a566ea5457da4ef
with:
tag: ghcr.io/${{ steps.info.outputs.repo-owner }}/${{ env.NAME }}:py${{ env.PYTHON_VERSION }}-indy-${{ env.INDY_VERSION }}-nightly-${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3
if: steps.image-exists.outputs.exists != 'true'

- name: Cache Docker layers
if: steps.image-exists.outputs.exists != 'true'
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
if: steps.image-exists.outputs.exists != 'true'
uses: docker/setup-buildx-action@v1

- name: Log in to the GitHub Container Registry
if: steps.image-exists.outputs.exists != 'true'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Base Image Metadata
if: steps.image-exists.outputs.exists != 'true'
id: base-meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ steps.info.outputs.repo-owner }}/${{ env.NAME }}
tags: |
type=raw,value=py${{ env.PYTHON_VERSION }}-indy-${{ env.INDY_VERSION }}-nightly
type=sha,format=long,prefix=py${{ env.PYTHON_VERSION }}-indy-${{ env.INDY_VERSION }}-nightly-
- name: Build and Push Base Image to ghcr.io
if: steps.image-exists.outputs.exists != 'true'
uses: docker/build-push-action@v3
with:
push: true
context: .
file: docker/Dockerfile.indy
tags: ${{ steps.base-meta.outputs.tags }}
labels: ${{ steps.base-meta.outputs.labels }}
build-args: |
python_version=${{ env.PYTHON_VERSION }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
if: steps.image-exists.outputs.exists != 'true'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache-base
84 changes: 84 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Nightly Build
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

env:
NAME: aries-cloudagent-python
PYTHON_VERSION: 3.7

jobs:
nightly:
name: Nightly
runs-on: ubuntu-latest
steps:
- name: Gather image info
id: info
run: |
echo "::set-output name=repo-owner::${GITHUB_REPOSITORY_OWNER,,}"
- name: Check image exists
id: image-exists
uses: dbluhm/image-tag-exists@257851f02e3473a75719e26b5a566ea5457da4ef
with:
tag: ghcr.io/${{ steps.info.outputs.repo-owner }}/${{ env.NAME }}:py${{ env.PYTHON_VERSION }}-nightly-${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3
if: steps.image-exists.outputs.exists != 'true'

- name: Cache Docker layers
if: steps.image-exists.outputs.exists != 'true'
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
if: steps.image-exists.outputs.exists != 'true'
uses: docker/setup-buildx-action@v1

- name: Log in to the GitHub Container Registry
if: steps.image-exists.outputs.exists != 'true'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Base Image Metadata
if: steps.image-exists.outputs.exists != 'true'
id: base-meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ steps.info.outputs.repo-owner }}/${{ env.NAME }}
tags: |
type=raw,value=py${{ env.PYTHON_VERSION }}-nightly
type=sha,format=long,prefix=py${{ env.PYTHON_VERSION }}-nightly-
- name: Build and Push Base Image to ghcr.io
if: steps.image-exists.outputs.exists != 'true'
uses: docker/build-push-action@v3
with:
push: true
context: .
file: docker/Dockerfile
tags: ${{ steps.base-meta.outputs.tags }}
labels: ${{ steps.base-meta.outputs.labels }}
build-args: |
python_version=${{ env.PYTHON_VERSION }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
if: steps.image-exists.outputs.exists != 'true'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache-base
101 changes: 101 additions & 0 deletions .github/workflows/publish-indy-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Publish Indy Python
on:
workflow_dispatch:
inputs:
indy_sdk_url:
description: 'Indy SDK download URL'
required: false
type: string
indy_postgres_url:
description: 'Indy postgres download URL'
required: false
type: string
indy_version:
description: 'Indy SDK Version'
required: false
type: string
default: '1.16.0'
tag:
description: 'Image tag'
required: false
type: string

env:
INDY_SDK_TAG_URL: "https://codeload.github.com/hyperledger/indy-sdk/tar.gz/refs/tags/"

jobs:
publish-image:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']

name: Publish Indy Python
runs-on: ubuntu-latest
steps:
- name: Gather image info
id: info
run: |
echo "::set-output name=repo-owner::${GITHUB_REPOSITORY_OWNER,,}"
[ -n "${{ inputs.indy_sdk_url }}"] && echo "::set-output name=indy-sdk-url::${{ inputs.indy_sdk_url }}"
[ -z "${{ inputs.indy_sdk_url }}"] && echo "::set-output name=indy-sdk-url::${{ env.INDY_SDK_TAG_URL }}v${{ inputs.indy_version }}"
[ -n "${{ inputs.indy_postgres_url }}"] && echo "::set-output name=indy-postgres-url::${{ inputs.indy_postgres_url }}"
[ -z "${{ inputs.indy_postgres_url }}"] && echo "::set-output name=indy-postgres-url::${{ env.INDY_SDK_TAG_URL }}v${{ inputs.indy_version }}"
[ -n "${{ inputs.tag }}" ] && echo "::set-output name=tag::${{ inputs.tag }}"
[ -z "${{ inputs.tag }}" ] && echo "::set-output name=tag::py${{ matrix.python-version }}-${{ inputs.indy_version }}"
- uses: actions/checkout@v3

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache-base
key: ${{ runner.os }}-buildx-base-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-base-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to the GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Image Metadata
id: base-meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ steps.info.outputs.repo-owner }}/indy-python
tags: |
type=raw,value=${{ steps.info.outputs.tag }}
- name: Build and Push Image to ghcr.io
uses: docker/build-push-action@v3
with:
push: true
context: .
file: docker/Dockerfile.indy-base
tags: ${{ steps.base-meta.outputs.tags }}
labels: ${{ steps.base-meta.outputs.labels }}
build-args: |
python_version=${{ matrix.python-version }}
indy_version=${{ inputs.indy_version }}
indy_sdk_url=${{ steps.info.outputs.indy-sdk-url }}
indy_postgres_url=${{ steps.info.outputs.indy-postgres-url }}
cache-from: type=local,src=/tmp/.buildx-cache-base
cache-to: type=local,dest=/tmp/.buildx-cache-base-new,mode=max

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache-base
mv /tmp/.buildx-cache-base-new /tmp/.buildx-cache-base
93 changes: 93 additions & 0 deletions .github/workflows/publish-indy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Publish ACA-Py (Indy)
on:
workflow_dispatch:
inputs:
indy_version:
description: 'Indy SDK Version'
required: false
type: string
default: '1.16.0'
tag:
description: 'Image tag'
required: false
type: string

env:
ACAPY_REQS: '[askar,bbs]'


jobs:
publish-image:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']

name: Publish (Indy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Gather image info
id: info
run: |
echo "::set-output name=repo-owner::${GITHUB_REPOSITORY_OWNER,,}"
echo "::set-output name=acapy-version::$(sed -ne 's/__version__ = \"\([0-9.]\+\)\"/\1/p' aries_cloudagent/version.py)"
- name: Tag image
id: tag
run: |
[ -n "${{ inputs.tag }}" ] && echo "::set-output name=tag::${{ inputs.tag }}"
[ -z "${{ inputs.tag }}" ] && echo "::set-output name=tag::py${{ matrix.python-version }}-indy-${{ inputs.indy_version }}-${{ steps.info.outputs.acapy-version }}"
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-base-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-base-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to the GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Image Metadata
id: base-meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ steps.info.outputs.repo-owner }}/aries-cloudagent-python
tags: |
type=raw,value=${{ steps.tag.outputs.tag }}
- name: Build and Push Image to ghcr.io
uses: docker/build-push-action@v3
with:
push: true
context: .
file: docker/Dockerfile.indy
tags: ${{ steps.base-meta.outputs.tags }}
labels: ${{ steps.base-meta.outputs.labels }}
build-args: |
python_version=${{ matrix.python-version }}
indy_version=${{ inputs.indy_version }}
acapy_version=${{ steps.info.outputs.acapy-version }}
acapy_reqs=${{ env.ACAPY_REQS }}
org=${{ steps.info.outputs.repo-owner }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Loading

0 comments on commit 9084229

Please sign in to comment.