generated from racklet/base-repo-layout
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from racklet/initial_commit
Initial commit
- Loading branch information
Showing
16 changed files
with
448 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
test | ||
*.md | ||
Makefile | ||
.git* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
on: [push] | ||
|
||
jobs: | ||
e2e: | ||
runs-on: ubuntu-latest | ||
name: Test rendering PlantUML files | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Render PlantUML files | ||
uses: ./ | ||
with: | ||
formats: "png,svg" | ||
log-level: "debug" | ||
id: render | ||
- name: Print the rendered files | ||
run: echo "The files that changed were ${{ steps.render.outputs.rendered-files }}" | ||
- name: Verify test files are present | ||
run: 'make verify' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build_image: | ||
runs-on: ubuntu-latest | ||
name: "Build and push image" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.RACKLET_CONTAINERS_GHCR }} | ||
- name: Build and push image for the given tag | ||
run: make push-major |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,3 +163,7 @@ tmp | |
*.log* | ||
dist | ||
out | ||
|
||
# Generated files | ||
test/foo.png | ||
test/foo.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## v1.0.0 | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,13 @@ _As contributors and maintainers of this project, and in the interest of fosteri | |
|
||
## Community and Access | ||
|
||
Join the [[email protected]](https://groups.io/g/racklet) mailing list for calendar invites to calls and edit access to community documents. | ||
You can ask questions and discuss features on the [#racklet](https://osfw.slack.com/messages/racklet/) Slack channel (you can get an invite at [here](https://slack.osfw.dev/)). | ||
|
||
In the future, we are also planning to start public, recurring community meetings where anyone can join and | ||
participate in the discussion by adding an agenda item to a public meeting notes document. | ||
|
||
The community meeting notes document is [here](https://hackmd.io/@racklet/Sk8jHHc7_) (see also the [meeting-notes](https://github.com/racklet/meeting-notes) repo). Look out there for when the community meetings are, and follow the Slack channel. | ||
|
||
## Guidelines | ||
|
||
If you have a feature suggestion, or general question about the project or its roadmap, head over to [GitHub Discussions](https://github.com/racklet/racklet/discussions). If you've found a bug, go to [GitHub issues](https://github.com/racklet/racklet/issues) and see if there's an open issue matching your description. If not feel free to open a new issue and add short description: | ||
|
@@ -39,7 +40,7 @@ The process to contribute code to Racklet is generally as follows: | |
3. Go back to [GitHub](https://github.com/racklet/racklet), select `Pull requests` from the top bar and click | ||
`New pull request` to the right. Select the `compare across forks` link. This will show repositories in addition to branches. | ||
4. From the `head repository` dropdown, select your forked repository. If you made a new branch, select it in the `compare` dropdown. | ||
You should always target `racklet/racklet` and `main` as the base repository and branch. | ||
You should always target `racklet/racklet` (or similar repository) and `main` as the base repository and branch. | ||
5. With your changes visible, click `Create pull request`. Give it a short, descriptive title and write a comment describing your changes. | ||
Click `Create pull request`. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1.16-alpine as builder | ||
WORKDIR /build | ||
COPY . . | ||
RUN CGO_ENABLED=0 go build -a -o render-plantuml ./cmd/render-plantuml | ||
|
||
FROM think/plantuml:1.2020.5 | ||
# Enables README support, etc. in Github Packages. See: https://docs.github.com/en/packages/guides/about-github-container-registry | ||
LABEL org.opencontainers.image.source https://github.com/racklet/render-plantuml-action | ||
|
||
COPY --from=builder /build/render-plantuml / | ||
ENTRYPOINT ["/render-plantuml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ the Open Source Firmware Slack (https://osfw.slack.com/messages/racklet/) | |
In alphabetical order: | ||
|
||
Dennis Marttinen <[email protected]> (GitHub: @twelho, Slack: twelho) | ||
Jaakko Sirén <[email protected]> (GitHub: @Jaakkonen, Slack: Jaakkonen) | ||
Lucas Käldström <[email protected]> (GitHub: @luxas, Slack: luxas) | ||
Verneri Hirvonen <[email protected]> (GitHub: @chiplet, Slack: Verneri Hirvonen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
REGISTRY ?= ghcr.io | ||
OWNER ?= racklet | ||
IMAGE_NAME ?= render-plantuml-action | ||
IMAGE = $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) | ||
TAG ?= | ||
|
||
all: build | ||
resolve-git-version: | ||
ifeq ($(shell git rev-parse --is-shallow-repository),true) | ||
# actions/checkout does a shallow clone; unshallow and make sure we're up-to-date before running git describe | ||
git fetch --unshallow | ||
endif | ||
|
||
GIT_VERSION=$(shell git describe --tags HEAD 2>/dev/null || echo "v0.0.0") | ||
ifeq ($(shell git status -s),) | ||
GIT_STATUS= | ||
else | ||
GIT_STATUS=-dirty | ||
endif | ||
GIT_TAG=$(GIT_VERSION)$(GIT_STATUS) | ||
GIT_MAJOR=$(shell echo $(GIT_VERSION) | cut -d. -f1) | ||
|
||
build: | ||
docker build -t $(IMAGE):$(GIT_TAG) --pull . | ||
|
||
push: build | ||
docker push $(IMAGE):$(GIT_TAG) | ||
ifneq ($(TAG),) | ||
docker tag $(IMAGE):$(GIT_TAG) $(IMAGE):$(TAG) | ||
docker push $(IMAGE):$(TAG) | ||
endif | ||
|
||
push-major: push | ||
ifeq ($(GIT_STATUS),) | ||
docker tag $(IMAGE):$(GIT_TAG) $(IMAGE):$(GIT_MAJOR) | ||
docker push $(IMAGE):$(GIT_MAJOR) | ||
endif | ||
|
||
test: build | ||
docker run -it -v $(shell pwd):/files $(IMAGE):$(GIT_TAG) --formats=svg,png --log-level=debug | ||
$(MAKE) verify | ||
|
||
verify: | ||
@[ -f test/foo.svg ] && [ -f test/foo.png ] && echo "Files generated!" || (echo "e2e files not generated" && exit 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,137 @@ | ||
# base-repo-layout | ||
# render-plantuml-action | ||
|
||
Template (base) repository file layout for Racklet projects. | ||
A GitHub Action for rendering `*.{plantuml,puml}` files to SVG, PNG files, or both. | ||
|
||
## Inputs | ||
|
||
### `formats` | ||
|
||
**Optional:** A comma-separated list of the formats to render. Supported formats are: `svg,png`. | ||
|
||
**Default:** `svg` | ||
|
||
Examples: | ||
|
||
- `png,svg` | ||
- `svg` | ||
- `png` | ||
|
||
### `sub-dirs` | ||
|
||
**Optional:** A comma-separated list of what directories to search for PlantUML files | ||
|
||
**Default:** `.` | ||
|
||
Examples: | ||
|
||
- `.` | ||
- `docs,content/sketches` | ||
|
||
### `skip-dirs` | ||
|
||
**Optional:** A comma-separated list of what directories to skip when searching for PlantUML files | ||
|
||
**Default:** `.git` | ||
|
||
Examples: | ||
|
||
- `.git` | ||
- `foo/dont_include,bar/dont_include` | ||
|
||
### `files` | ||
|
||
**Optional:** A comma-separated list of specific files to convert, in the form: "dest-file:src-file" | ||
|
||
**Default:** Empty | ||
|
||
Examples: | ||
|
||
- `docs/images/sketch.png:docs/drawings/sketch.puml` | ||
- `docs/backup-sketch.svg:docs/drawings/sketch.uml.bak` | ||
|
||
### `log-level` | ||
|
||
**Optional:** What log level to use. Recognized levels are "info" and "debug". | ||
|
||
**Default:** `info` | ||
|
||
Examples: | ||
|
||
- `info` | ||
- `debug` | ||
|
||
## Output | ||
|
||
### `rendered-files` | ||
|
||
A space-separated list of files that were rendered, can be passed to e.g. "git add" | ||
|
||
Example: | ||
|
||
- `test/sketch.svg test/sketch.png diagrams/intro.png` | ||
|
||
## Usage Example | ||
|
||
The following example Github Action pushes a new commit with the generated files. | ||
|
||
```yaml | ||
on: [push] | ||
|
||
jobs: | ||
render_drawio: | ||
runs-on: ubuntu-latest | ||
name: Render PlantUML files | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Render PlantUML files | ||
uses: ghcr.io/racklet/render-plantuml-action@v1 | ||
id: render | ||
with: # Showcasing the default values here | ||
formats: 'svg' | ||
sub-dirs: '.' | ||
skip-dirs: '.git' | ||
# files: '' # unset, specify "dest-file:src-file" mappings here | ||
log-level: 'info' | ||
- name: Print the rendered files | ||
run: 'echo "The following files were generated: ${{ steps.render.outputs.rendered-files }}"' | ||
- uses: EndBug/add-and-commit@v7 | ||
with: | ||
# This "special" author name and email will show up as the GH Actions user/bot in the UI | ||
author_name: github-actions | ||
author_email: 41898282+github-actions[bot]@users.noreply.github.com | ||
message: 'Automatically render PlantUML files' | ||
add: "${{ steps.render.outputs.rendered-files }}" | ||
``` | ||
## Docker | ||
You can use it standalone as well, through the Docker container: | ||
```console | ||
$ docker run -it -v $(pwd):/files ghcr.io/racklet/render-plantuml-action:v1 --help | ||
Usage of /render-plantuml: | ||
-f, --files stringToString Comma-separated list of files to render, of form 'dest-file=src-file'. The extension for src-file can be any of [plantuml puml], and for dest-file any of [png svg] (default []) | ||
--formats strings Comma-separated list of formats to render the files as, for use with --subdirs (default [svg]) | ||
--log-level Level What log level to use (default info) | ||
-r, --root-dir string Where the root directory for the files that should be rendered are. (default "/files") | ||
-s, --skip-dirs strings Comma-separated list of sub-directories of --root-dir to skip when recursively checking for files to convert (default [.git]) | ||
-d, --sub-dirs strings Comma-separated list of sub-directories of --root-dir to recursively search for files to render (default [.]) | ||
pflag: help requested | ||
``` | ||
Sample Docker usage: | ||
```console | ||
$ docker run -it -v $(pwd):/files ghcr.io/racklet/render-drawio-action:v1 | ||
{"level":"info","msg":"Got config","cfg":{"RootDir":"/files","SubDirs":["."],"SkipDirs":[".git"],"Files":{},"SrcFormats":["plantuml","puml"],"ValidSrcFormats":["plantuml","puml"],"DestFormats":["svg","png"],"ValidDestFormats":["png","svg"]}} | ||
{"level":"info","msg":"Created os.DirFS at /files"} | ||
{"level":"info","msg":"Walking subDir ."} | ||
{"level":"info","msg":"Rendering test/foo.puml -> test/foo.svg"} | ||
{"level":"info","msg":"Rendering test/foo.puml -> test/foo.png"} | ||
{"level":"info","msg":"Setting Github Action output","rendered-files":"/files/test/foo.svg /files/test/foo.png"} | ||
::set-output name=rendered-files::/files/test/foo.svg /files/test/foo.png | ||
``` | ||
|
||
## Contributing | ||
|
||
|
@@ -11,8 +142,8 @@ Other interesting resources include: | |
- [The issue tracker](https://github.com/racklet/racklet/issues) | ||
- [The discussions forum](https://github.com/racklet/racklet/discussions) | ||
- [The list of milestones](https://github.com/racklet/racklet/milestones) | ||
- _The roadmap (TODO)_ | ||
- _The changelog (TODO)_ | ||
- [The roadmap](https://github.com/orgs/racklet/projects/1) | ||
- [The changelog](CHANGELOG.md) | ||
|
||
## Getting Help | ||
|
||
|
@@ -22,14 +153,16 @@ If you have any questions about, feedback for or problems with Racklet: | |
- Ask a question on the [#racklet](https://osfw.slack.com/messages/racklet/) slack channel. | ||
- Ask a question on the [discussions forum](https://github.com/racklet/racklet/discussions). | ||
- [File an issue](https://github.com/racklet/racklet/issues/new). | ||
- Join [[email protected]](https://groups.io/g/racklet) for calendar invites to calls and edit access to community documents. | ||
- Join our _developer meetings (TODO)_. | ||
- Join our [community meetings](https://hackmd.io/@racklet/Sk8jHHc7_) (see also the [meeting-notes](https://github.com/racklet/meeting-notes) repo). | ||
|
||
Your feedback is always welcome! | ||
|
||
## Maintainers | ||
|
||
In alphabetical order: | ||
|
||
- Dennis Marttinen, [@twelho](https://github.com/twelho) | ||
- Jaakko Sirén, [@Jaakkonen](https://github.com/Jaakkonen) | ||
- Lucas Käldström, [@luxas](https://github.com/luxas) | ||
- Verneri Hirvonen, [@chiplet](https://github.com/chiplet) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: 'PlantUML rendering action' | ||
description: 'Render PlantUML files to png or svg automatically' | ||
inputs: | ||
formats: | ||
description: 'A comma-separated list of the formats to render. Supported formats are: `svg,png`.' | ||
required: false | ||
default: "svg" | ||
sub-dirs: | ||
description: 'A comma-separated list of what directories to search for PlantUML files' | ||
required: false | ||
default: '.' | ||
skip-dirs: | ||
description: 'A comma-separated list of what directories to skip when searching for PlantUML files' | ||
required: false | ||
default: '.git' | ||
files: | ||
description: 'A comma-separated list of specific files to convert, in the form: "dest-file:src-file"' | ||
required: false | ||
default: "=" # empty key-value mapping means no files | ||
log-level: | ||
description: 'What log level to use. Used levels are "info" and "debug".' | ||
required: false | ||
default: "info" | ||
outputs: | ||
rendered-files: | ||
description: 'A space-separated list of files that were rendered, can be passed to e.g. "git add"' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- --sub-dirs=${{ inputs.sub-dirs }} | ||
- --skip-dirs=${{ inputs.skip-dirs }} | ||
- --files=${{ inputs.files }} | ||
- --formats=${{ inputs.formats }} | ||
- --log-level=${{ inputs.log-level }} |
Oops, something went wrong.