Skip to content

Update pkl from 0.31.0 to 0.31.1 #134

Update pkl from 0.31.0 to 0.31.1

Update pkl from 0.31.0 to 0.31.1 #134

Workflow file for this run

name: Test Java, Kotlin, and Swift Docker images on latest version
'on':
pull_request:
branches:
- main
- develop
jobs:
pkl-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ env.versions }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |-
mapfile -t pklversions < "pkl-versions"
json=$(jq -n -c --argjson arr "$(printf '%s
' "${pklversions[@]}" | jq -R . | jq -s '[.[0], .[-1]]')" '{"version": $arr}')
echo "versions=$(echo "$json")" >> ${GITHUB_ENV}
test-java:
needs:
- pkl-versions
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.pkl-versions.outputs.versions)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current latest supported pkl version
run: |-
mapfile -t pklversions < "pkl-versions"
echo "PKL_VERSION=${pklversions[-1]}" >> $GITHUB_ENV
- name: Render endpoint.sh
env:
call: /pkl-codegen-java
uses: emilymclean/template-render-action@v1.0.2
with:
template-file: templates/entrypoint.template.sh
output-file: java/entrypoint.sh
engine: mustache
- name: Make endpoint.sh executable
run: chmod +x java/entrypoint.sh
- name: Set tool version
run: echo "BUILD_ARGS=TOOL_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: docker buildx build java/ -t test/java:latest --load
- name: Generate and test
run: |-
set -e
# Test using new style explicitly listing -o
docker run --rm -v "./test-data/:/data" test/java:latest /data/example.pkl --generate-getters /data/test.pkl -o /data/newstyle-out
# Test using new style explicitly listing --output-dir
docker run --rm -v "./test-data/:/data" test/java:latest /data/example.pkl --generate-getters /data/test.pkl --output-dir /data/newstyle-full-out
# Test using old style without -o
docker run --rm -v "./test-data/:/data" test/java:latest /data/example.pkl --generate-getters /data/test.pkl /data/oldstyle-out
ls test-data
echo "Output folder contents:"
ls test-data/newstyle-out
echo "Output Full folder contents:"
ls test-data/newstyle-full-out
- name: Test if any output
run: |-
set -f
OUTPUT=$(ls -A "test-data/newstyle-out")
set +f
if [ -z "$OUTPUT" ]; then
echo "No output in newstyle-out, failing"
exit 1
fi
test-kotlin:
needs:
- pkl-versions
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.pkl-versions.outputs.versions)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current latest supported pkl version
run: |-
mapfile -t pklversions < "pkl-versions"
echo "PKL_VERSION=${pklversions[-1]}" >> $GITHUB_ENV
- name: Render endpoint.sh
env:
call: /pkl-codegen-kotlin
uses: emilymclean/template-render-action@v1.0.2
with:
template-file: templates/entrypoint.template.sh
output-file: kotlin/entrypoint.sh
engine: mustache
- name: Make endpoint.sh executable
run: chmod +x kotlin/entrypoint.sh
- name: Set tool version
run: echo "BUILD_ARGS=TOOL_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: docker buildx build kotlin/ -t test/kotlin:latest --load
- name: Generate and test
run: |-
set -e
# Test using new style explicitly listing -o
docker run --rm -v "./test-data/:/data" test/kotlin:latest /data/example.pkl "/data/example space.pkl" -o /data/newstyle-out
# Test using new style explicitly listing --output-dir
docker run --rm -v "./test-data/:/data" test/kotlin:latest /data/example.pkl "/data/example space.pkl" --output-dir /data/newstyle-full-out
# Test using old style without -o
docker run --rm -v "./test-data/:/data" test/kotlin:latest /data/example.pkl "/data/example space.pkl" /data/oldstyle-out
ls test-data
echo "Output folder contents:"
ls test-data/newstyle-out
echo "Output Full folder contents:"
ls test-data/newstyle-full-out
- name: Test if any output
run: |-
set -f
OUTPUT=$(ls -A "test-data/newstyle-out")
set +f
if [ -z "$OUTPUT" ]; then
echo "No output in newstyle-out, failing"
exit 1
fi
test-doc:
needs:
- pkl-versions
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.pkl-versions.outputs.versions)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current latest supported pkl version
run: |-
mapfile -t pklversions < "pkl-versions"
echo "PKL_VERSION=${pklversions[-1]}" >> $GITHUB_ENV
- name: Render endpoint.sh
env:
call: /jpkldoc
uses: emilymclean/template-render-action@v1.0.2
with:
template-file: templates/entrypoint.template.sh
output-file: doc/entrypoint.sh
engine: mustache
- name: Make endpoint.sh executable
run: chmod +x doc/entrypoint.sh
- name: Set tool version
run: echo "BUILD_ARGS=TOOL_VERSION=${{ matrix.version }}" >> $GITHUB_ENV
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: docker buildx build doc/ -t test/doc:latest --load
- name: Generate and test
run: |-
set -e
# Test using new style explicitly listing -o
docker run --rm -v "./test-data/:/data" test/doc:latest /data/example.pkl "/data/example space.pkl" /data/doc-package-info.pkl -o /data/newstyle-out
# Test using new style explicitly listing --output-dir
docker run --rm -v "./test-data/:/data" test/doc:latest /data/example.pkl "/data/example space.pkl" /data/doc-package-info.pkl --output-dir /data/newstyle-full-out
# Test using old style without -o
docker run --rm -v "./test-data/:/data" test/doc:latest /data/example.pkl "/data/example space.pkl" /data/doc-package-info.pkl /data/oldstyle-out
ls test-data
echo "Output folder contents:"
ls test-data/newstyle-out
echo "Output Full folder contents:"
ls test-data/newstyle-full-out
- name: Test if any output
run: |-
set -f
OUTPUT=$(ls -A "test-data/newstyle-out")
set +f
if [ -z "$OUTPUT" ]; then
echo "No output in newstyle-out, failing"
exit 1
fi
test-swift:
needs:
- pkl-versions
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.pkl-versions.outputs.versions)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current latest supported pkl version
run: |-
mapfile -t pklversions < "pkl-versions"
echo "PKL_VERSION=${pklversions[-1]}" >> $GITHUB_ENV
- name: Read swift-tool-version
run: |-
verlte() {
[ "$1" = "`echo -e "$1
$2" | sort -V | head -n1`" ]
}
verlt() {
[ "$1" = "$2" ] && return 1 || verlte $1 $2
}
echo "swift_tool_version=$(verlt ${{ matrix.version }} 0.29.0 && echo "0.4.2" || cat swift/swift-tool-version)" >> $GITHUB_ENV
- name: Render setup.template.sh
env:
pkl_version: ${{ matrix.version }}
uses: emilymclean/template-render-action@v1.0.2
with:
template-file: swift/setup.template.sh
output-file: swift/setup.sh
engine: mustache
- name: Make setup.sh executable
run: chmod +x swift/setup.sh
- name: Render endpoint.sh
env:
call: LD_LIBRARY_PATH=/usr/share/swift/usr/lib/swift/linux PATH=$PATH:/usr/share/swift/usr/bin/ /pkl-gen-swift
uses: emilymclean/template-render-action@v1.0.2
with:
template-file: templates/entrypoint.template.sh
output-file: swift/entrypoint.sh
engine: mustache
- name: Make endpoint.sh executable
run: chmod +x swift/entrypoint.sh
- name: Set swift image version
run: |-
verlte() {
[ "$1" = "`echo -e "$1
$2" | sort -V | head -n1`" ]
}
verlt() {
[ "$1" = "$2" ] && return 1 || verlte $1 $2
}
echo "BUILD_ARGS=SWIFT_VERSION=6.1.3" >> $GITHUB_ENV
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: docker buildx build swift/ --build-arg ${{ env.BUILD_ARGS }} -t test/swift:latest --load
- name: Generate and test
run: |-
set -e
# Test using new style explicitly listing -o
docker run --rm -v "./test-data/:/data" test/swift:latest /data/example.pkl "/data/example space.pkl" -o /data/newstyle-out
# Test using new style explicitly listing --output-dir
docker run --rm -v "./test-data/:/data" test/swift:latest /data/example.pkl "/data/example space.pkl" --output-dir /data/newstyle-full-out
# Test using old style without -o
docker run --rm -v "./test-data/:/data" test/swift:latest /data/example.pkl "/data/example space.pkl" /data/oldstyle-out
ls test-data
echo "Output folder contents:"
ls test-data/newstyle-out
echo "Output Full folder contents:"
ls test-data/newstyle-full-out
- name: Test if any output
run: |-
set -f
OUTPUT=$(ls -A "test-data/newstyle-out")
set +f
if [ -z "$OUTPUT" ]; then
echo "No output in newstyle-out, failing"
exit 1
fi
test-go:
needs:
- pkl-versions
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.pkl-versions.outputs.versions)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current latest supported pkl version
run: |-
mapfile -t pklversions < "pkl-versions"
echo "PKL_VERSION=${pklversions[-1]}" >> $GITHUB_ENV
- name: Read go-tool-version
run: |-
verlte() {
[ "$1" = "`echo -e "$1
$2" | sort -V | head -n1`" ]
}
verlt() {
[ "$1" = "$2" ] && return 1 || verlte $1 $2
}
echo "go_tool_version=$(verlt ${{ matrix.version }} 0.29.0 && echo "0.10.0" || cat go/go-tool-version)" >> $GITHUB_ENV
- name: Render template.Dockerfile
env:
pkl_version: ${{ matrix.version }}
uses: emilymclean/template-render-action@v1.0.2
with:
template-file: go/template.Dockerfile
output-file: go/Dockerfile
engine: mustache
- name: Render setup.template.sh
env:
pkl_version: ${{ matrix.version }}
uses: emilymclean/template-render-action@v1.0.2
with:
template-file: go/setup.template.sh
output-file: go/setup.sh
engine: mustache
- name: Make setup.sh executable
run: chmod +x go/setup.sh
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: docker buildx build go/ -t test/go:latest --load
- name: Generate and test
run: |-
docker run --rm -v "./test-data/:/data" test/go:latest /data/example.pkl --mapping example=github.com/emilymclean/pkl-codegen/example --output-path /data/newstyle-out
echo "Output folder contents:"
ls test-data/newstyle-out
- name: Test if any output
run: |-
set -f
OUTPUT=$(ls -A "test-data/newstyle-out")
set +f
if [ -z "$OUTPUT" ]; then
echo "No output in newstyle-out, failing"
exit 1
fi