Skip to content

Commit

Permalink
Change GHA workflow to use pre-built Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Jul 29, 2024
1 parent 3dfb992 commit 1293cd9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
23 changes: 5 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,15 @@ defaults:

jobs:
test:
# TODO Switch to yamlscript-test-runner image
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
container: ingy/exercism-yamlscript-test-runner:0.0.1

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- run: sudo apt-get update
- run: sudo apt-get install -y apt-utils
- run: |
sudo apt-get install -y \
curl \
jq \
make \
perl \
wget \
xz-utils
- name: Install dependencies
run: make deps
- name: Touch all
run: find * -type f | xargs touch

- name: Run checks and tests
env:
EXERCISM_YAMLSCRIPT_GHA: 1
run: make check
run: EXERCISM_YAMLSCRIPT_GHA=1 make check
32 changes: 22 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ SHELL := bash

ROOT := $(shell pwd)

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

YS := $(BIN)/ys
CFGLET := $(BIN)/configlet
SHELLCHECK := $(BIN)/shellcheck
VERIFY := $(BIN)/verify-exercises

export PATH := $(BIN):$(PATH)
ifdef EXERCISM_YAMLSCRIPT_GHA
YS := ys
SHELLCHECK := shellcheck
endif

export PATH := $(ROOT)/bin:$(PATH)

EXERCISE_DIRS := $(shell find exercises -name .meta)
EXERCISE_DIRS := $(EXERCISE_DIRS:%/.meta=%)
Expand Down Expand Up @@ -128,6 +134,7 @@ realclean: clean
$(RM) $(CFGLET)
$(RM) $(SHELLCHECK)
$(RM) $(BIN)/ys*
$(RM) -r $(CLOJURE_REPO)

exercises/practice/%/Makefile: common/exercise.mk
cp -p $< $@
Expand All @@ -139,15 +146,22 @@ $(EXERCISE_META_TESTS):
%.json: %.yaml $(YS) Makefile
$(YS) -l $< | jq > $@

$(YS):
curl -s https://yamlscript.org/install | \
PREFIX=$(ROOT) BIN=1 bash
$(CLOJURE_REPO):
git clone $(CLOJURE_REPO_URL) $@

$(CFGLET):
$(BIN)/fetch-configlet

# Dummy rule for GHA
ys shellcheck:

ifndef EXERCISM_YAMLSCRIPT_GHA
bin/ys:
curl -s https://yamlscript.org/install | \
PREFIX=$(ROOT) BIN=1 bash

ifeq (,$(wildcard $(SHELLCHECK)))
$(SHELLCHECK): $(SHELLCHECK_DIR)
bin/shellcheck: $(SHELLCHECK_DIR)
mv $</shellcheck $@
touch $@
$(RM) -r $<
Expand All @@ -158,7 +172,5 @@ $(SHELLCHECK_DIR): $(SHELLCHECK_TAR)
tar xf $<

$(SHELLCHECK_TAR):
wget $(SHELLCHECK_RELEASE)

$(CLOJURE_REPO):
git clone $(CLOJURE_REPO_URL) $@
wget --quiet $(SHELLCHECK_RELEASE)
endif

0 comments on commit 1293cd9

Please sign in to comment.