Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve issue 358 #6

Merged
merged 5 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}}'