Skip to content

Commit

Permalink
_systema/infrastructuram/github-actions-locally.sh (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed May 15, 2021
1 parent 24032ea commit 87e7fe4
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
_site/
docs/
node_modules/

# Ignore metadata generated by Jekyll
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata

# Ignore folders generated by Bundler
.bundle/
vendor/

### Specific from Hapi
_systema/node_modules/
_systema/package-lock.json
openapitools.json
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "https://rubygems.org"

gem "github-pages", group: :jekyll_plugins
gem "github-pages", group: :jekyll_plugins
gem "jekyll", "~> 3.9"
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ PLATFORMS

DEPENDENCIES
github-pages
jekyll (~> 3.9)

BUNDLED WITH
2.1.4
88 changes: 88 additions & 0 deletions _systema/infrastructuram/github-actions-locally.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/sh
#===============================================================================
#
# FILE: github-actions-locally.sh
#
# USAGE: ./_systema/infrastructuram/github-actions-locally.sh
#
# DESCRIPTION: ---
#
# OPTIONS: ---
#
# REQUIREMENTS: - docker
# - act (https://github.com/nektos/act)
# BUGS: ---
# NOTES: ---
# AUTHOR: Emerson Rocha <rocha[at]ieee.org>
# COMPANY: EticaAI
# LICENSE: Public Domain dedication
# SPDX-License-Identifier: Unlicense
# VERSION: v1.0
# CREATED: 2021-05-15 19:08 UTC started as github-actions-locally.sh
# REVISION: 2021-05-11 19:34 UTC started github-actions-locally.sh
#===============================================================================
# @see https://docs.travis-ci.com/user/deployment/script/

echo "> Read-me, not execute-me"
echo "> cat github-actions-locally.sh"
echo "> exiting ..."
exit 0


#### Install act _______________________________________________________________
echo "Docker install"
xdg-open https://docs.docker.com/engine/install/


#### Install nektos/act ________________________________________________________
echo "Docker install"
xdg-open https://github.com/nektos/act

#### Tests _____________________________________________________________________
docker --version
act --version

act -l

## Good response (repository that already have github actions)
# fititnt@bravo:/workspace/git/HXL-CPLP/Auxilium-Humanitarium-API$ act -l
# ID Stage Name
# build 0 Build

## Bad response example (trying to use act on not ready repository)
# fititnt@bravo:/workspace/git/HXL-CPLP/Auxilium-Humanitarium-API$ cd /tmp
# fititnt@bravo:/tmp$ act -l
# Error: stat /tmp/.github/workflows: no such file or directory


#### Running act (simulate GitHub actions locally) _____________________________
# Note: depending of how docker was configured, act will require sudo
# because docker requires sudo.

### simple usage (without publish to github pages) -----------------------------

act
# sudo act

## Extra commands for debug and delete all images
## (DO NOT use these if you use docker for anything else)
# List all containers (include stopped)
# sudo docker ps -a
# Show all local images
# sudo docker image ls
# Stop running conteiners
# sudo docker stop $(sudo docker ps -a -q)
# Delete all stoppend conteiners
# sudo docker rm $(sudo docker ps -a -q)

### Publishing to github pages -------------------------------------------------
# When running github actions that do not only test code, but publish to remote
# servers, it may be requried some secrets.

# act --secret secrets.ACTIONS_DEPLOY_KEY="..."
# # sudo act --secret secrets.ACTIONS_DEPLOY_KEY="..."
act --secret secrets-file="$HOME/.ssh/eticaai/.hapi.env"
# sudo act --secret secrets-file="$HOME/.ssh/eticaai/.hapi.env"

# Note: the first run, even with secrets files, did not published to GitHub.
# but all steps before worked.
6 changes: 6 additions & 0 deletions _systema/infrastructuram/temporarium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,9 @@ sudo snap install travis --edge

### simple sh script -----------------------------------------------------------
# @see https://docs.travis-ci.com/user/deployment/script/


#### From Jekyll (GitHub Pages) to custom plugins ______________________________
# @see https://jekyllrb.com/tutorials/using-jekyll-with-bundler/
bundle config set --local path 'vendor/bundle'
bundle add jekyll

0 comments on commit 87e7fe4

Please sign in to comment.