Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker test #58

Merged
merged 8 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 3 additions & 3 deletions 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 Expand Up @@ -29,7 +29,7 @@ GEM
net-http
faraday-retry (2.2.1)
faraday (~> 2.0)
fbe (0.0.26)
fbe (0.0.27)
backtrace (> 0)
decoor (> 0)
factbase (> 0)
Expand All @@ -56,7 +56,7 @@ GEM
gli (2.21.5)
iri (0.8.0)
json (2.7.2)
judges (0.19.0)
judges (0.20.0)
backtrace (~> 0)
concurrent-ruby (~> 1.2)
factbase (~> 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