Skip to content

Commit

Permalink
Merge pull request #58 from zerocracy/57
Browse files Browse the repository at this point in the history
docker test
  • Loading branch information
yegor256 authored Jul 23, 2024
2 parents 2626032 + 3a66bd7 commit e11e450
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/copyrights.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# MIT License
#
# Copyright (c) 2024 Zerocracy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
name: copyrights
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
copyrights:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: yegor256/[email protected]
4 changes: 4 additions & 0 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
name: hadolint
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
hadolint:
runs-on: ubuntu-22.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
name: make
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
make:
runs-on: ubuntu-22.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
name: markdown-lint
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
markdown-lint:
runs-on: ubuntu-22.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
name: test
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-22.04
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ COPY entry.sh /home
COPY judges /home/judges
COPY sass /home/sass
COPY xsl /home/xsl
RUN make --directory=/home --no-silent install all
COPY js /home/js
RUN make --directory=/home --no-silent install target/css/main.css target/js/main.js
COPY target /home/target

ENTRYPOINT ["/home/entry.sh", "/home"]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

source 'https://rubygems.org'
source 'http://rubygems.org'

gem 'fbe', '>0'
gem 'judges', '>0'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GEM
remote: https://rubygems.org/
remote: http://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
Expand Down
34 changes: 31 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@
.ONESHELL:
.PHONY: clean all install
.SILENT:
.SHELLFLAGS := -e -o pipefail -c
.SHELLFLAGS := -x -e -o pipefail -c
SHELL := bash

YAMLS = $(wildcard tests/*.yml)
FBS = $(subst tests/,target/fb/,${YAMLS:.yml=.fb})
HTMLS = $(subst fb/,html/,${FBS:.fb=.html})
XSLS = $(subst xsl/,target/xsl/,$(wildcard xsl/*.xsl))
JUDGES = judges
DIRS = target target/html target/fb target/xsl target/css
DIRS = target target/html target/fb target/xsl target/css target/js
CSS = target/css/main.css
JS = target/js/main.js
SAXON = target/saxon.jar

export

all: $(CSS) $(XSLS) $(HTMLS)
all: $(JS) $(CSS) $(XSLS) $(HTMLS) entry rmi verify

target/xsl/%.xsl: xsl/%.xsl | target/xsl
cp $< $@
Expand All @@ -59,6 +60,9 @@ target/fb/%.fb: tests/%.yml Makefile | target/fb
$(CSS): sass/*.scss | target/css
sass --no-source-map --style=compressed --no-quiet --stop-on-error $< $@

$(JS): js/*.js | target/js
uglifyjs $< > $@

clean:
rm -rf target

Expand All @@ -76,5 +80,29 @@ install: $(SAXON) | target
npm --no-color install -g uglify-js
npm --no-color install -g [email protected]

entry: target/docker-image.txt target/fb/simple.fb
img=$$(cat target/docker-image.txt)
docker run --rm -v "$$(realpath $$(pwd))/target/fb:/work" \
-e GITHUB_WORKSPACE=/work \
-e INPUT_FACTBASE=simple.fb \
-e INPUT_VERBOSE=true \
-e INPUT_OUTPUT=pages \
"$${img}"
echo "$$?" > target/entry.exit

rmi: target/docker-image.txt
img=$$(cat $<)
docker rmi "$${img}"
rm "$<"

verify:
e2=$$(cat target/entry.exit)
test "$${e2}" = "0"

target/docker-image.txt: Makefile Dockerfile entry.sh
mkdir -p "$$(dirname $@)"
sudo docker build -t pages-action "$$(pwd)"
sudo docker build -t pages-action -q "$$(pwd)" > "$@"

$(DIRS):
mkdir -p "$@"
2 changes: 1 addition & 1 deletion entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ done <<< "${INPUT_OPTIONS}"

# Build a summary HTML.
css=$(cat "${SELF}/target/css/main.css")
js=$(uglifyjs "${SELF}/js/*.js")
js=$(cat "${SELF}/target/js/main.js")
html=${INPUT_OUTPUT}/${name}.html
java -jar "${SELF}/target/saxon.jar" \
"-s:${INPUT_OUTPUT}/${name}.rich.xml" \
Expand Down

0 comments on commit e11e450

Please sign in to comment.