Skip to content

Commit 5052b8e

Browse files
author
Thinh Nguyen
committed
add build to GH action
1 parent 77f5240 commit 5052b8e

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

.github/workflows/development.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,51 @@ on:
55
tags:
66
- '*.*.*'
77
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
include:
13+
- py_ver: 3.8
14+
distro: alpine
15+
image: djbase
16+
env:
17+
PY_VER: ${{matrix.py_ver}}
18+
DISTRO: ${{matrix.distro}}
19+
IMAGE: ${{matrix.image}}
20+
DOCKER_CLIENT_TIMEOUT: "120"
21+
COMPOSE_HTTP_TIMEOUT: "120"
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Compile image
25+
run: |
26+
export PKG_NAME=$(cat setup.py | awk -F\' '/pkg_name = / {print $2}')
27+
export PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__ = / {print $2}')
28+
export HOST_UID=$(id -u)
29+
docker-compose -f docker-compose-build.yaml up --exit-code-from element --build
30+
IMAGE=$(docker images --filter "reference=datajoint/${PKG_NAME}*" \
31+
--format "{{.Repository}}")
32+
TAG=$(docker images --filter "reference=datajoint/${PKG_NAME}*" --format "{{.Tag}}")
33+
docker save "${IMAGE}:${TAG}" | \
34+
gzip > "image-${PKG_NAME}-${PKG_VERSION}-py${PY_VER}-${DISTRO}.tar.gz"
35+
echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV
36+
- name: Add image artifact
37+
uses: actions/upload-artifact@v2
38+
with:
39+
name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}}
40+
path: "image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-\
41+
${{matrix.distro}}.tar.gz"
42+
retention-days: 1
43+
- if: matrix.py_ver == '3.8' && matrix.distro == 'alpine'
44+
name: Add pip artifacts
45+
uses: actions/upload-artifact@v2
46+
with:
47+
name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}}
48+
path: dist
49+
retention-days: 1
850
publish-release:
951
if: github.event_name == 'push'
52+
needs: build
1053
runs-on: ubuntu-latest
1154
env:
1255
TWINE_USERNAME: ${{secrets.twine_username}}

docker-compose-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PY_VER=3.8 IMAGE=djbase DISTRO=alpine PKG_NAME=$(cat setup.py | awk -F\' '/pkg_name = / {print $2}') PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__/ {print $2}') HOST_UID=$(id -u) docker-compose -f docker-compose-build.yaml up --build
1+
# PY_VER=3.8 IMAGE=djbase DISTRO=alpine PKG_NAME=$(cat setup.py | awk -F\' '/pkg_name = / {print $2}') PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__/ {print $2}') HOST_UID=$(id -u) docker-compose -f docker-compose-build.yaml up --exit-code-from element --build
22
#
33
# Intended for updating dependencies and docker image.
44
# Used to build release artifacts.

0 commit comments

Comments
 (0)