Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aurélien 'Bubu' Busi
committed
Jun 19, 2019
1 parent
c06d390
commit fc34b2e
Showing
15 changed files
with
320 additions
and
7 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,65 @@ | ||
workflow "build and release" { | ||
on = "push" | ||
resolves = ["release"] | ||
} | ||
|
||
action "build docker image" { | ||
uses = "actions/docker/cli@master" | ||
args = "build -t tartiflette ." | ||
} | ||
|
||
action "unit test" { | ||
needs = ["build docker image"] | ||
uses = "actions/docker/cli@master" | ||
args = "run -i tartiflette make test-unit" | ||
} | ||
|
||
action "functional test" { | ||
needs = ["build docker image"] | ||
uses = "actions/docker/cli@master" | ||
args = "run -i tartiflette make test-functional" | ||
} | ||
|
||
action "style" { | ||
needs = ["build docker image"] | ||
uses = "actions/docker/cli@master" | ||
args = "run -i tartiflette make style" | ||
} | ||
|
||
action "build and publish to pypi" { | ||
uses = "./github-actions/pypi/" | ||
secrets = ["TWINE_PASSWORD", "TWINE_USERNAME"] | ||
needs = ["unit test", "functional test", "style"] | ||
} | ||
|
||
action "is master" { | ||
uses = "actions/bin/filter@master" | ||
needs = ["build and publish to pypi"] | ||
args = "branch master" | ||
} | ||
|
||
action "is ref master" { | ||
uses = "./github-actions/shell/" | ||
needs = ["is master"] | ||
runs = "is_ref" | ||
env = { | ||
REF_NAME = "refs/heads/master" | ||
} | ||
} | ||
|
||
action "set version and changelog" { | ||
uses = "./github-actions/shell/" | ||
needs = ["is ref master"] | ||
runs = "make" | ||
args = "github-action-version-and-changelog" | ||
} | ||
|
||
action "release" { | ||
uses = "./github-actions/release/" | ||
secrets = ["GITHUB_TOKEN"] | ||
needs = ["set version and changelog"] | ||
env = { | ||
USERNAME = "tartiflette" | ||
REPOSITORY = "tartiflette" | ||
} | ||
} |
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,11 +1,15 @@ | ||
# tartiflette-plugin-time-it | ||
# Tartiflette-plugin-time-it Changelog | ||
|
||
## Released Versions | ||
All notable changes to this project will be documented in this file. | ||
|
||
### [x.y.Z] | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | ||
|
||
#### Fixed | ||
## [Unreleased] | ||
|
||
#### Changed | ||
- [Next](./changelogs/next.md) | ||
|
||
#### Added | ||
## [Released] | ||
|
||
- [0.0.x] | ||
- [0.0.1](./changelogs/0.0.1.md) - 2019-06-19 |
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
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,3 +1,20 @@ | ||
# tartiflette-plugin-time-it | ||
|
||
Write here a little laius about how your plugin is working and how it can be configured | ||
Allows you to view field time execution in your log as easily as : | ||
|
||
``` | ||
type Example { | ||
aField: String @timeIt | ||
} | ||
``` | ||
|
||
By default the `timeIt` directive will use it's own logger retrieved by `logging.getLogger("__name__")`. | ||
|
||
If called with `useLogger: false` it will use the print statement. | ||
|
||
At init time, using the `create_engine` api, you can pass your own logger to the directive. | ||
|
||
```python | ||
|
||
engine = await create_engine(sdl, modules=[{"name": "tartiflette_plugin_time_it", "config": {"logger": myLogger()}}]) | ||
``` |
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,3 @@ | ||
# [0.0.1] - 2019-06-19 | ||
|
||
First Release of this plugin |
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 @@ | ||
# [Next] | ||
|
||
## Added | ||
|
||
## Changed | ||
|
||
## Fixed |
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,22 @@ | ||
FROM python:3.7.2 | ||
|
||
LABEL "name"="pypi" | ||
LABEL "maintainer"="Stan Chollet <stanislas.chollet@gmail.com>" | ||
LABEL "version"="1.0.0" | ||
|
||
LABEL "com.github.actions.name"="Pypi Release" | ||
LABEL "com.github.actions.description"="Push package to pypi server." | ||
LABEL "com.github.actions.icon"="upload" | ||
LABEL "com.github.actions.color"="green" | ||
|
||
RUN apt-get update && apt-get install -y cmake bison flex git jq | ||
|
||
RUN pip install --upgrade setuptools wheel twine | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
RUN chmod +x /entrypoint.sh | ||
|
||
WORKDIR /github/workspace | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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 @@ | ||
Fork of https://github.com/mariamrf/py-package-publish-action |
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,36 @@ | ||
#!/bin/bash | ||
|
||
if [ -d "./libgraphqlparser" ]; then | ||
rm -rf ./libgraphqlparser | ||
fi | ||
|
||
make init | ||
|
||
set_version_if_not_master() { | ||
cat /github/workflow/event.json | jq -e '. | select(.ref=="refs/heads/master")' | ||
return_code=$? | ||
|
||
if [ $return_code -ne 0 ]; then | ||
export TWINE_REPOSITORY_URL="https://test.pypi.org/legacy/" | ||
make set-version | ||
fi | ||
} | ||
|
||
check_if_setup_file_exists() { | ||
if [ ! -f setup.py ]; then | ||
echo "setup.py must exist in the directory that is being packaged and published." | ||
exit 1 | ||
fi | ||
} | ||
|
||
upload_package() { | ||
python setup.py sdist | ||
twine upload dist/* | ||
} | ||
|
||
set_version_if_not_master | ||
|
||
make get-version | ||
|
||
check_if_setup_file_exists | ||
upload_package |
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,23 @@ | ||
FROM golang:1.11 | ||
|
||
LABEL "name"="github-release" | ||
LABEL "maintainer"="Stan Chollet <stanislas.chollet@gmail.com>" | ||
LABEL "version"="1.0.0" | ||
|
||
LABEL "com.github.actions.name"="Github Release" | ||
LABEL "com.github.actions.description"="Create a release on github" | ||
LABEL "com.github.actions.icon"="upload" | ||
LABEL "com.github.actions.color"="green" | ||
|
||
RUN go get github.com/aktau/github-release | ||
|
||
COPY "entrypoint.sh" "/entrypoint.sh" | ||
|
||
WORKDIR /github/workspace | ||
RUN mkdir -p /github/workspace | ||
|
||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
CMD [""] |
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,50 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
_PATH_TAG="${HOME}/tag" | ||
_PATH_USERNAME="${HOME}/username" | ||
_PATH_REPOSITORY="${HOME}/repository" | ||
_PATH_CHANGELOG="${HOME}/changelog" | ||
_PATH_NAME="${HOME}/name" | ||
|
||
if [ -f $_PATH_TAG ]; then | ||
TAG=$(cat $_PATH_TAG) | ||
fi | ||
|
||
if [ -f $_PATH_USERNAME ]; then | ||
USERNAME=$(cat $_PATH_USERNAME) | ||
fi | ||
|
||
if [ -f $_PATH_REPOSITORY ]; then | ||
REPOSITORY=$(cat $_PATH_REPOSITORY) | ||
fi | ||
|
||
if [ -f $_PATH_NAME ]; then | ||
NAME=$(cat $_PATH_NAME) | ||
fi | ||
|
||
echo "---------------------------" | ||
echo "TAG: $TAG" | ||
echo "REPOSITORY: $REPOSITORY" | ||
echo "USERNAME: $USERNAME" | ||
echo "NAME: $NAME" | ||
echo "---------------------------" | ||
|
||
if [ -f $_PATH_CHANGELOG ]; then | ||
echo "Release with changelog" | ||
desc=$(cat $_PATH_CHANGELOG) | ||
github-release release \ | ||
--user $USERNAME \ | ||
--repo $REPOSITORY \ | ||
--tag $TAG \ | ||
--name $NAME \ | ||
--description "${desc}" | ||
else | ||
echo "Release without changelog" | ||
github-release release \ | ||
--user $USERNAME \ | ||
--repo $REPOSITORY \ | ||
--tag $TAG \ | ||
--name $NAME | ||
fi |
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 @@ | ||
FROM ruby:2-slim | ||
|
||
LABEL "name"="Shell Action" | ||
LABEL "maintainer"="Stan Chollet <stanislas.chollet@gmail.com>" | ||
LABEL "version"="1.0.0" | ||
|
||
LABEL "com.github.actions.name"="Shell Action" | ||
LABEL "com.github.actions.description"="Action for executing shell/make commands" | ||
LABEL "com.github.actions.icon"="filter" | ||
LABEL "com.github.actions.color"="gray-dark" | ||
|
||
COPY README.md / | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
bats \ | ||
build-essential \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg2 \ | ||
jq \ | ||
git \ | ||
make \ | ||
shellcheck && \ | ||
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ | ||
apt-get install -y \ | ||
nodejs && \ | ||
npm install -g dockerfile_lint && \ | ||
apt-get clean -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY is_ref.sh /usr/bin/is_ref | ||
RUN chmod +x /usr/bin/is_ref | ||
|
||
CMD ["make", "run"] |
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,3 @@ | ||
.PHONY: run | ||
run: | ||
true |
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,3 @@ | ||
## Github Action | ||
|
||
Action which allow you to execute some make commands |
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 @@ | ||
#!/bin/sh | ||
|
||
cat /github/workflow/event.json | jq -e ". | select(.ref==\"$REF_NAME\")" | ||
|
||
return_code=$? | ||
|
||
if [ $return_code -ne 0 ]; then | ||
exit 78 | ||
fi | ||
|
||
exit 0 |