-
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.
* initial development * put test.yml in .github/workflow folder * removed cobra since not using * adding sudo to test to see if it lets us write to github action file system * added github action for releasing artifacts * fixing missed named job in github workflow * adding v to version of automatic release action * updating github ref for release action * tring to get branch name into action * updated licences, testing override of release action * updated readme, added tagged-release workflow
- Loading branch information
1 parent
d1f4ea1
commit 2d54992
Showing
22 changed files
with
1,523 additions
and
1 deletion.
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,41 @@ | ||
# [Choice] Ubuntu version: bionic, focal | ||
ARG VARIANT="bionic" | ||
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} | ||
|
||
# install common packages | ||
RUN apt-get update && apt install -y \ | ||
software-properties-common \ | ||
gcc | ||
|
||
# install go | ||
ARG GO_VERSION=1.17.6 | ||
RUN wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz && \ | ||
sha256sum go$GO_VERSION.linux-amd64.tar.gz && \ | ||
tar -xvf go$GO_VERSION.linux-amd64.tar.gz && \ | ||
mv go /usr/local && \ | ||
rm go$GO_VERSION.linux-amd64.tar.gz | ||
|
||
# set up env vars | ||
ENV GOROOT=/usr/local/go | ||
ENV GOPATH=/go | ||
ENV PATH="$GOPATH/bin:$GOROOT/bin:$PATH" | ||
|
||
# install go deps | ||
RUN go get -x \ | ||
github.com/spf13/cobra/cobra \ | ||
github.com/spf13/cobra \ | ||
github.com/spf13/viper \ | ||
github.com/ramya-rao-a/go-outline \ | ||
github.com/stamblerre/gocode \ | ||
github.com/uudashr/gopkgs/v2/cmd/gopkgs \ | ||
golang.org/x/tools/cmd/goimports \ | ||
github.com/cweill/gotests/gotests \ | ||
golang.org/x/tools/cmd/guru | ||
|
||
# gopls is a special flower and does not like to be installed with the others | ||
RUN go get -x golang.org/x/tools/gopls | ||
|
||
# install debugger | ||
RUN GO111MODULE=on GOBIN=/tmp/ go get github.com/go-delve/delve/cmd/dlv@master && \ | ||
mv /tmp/dlv $GOPATH/bin/dlv-dap | ||
|
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,39 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/ubuntu | ||
{ | ||
"name": "Ubuntu", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
// Update 'VARIANT' to pick an Ubuntu version: focal, bionic | ||
"args": { | ||
"VARIANT": "bionic", | ||
} | ||
}, | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go", | ||
"go.goroot": "/usr/local/go" | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"2gua.rainbow-brackets", | ||
"oderwat.indent-rainbow", | ||
"golang.Go", | ||
"redhat.vscode-yaml" | ||
], | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": [ | ||
// "go get -u -v golang.org/x/tools/gopls" | ||
// ], | ||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
// "remoteUser": "vscode", | ||
"mounts": [ | ||
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh/,target=/root/.ssh/,type=bind,consistency=cached", | ||
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.gh/,target=/root/.gh/,type=bind,consistency=cached", | ||
], | ||
} |
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,54 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: "*" | ||
|
||
env: | ||
go-version: 1.17 | ||
|
||
jobs: | ||
build_and_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.go-version }} | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
run: sudo go test -v -cover ./... | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: [build_and_test] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.go-version }} | ||
|
||
- name: build and package | ||
run: bash ./package_release.sh | ||
|
||
- name: set release vars | ||
id: release-vars | ||
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/} | ||
|
||
- uses: "marvinpinto/[email protected]" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: ${{ steps.release-vars.outputs.short_ref }} | ||
prerelease: true | ||
title: ${{ steps.release-vars.outputs.short_ref }} | ||
files: | | ||
LICENSE | ||
./artifacts/*.zip | ||
./artifacts/*.tar.gz |
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,60 @@ | ||
name: "tagged-release" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
env: | ||
go-version: 1.17 | ||
|
||
jobs: | ||
build_and_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.go-version }} | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
run: sudo go test -v -cover ./... | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: [build_and_test] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.go-version }} | ||
|
||
- name: build and package | ||
run: bash ./package_release.sh | ||
|
||
- uses: "marvinpinto/[email protected]" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
files: | | ||
LICENSE | ||
./artifacts/*.zip | ||
./artifacts/*.tar.gz | ||
- uses: "marvinpinto/[email protected]" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
automatic_release_tag: latest | ||
title: latest | ||
files: | | ||
LICENSE | ||
./artifacts/*.zip | ||
./artifacts/*.tar.gz |
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 |
---|---|---|
|
@@ -13,3 +13,5 @@ | |
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
artifacts/ |
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,21 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Package", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "auto", | ||
"program": "${workspaceRoot}", | ||
|
||
// this is like running "sgadmin dockerDb create" | ||
//"args": ["dockerdb", "create"] | ||
|
||
// this is like running "sgadmin dockerDb destroy' | ||
// "args": ["dockerdb", "destroy"] | ||
} | ||
] | ||
} |
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,2 +1,103 @@ | ||
# icombo | ||
Declarative Image Combination Tool | ||
|
||
Declarative Image Combination | ||
|
||
## Why? | ||
|
||
I have been dabbling in board game design as a hobby with my family. The most toilsome part of the process for me is editing images for all the little icons. For example, let's say I need a set of icons to show that you can covert 2 logs into a board. I would need to open an image editor paste the various parts in there, make sure sizing is correct, etc. Then if I wanted to change the conversion to 3 logs into a board, I would have to open the image editor again. So I developed icombo to speed up this process and provide a declarative format (toml) that will handle joining the images, rotation and sizing to provide consistent results. | ||
|
||
Now my workflow looks like this: | ||
* go to [game-icons.net](https://game-icons.net/) and find the parts for the image I want to create | ||
|
||
<img src="./example/image_parts/log.png" width="50"> | ||
<img src="./example/image_parts/arrow.png" width="50"> | ||
<img src="./example/image_parts/board.png" width="50"> | ||
|
||
* drop them into my image_parts directory | ||
* add a few lines to my [icombo.toml](./example/icombo.toml) file | ||
```toml | ||
[[images]] | ||
name = "logs_to_boards" | ||
|
||
[[images.image_parts]] | ||
file_name = "log" | ||
count = 2 | ||
|
||
# arrow faces up by default and rotates counter clockwise | ||
[[images.image_parts]] | ||
file_name = "arrow" | ||
rotation_degrees = 270 | ||
|
||
[[images.image_parts]] | ||
file_name = "board" | ||
``` | ||
* run icombo to produce logs_to_boards.png | ||
|
||
<img src="./example/output_images/logs_to_boards.png" width="200"> | ||
|
||
### Why TOML? | ||
While my personal preference would by yml, I think toml is easer for non coder types | ||
|
||
### Setup | ||
|
||
* Head over the the [release page](https://github.com/James-Pickett/icombo/releases/tag/latest) | ||
* Download the artifact suffixed with `example_project` for your OS | ||
* Extract the compressed file and run icombo | ||
* Just the binaries are also available if you don't want an example project | ||
|
||
### Usage | ||
|
||
* add the images you wish to combine to your `image_input_directory` in the [example](https://github.com/James-Pickett/icombo/blob/main/example/icombo.toml#L1) this is `./image_parts` | ||
* add your image definition to the `icombo.toml` file | ||
```toml | ||
[[images]] | ||
# this image will be output to the image_output_directory as my_new_image.png | ||
name = "my_new_image" | ||
|
||
# image parts are read from top to bottom bulding the image from left to right | ||
[[images.image_parts]] | ||
# icombo will serach for log.png in the configured image_input_directory | ||
file_name = "first_part" | ||
# icombo will repeat the image based on count, if count is 1 you can remove this line | ||
count = 2 | ||
# icombo will rotate the image based on rotation_degrees counter clockwise | ||
rotation_degrees = 180 | ||
|
||
# simplest way to define a part, will add it once not changing rotation | ||
[[images.image_parts]] | ||
file_name = "second_part" | ||
``` | ||
* save your file and run icombo then check your image_output_directory | ||
* you can also define the following configurations in the icombo.toml file | ||
```toml | ||
# where icombo will look for the parts to build images | ||
image_input_directory = "./image_parts" | ||
# where icombo will output images | ||
image_output_directory = "./output_images" | ||
# the pixel size of a side of an image part | ||
# this configuration will make each image part a square whose sides are 64 pixels | ||
# if my image had 4 parts, the height would be 64 pixels and the width 256 pixels (4 * 64) | ||
image_part_size_pixels = 64 | ||
# number of images that can be built simultaneously, if left at zero icombo will attempt to build all images simultaneously | ||
concurrency = 0 | ||
``` | ||
|
||
|
||
## Limitations | ||
* only handles .png files | ||
* only builds images horizontally from left to right | ||
* cannot configure individual images with size | ||
* no support for setting background color | ||
* transparency untested | ||
|
||
## Possible Improvments | ||
* address limitations above | ||
* instead of reading each image part from disk everytime, store them in memory | ||
- this may or may not be helpful, need to test, possibly trading memory for speed | ||
* add flags for config file path, now it must be at `./icombo.toml` | ||
* add functionality for handling other config formats (yml, json, etc) | ||
|
||
## Credits | ||
* [game-icons.net](https://game-icons.net/) for the art | ||
* @ozonru for the [imaging package](https://github.com/disintegration/imaging) that made the image manipulation super easy | ||
* @spf13 for the [viper package's](https://github.com/spf13/viper) awesome config tooling |
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,47 @@ | ||
image_input_directory = "./image_parts" | ||
image_output_directory = "./output_images" | ||
image_part_size_pixels = 64 | ||
concurrency = 0 | ||
|
||
[[images]] | ||
name = "logs_to_boards" | ||
|
||
[[images.image_parts]] | ||
file_name = "log" | ||
count = 2 | ||
|
||
# arrow faces up by default and rotates counter clockwise | ||
[[images.image_parts]] | ||
file_name = "arrow" | ||
rotation_degrees = 270 | ||
|
||
[[images.image_parts]] | ||
file_name = "board" | ||
|
||
[[images]] | ||
name = "boards_to_house" | ||
|
||
[[images.image_parts]] | ||
file_name = "board" | ||
count = 2 | ||
|
||
[[images.image_parts]] | ||
file_name = "arrow" | ||
rotation_degrees = 270 | ||
|
||
[[images.image_parts]] | ||
file_name = "house" | ||
|
||
[[images]] | ||
name = "houses_to_village" | ||
|
||
[[images.image_parts]] | ||
file_name = "house" | ||
count = 2 | ||
|
||
[[images.image_parts]] | ||
file_name = "arrow" | ||
rotation_degrees = 270 | ||
|
||
[[images.image_parts]] | ||
file_name = "village" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.