Skip to content

Commit

Permalink
Merge pull request #6 from d4rkstar/issue_358
Browse files Browse the repository at this point in the history
resolve issue 358
  • Loading branch information
francescotimperi authored Jul 20, 2024
2 parents b0b6171 + 28a6ee9 commit a648bda
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,11 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
run: task build-and-push
- name: Build golang
run: task image-tag RT=golang && task build-and-push
- name: Build python
run: task image-tag RT=python && task build-and-push
- name: Build Nodejs
run: task image-tag RT=nodejs && task build-and-push
- name: Build php
run: task image-tag RT=php && task build-and-push
41 changes: 30 additions & 11 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ vars:
TAG:
sh: git describe --tags --abbrev=0 2>/dev/null || echo latest
J: "{}"
RUNTIMES: "golang,nodejs,php,python"

tasks:

Expand All @@ -41,13 +42,17 @@ tasks:
- if ! which python3 | grep python3 ; then echo "python3 not found" ; exit 1; fi
- sudo apt-get -y install python3-pip python3-virtualenv
- python3 -m pip install ipython watchdog requests cram

image-tag:
image-tag:
silent: true
cmds:
- git tag -d $(git tag)
- git tag -f {{.BASETAG}}.$(date +%y%m%d%H%M)
- env PAGER= git tag
- git tag -d $(git tag)
- |
if test -n "{{.RT}}"
then git tag -f {{.BASETAG}}-{{.RT}}.$(date +%y%m%d%H%M)
else git tag -f {{.BASETAG}}.$(date +%y%m%d%H%M)
fi
- env PAGER= git tag

compile: go build -o proxy

Expand Down Expand Up @@ -104,10 +109,25 @@ tasks:
VER: "{{base .ITEM}}"

build:
- task build-lang RT=golang PUSH="{{.PUSH}}" DRY={{.DRY}}
- task build-lang RT=python PUSH="{{.PUSH}}" DRY={{.DRY}}
- task build-lang RT=nodejs PUSH="{{.PUSH}}" DRY={{.DRY}}
- task build-lang RT=php PUSH="{{.PUSH}}" DRY={{.DRY}}
silent: true
requires: { vars: [TAG,RUNTIMES] }
vars:
RT_REGEX:
sh: echo "{{.RUNTIMES}}" | tr ',' '|'
SPECIFIC_RT:
sh: echo "{{.TAG}}" | grep -E -o '({{.RT_REGEX}})' || echo ''
cmds:
- |
if [ -z "{{.SPECIFIC_RT}}" ];
then
echo "==> BUILDING RUNTIMES {{.RUNTIMES}}"
for ITEM in `echo {{.RUNTIMES}} | tr ',' ' '`; do
echo "==> BUILDING $ITEM:{{.TAG}}"
task build-lang RT=$ITEM PUSH="{{.PUSH}}" DRY={{.DRY}}
done
else echo "Build {{.SPECIFIC_RT}}"
task build-lang RT={{.SPECIFIC_RT}} PUSH="{{.PUSH}}" DRY={{.DRY}}
fi
build-and-push:
- task build PUSH=y DRY={{.DRY}}
Expand Down Expand Up @@ -141,5 +161,4 @@ tasks:
desc: invoke a runtime listening in port 8080, optionally with J=<json>
cmds:
- python3 packages/invoke.py run '{{.J}}'



0 comments on commit a648bda

Please sign in to comment.