diff --git a/.github/workflows/copyrights.yml b/.github/workflows/copyrights.yml new file mode 100644 index 0000000..dc4ec56 --- /dev/null +++ b/.github/workflows/copyrights.yml @@ -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/copyrights-action@0.0.5 diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml index 8d416a0..651bede 100644 --- a/.github/workflows/hadolint.yml +++ b/.github/workflows/hadolint.yml @@ -23,7 +23,11 @@ name: hadolint 'on': push: + branches: + - master pull_request: + branches: + - master jobs: hadolint: runs-on: ubuntu-22.04 diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 8a2b825..2d874b0 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -23,7 +23,11 @@ name: make 'on': push: + branches: + - master pull_request: + branches: + - master jobs: make: runs-on: ubuntu-22.04 diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index a39ee5a..5d125d3 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -23,6 +23,11 @@ name: markdown-lint 'on': push: + branches: + - master + pull_request: + branches: + - master jobs: markdown-lint: runs-on: ubuntu-22.04 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7bdaa84..84687c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,11 @@ name: test 'on': push: + branches: + - master pull_request: + branches: + - master jobs: test: runs-on: ubuntu-22.04 diff --git a/Dockerfile b/Dockerfile index 74ce581..3277075 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/Gemfile b/Gemfile index 8db759c..9fb2870 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 697e03f..a0af28b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/Makefile b/Makefile index 798da5c..d58486f 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ .ONESHELL: .PHONY: clean all install .SILENT: -.SHELLFLAGS := -e -o pipefail -c +.SHELLFLAGS := -x -e -o pipefail -c SHELL := bash YAMLS = $(wildcard tests/*.yml) @@ -31,13 +31,14 @@ 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 $< $@ @@ -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 @@ -76,5 +80,29 @@ install: $(SAXON) | target npm --no-color install -g uglify-js npm --no-color install -g sass@1.77.2 +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 "$@" diff --git a/entry.sh b/entry.sh index e4a530b..b178abc 100755 --- a/entry.sh +++ b/entry.sh @@ -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" \