Skip to content

Commit

Permalink
Update YS to version 0.1.74 (#10)
Browse files Browse the repository at this point in the history
* Update to YS version 0.1.73

* Makefile can build/push a devel docker image

* Version 0.1.74

* Update tests/syntax-error/expected_results.json

* Makefile updates VERSION ARG in Dockerfile
  • Loading branch information
ingydotnet authored Sep 3, 2024
1 parent 6280112 commit 1352b8f
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 7 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

FROM ubuntu:24.04

# Change this to latest for any PR to this repo
ARG VERSION 0.1.71
ARG VERSION 0.1.74

# Install packages required to run the tests:
RUN apt-get update \
Expand All @@ -29,7 +28,7 @@ RUN curl -sSOL https://github.com/koalaman/shellcheck/releases/download/v0.10.0/
&& true

# Install /usr/local/bin/ys (the YAMLScript interpreter binary):
RUN curl -s https://yamlscript.org/install | BIN=1 VERSION=$(VERSION) bash
RUN curl -s https://yamlscript.org/install | BIN=1 VERSION=${VERSION} bash

WORKDIR /opt/test-runner

Expand Down
20 changes: 17 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ SHELL := bash

ROOT := $(shell pwd)

VERSION := 0.1.74

BIN := $(ROOT)/bin
SHELLCHECK := $(BIN)/shellcheck

Expand All @@ -21,7 +23,7 @@ SHELLCHECK_RELEASE := \
$(SHELLCHECK_RELEASES)/$(SHELLCHECK_VERSION)/$(SHELLCHECK_TAR)

DOCKER_USER := ingy
DOCKER_VERSION := 0.0.1
DOCKER_VERSION := $(VERSION)
DOCKER_NAME := exercism-$(shell basename $(ROOT))
DOCKER_IMAGE := $(DOCKER_USER)/$(DOCKER_NAME):$(DOCKER_VERSION)

Expand All @@ -30,7 +32,12 @@ default:

test: test-shellcheck

update: $(EXPECTED_RESULTS_FILES)
update: update-dockerfile update-expected

update-dockerfile:
perl -pi -e 's/^(ARG VERSION) .*/$$1 $(VERSION)/' Dockerfile

update-expected: $(EXPECTED_RESULTS_FILES)

clean:
$(RM) -r shellcheck*
Expand Down Expand Up @@ -61,8 +68,15 @@ $(SHELLCHECK_DIR): $(SHELLCHECK_TAR)
$(SHELLCHECK_TAR):
curl -sSOL $(SHELLCHECK_RELEASE)

ifneq (,$(EX_YS_DEV))
DOCKER_DEVEL := -f dev/main.dockerfile
endif

docker-build:
docker build --tag=$(DOCKER_IMAGE) .
docker build \
$(DOCKER_DEVEL) \
--tag=$(DOCKER_IMAGE) \
.

docker-push: docker-build
docker push $(DOCKER_IMAGE)
56 changes: 56 additions & 0 deletions dev/main.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Note:
# * YAMLScript doesn't yet run on alpine
# * ubuntu:24.04 is 78.1MB
# * debian:bookworm is 117MB
#
# This image will also be used for the YAMLScript track repo's GHA workflows.

FROM ubuntu:24.04

# ARG VERSION

# Install packages required to run the tests:
RUN apt-get update \
&& apt-get install -y apt-utils \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
curl \
jq \
make \
perl \
xz-utils \
&& true

# Install a specific version of shellcheck:
RUN curl -sSOL https://github.com/koalaman/shellcheck/releases/download/v0.10.0/shellcheck-v0.10.0.linux.x86_64.tar.xz \
&& tar xf shellcheck-v0.10.0.linux.x86_64.tar.xz \
&& mv shellcheck-v0.10.0/shellcheck /usr/local/bin/shellcheck \
&& rm -fr shellcheck-* \
&& true

# # Install /usr/local/bin/ys (the YAMLScript interpreter binary):
# RUN curl -s https://yamlscript.org/install | BIN=1 VERSION=${VERSION} bash

ENV XXX_BUILD 2

RUN DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
gcc \
git \
zlib1g-dev \
&& rm -f /.dockerenv \
&& git clone --branch=main --depth=1 https://github.com/yaml/yamlscript /yamlscript \
&& IS_ROOT=false make -C /yamlscript/ys install PREFIX=/usr/local \
&& IS_ROOT=false make -C /yamlscript sysclean \
&& rm -fr /yamlscript /root/.m2 \
&& apt-get purge -y \
gcc \
git \
zlib1g-dev \
&& true

WORKDIR /opt/test-runner

COPY . .

ENTRYPOINT ["/opt/test-runner/bin/run.sh"]
2 changes: 1 addition & 1 deletion tests/syntax-error/expected_results.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"status": "error",
"message": "Runtime error:\nWrong number of args (1) passed to: sci.impl.fns/fun/arity-0--5026\nleap-test.ys .. \nDubious, test returned 1 (wstat 256, 0x100)\nNo subtests run \nTest Summary Report\n-------------------\nleap-test.ys (Wstat: 256 (exited 1) Tests: 0 Failed: 0)\n Non-zero exit status: 1"
"message": "Runtime error:\nWrong number of args (1) passed to: sci.impl.fns/fun/arity-0--4758\nleap-test.ys .. \nDubious, test returned 1 (wstat 256, 0x100)\nNo subtests run \nTest Summary Report\n-------------------\nleap-test.ys (Wstat: 256 (exited 1) Tests: 0 Failed: 0)\n Non-zero exit status: 1"
}

0 comments on commit 1352b8f

Please sign in to comment.