Skip to content

Commit

Permalink
add test case and manifest for Node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
diguage committed Mar 7, 2022
1 parent 947c711 commit b75747b
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ARG asciidoctor_revealjs_version=4.1.0
ARG kramdown_asciidoc_version=2.0.0
ARG asciidoctor_bibtex_version=0.8.0
ARG asciidoctor_kroki_version=0.5.0
ARG nodejs_version=16.14.0-r0
ARG asciidoctor_web_pdf_version=1.0.0-alpha.14
ARG asciidoctor_kroki_npm_version=0.15.4

Expand All @@ -26,6 +27,7 @@ ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \
KRAMDOWN_ASCIIDOC_VERSION=${kramdown_asciidoc_version} \
ASCIIDOCTOR_BIBTEX_VERSION=${asciidoctor_bibtex_version} \
ASCIIDOCTOR_KROKI_VERSION=${asciidoctor_kroki_version} \
NODEJS_VERSION=${nodejs_version} \
ASCIIDOCTOR_WEB_PDF_VERSION=${asciidoctor_web_pdf_version} \
ASCIIDOCTOR_KROKI_NPM_VERSION=${asciidoctor_kroki_npm_version}

Expand Down
3 changes: 2 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:KRAMDOWN_ASCIIDOC_VERSION: 2.0.0
:ASCIIDOCTOR_BIBTEX_VERSION: 0.8.0
:ASCIIDOCTOR_KROKI_VERSION: 0.5.0
:NODEJS_VERSION: 16.14.0
:ASCIIDOCTOR_WEB_PDF_VERSION: 1.0.0-alpha.14
ifdef::env-github[]
:tip-caption: :bulb:
Expand Down Expand Up @@ -42,7 +43,7 @@ This Docker image provides:
* https://github.com/asciidoctor/asciidoctor-confluence[Asciidoctor Confluence] {ASCIIDOCTOR_CONFLUENCE_VERSION}
* https://github.com/asciidoctor/asciidoctor-bibtex[Asciidoctor Bibtex] {ASCIIDOCTOR_BIBTEX_VERSION}
* https://github.com/Mogztter/asciidoctor-kroki[Asciidoctor Kroki] {ASCIIDOCTOR_KROKI_VERSION}
* https://github.com/Mogztter/asciidoctor-web-pdf[Asciidoctor Web PDF] {ASCIIDOCTOR_WEB_PDF_VERSION}
* https://github.com/Mogztter/asciidoctor-web-pdf[Asciidoctor Web PDF] {ASCIIDOCTOR_WEB_PDF_VERSION} -- This is an unofficial project.


This image uses Alpine Linux {ALPINE_VERSION} as base image.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This Docker image provides:

- [Asciidoctor Kroki](https://github.com/Mogztter/asciidoctor-kroki) 0.5.0

- [Asciidoctor Web PDF](https://github.com/Mogztter/asciidoctor-web-pdf) 1.0.0-alpha.14
- [Asciidoctor Web PDF](https://github.com/Mogztter/asciidoctor-web-pdf) 1.0.0-alpha.14 -- This is an unofficial project.

This image uses Alpine Linux 3.13.5 as base image.

Expand Down
6 changes: 6 additions & 0 deletions tests/asciidoctor.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ASCIIDOCTOR_REVEALJS_VERSION=4.1.0
KRAMDOWN_ASCIIDOC_VERSION=2.0.0
ASCIIDOCTOR_BIBTEX_VERSION=0.8.0
ASCIIDOCTOR_KROKI_VERSION=0.5.0
NODEJS_VERSION=16.14.0
ASCIIDOCTOR_WEB_PDF_VERSION=1.0.0-alpha.14
DOCKER_IMAGE_NAME_TO_TEST="${IMAGE_NAME:-asciidoctor}"

Expand Down Expand Up @@ -55,6 +56,11 @@ teardown() {
| grep "${ASCIIDOCTOR_WEB_PDF_VERSION}"
}

@test "Node.js is installed and in version ${NODEJS_VERSION}" {
docker run -t --rm "${DOCKER_IMAGE_NAME_TO_TEST}" node -v \
| grep "${NODEJS_VERSION}"
}

@test "asciidoctor-revealjs is callable without error" {
docker run -t --rm "${DOCKER_IMAGE_NAME_TO_TEST}" asciidoctor-revealjs -v \
| grep "${ASCIIDOCTOR_REVEALJS_VERSION}"
Expand Down
91 changes: 91 additions & 0 deletions updatecli/updatecli.d/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: "Bump Node.js version"

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ requiredEnv .github.owner }}"
repository: "{{ requiredEnv .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
latestVersion:
kind: githubRelease
name: "Get the latest Node.js version"
spec:
owner: "nodejs"
repository: "node"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionFilter:
kind: regex
pattern: '*LTS*'
transformers:
- trimPrefix: "v"

conditions:
testDockerfileArgVersion:
name: "Does the Dockerfile have an ARG instruction which key is nodejs_version?"
kind: dockerfile
spec:
file: Dockerfile
instruction:
keyword: "ARG"
matcher: "nodejs_version"
testVersionInReadme:
name: "Does the README.adoc have a variable NODEJS_VERSION"
kind: file
spec:
file: README.adoc
matchPattern: '(?m:^:NODEJS_VERSION:.*)'
testVersionInTestHarness:
name: "Does the test harness have variable NODEJS_VERSION"
kind: file
spec:
file: tests/asciidoctor.bats
matchPattern: '(?m:^NODEJS_VERSION=.*)'

targets:
updateDockerfile:
name: "Update the value of ARG nodejs_version in the Dockerfile"
kind: dockerfile
spec:
file: Dockerfile
instruction:
keyword: "ARG"
matcher: "nodejs_version"
scmID: default
updateTestHarness:
name: "Update the key NODEJS_VERSION in the test harness"
kind: file
spec:
file: tests/asciidoctor.bats
matchPattern: '(?m:^NODEJS_VERSION=.*)'
content: 'NODEJS_VERSION={{ source `latestVersion` }}'
scmID: default
updateReadme:
name: "Update the key NODEJS_VERSION in the README.adoc file"
kind: file
spec:
file: README.adoc
matchPattern: '(?m:^:NODEJS_VERSION:.*)'
content: ':NODEJS_VERSION: {{ source `latestVersion` }}'
scmID: default

pullrequests:
default:
kind: github
scmID: default
targets:
- updateDockerfile
- updateTestHarness
- updateReadme
spec:
labels:
- chore
- dependencies

0 comments on commit b75747b

Please sign in to comment.