-
Notifications
You must be signed in to change notification settings - Fork 28
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 #78 from RicYaben/master
From GSoC 2022
- Loading branch information
Showing
186 changed files
with
31,274 additions
and
2,816 deletions.
There are no files selected for viewing
File renamed without changes.
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,75 @@ | ||
name: Nightly | ||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
riotpot: | ||
strategy: | ||
matrix: | ||
go-version: [1.18] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: latest | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Build UI | ||
run: npm --prefix=./ui ci && npm --prefix=./ui run build | ||
|
||
- name: Build application | ||
run: make build-all | ||
|
||
- name: Archive production artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: riotpot | ||
path: bin | ||
if-no-files-found: error | ||
|
||
release: | ||
permissions: | ||
contents: write | ||
needs: riotpot | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download all workflow run artifacts | ||
uses: actions/download-artifact@v3 | ||
id: download | ||
with: | ||
path: artifacts | ||
|
||
- name: Zip content | ||
working-directory: artifacts | ||
run: zip -r riotpot.zip riotpot | ||
|
||
# Nightly | ||
- name: Release Nightly | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
name: nightly | ||
tag_name: nightly | ||
files: artifacts/riotpot.zip | ||
prerelease: 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 |
---|---|---|
@@ -1,49 +1,54 @@ | ||
name: release | ||
name: Releaser | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
- "**.md" | ||
tags: | ||
- "v*" | ||
push: | ||
paths-ignore: | ||
- "**.md" | ||
tags: | ||
- "v*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
go-version: [1.16] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
riotpot: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: latest | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
cache: true | ||
|
||
# The UI is not built with the code to reduce the size of the bundle. | ||
# In addition, the Docker image builds the UI every time. | ||
# Therefore, we need to build it whenever we create a new release | ||
- name: Build UI | ||
run: npm --prefix=./ui ci && npm --prefix=./ui run build | ||
|
||
- name: Build Plugins | ||
run: make build-plugins | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Build | ||
if: github.event_name == 'push' && (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') | ||
run: cd cmd/riotpot && go build -o bin/ -v | ||
|
||
# Autoreleaser https://goreleaser.com/ci/actions/ | ||
# it MAY need secrets! more: https://docs.github.com/en/actions/reference/encrypted-secrets | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
workdir: cmd/riotpot | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 was deleted.
Oops, something went wrong.
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,58 @@ | ||
project_name: riotpot | ||
|
||
dist: .bin | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- # Folder with the package | ||
main: ./cmd/riotpot/. | ||
|
||
# Binary destination | ||
binary: riotpot | ||
env: | ||
- CGO_ENABLED=0 | ||
|
||
# List of systems to build for | ||
goos: | ||
- linux | ||
- darwin | ||
goarm: | ||
- "7" | ||
ignore: | ||
- goos: darwin | ||
goarch: arm | ||
|
||
# Building flags | ||
# We need this because we are using plugins | ||
# The plugins are prebuilt in another action | ||
gcflags: | ||
- all=-N -l | ||
|
||
release: | ||
draft: true | ||
replace_existing_draft: true | ||
mode: append | ||
|
||
archives: | ||
- format: zip | ||
files: | ||
- LICENSE* | ||
- CHANGELOG* | ||
- src: "bin/plugins/*" | ||
dst: plugins | ||
strip_parent: true | ||
|
||
checksum: | ||
name_template: "checksums.txt" | ||
|
||
snapshot: | ||
name_template: "{{ incpath .Version }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^ui:" |
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,27 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
[^docker-image] : Once we decide how, who and where to publish it, the honeypot will be available as a Docker image. For now, the image can be built from source using the `Dockerfile` included in the **`build > docker`** folder (there is also a `docker-compose` file ready to use). | ||
|
||
## [v0.1.2] 2023-01-22 | ||
|
||
### Added | ||
|
||
- Embeds the UI in the binary | ||
|
||
### Changed | ||
|
||
- All the plugins now use a `localhost:<port>` address to listen for incoming connections (i.e., even if exposed, they should not provide any service). | ||
- Optimised the Docker image. Now the UI folder only includes the required files, instead of the whole directory contents. | ||
|
||
> **Note:** The Docker image has not been published yet. This will come soon [^docker-image] | ||
- Changed flows for the pipeline | ||
- Now the UI uses [Vite](https://vitejs.dev/) to build the project | ||
- Using [Goreleaser](https://goreleaser.com/) - again - to make releases |
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,34 +1,44 @@ | ||
SHELL := /bin/bash | ||
|
||
# Makefile | ||
APPNAME=riotpot | ||
CURRENT_DIR=`pwd` | ||
PACKAGE_DIRS=`go list -e ./... | egrep -v "binary_output_dir|.git|mocks"` | ||
DEPLOY=deployments/ | ||
DOCKER=build/docker/ | ||
PLUGINS_DIR=pkg/plugin | ||
EXCLUDE_PLUGINS= | ||
|
||
# docker cmd below | ||
.PHONY: docker-build-doc riotpot-doc riotpot-up riotpot-prod-up riotpot-prod-down riotpot-build riotpot-build-plugins riotpot-builder | ||
.PHONY: docker-build-doc docker-doc-up up down up-all build build-plugins build-all build-ui statik | ||
docker-build-doc: | ||
docker build -f $(DOCKER)Dockerfile.documentation . -t $(APPNAME)/v1 | ||
riotpot-doc: docker-build-doc | ||
docker-doc-up: docker-build-doc | ||
docker run -p 6060:6060 -it $(APPNAME)/v1 | ||
riotpot-up: | ||
docker-compose -p riotpot -f ${DEPLOY}docker-compose.yml up -d --build | ||
riotpot-down: | ||
docker-compose -p riotpot -f ${DEPLOY}docker-compose.yml down -v | ||
riotpot-prod-up: | ||
docker-compose -p riotpot -f ${DEPLOY}docker-compose.prod.yml up -d --build | ||
riotpot--prod-down: | ||
docker-compose -p riotpot -f ${DEPLOY}docker-compose.prod.yml down -v | ||
riotpot-all: | ||
up: | ||
docker-compose -p riotpot -f ${DOCKER}docker-compose.yaml up -d --build | ||
down: | ||
docker-compose -p riotpot -f ${DOCKER}docker-compose.yaml down -v | ||
up-all: | ||
riotpot-doc | ||
riotpot-up | ||
riotpot-build: | ||
go build -o riotpot cmd/riotpot/main.go; | ||
riotpot-build-plugins: $(PLUGINS_DIR)/* | ||
build: | ||
@go build -gcflags='all=-N -l' -o ./bin/ ./cmd/riotpot/. | ||
@echo "Finished building Binary" | ||
build-plugins: $(PLUGINS_DIR)/* | ||
@IFS=' ' read -r -a exclude <<< "${EXCLUDE_PLUGINS}"; \ | ||
for folder in $^ ; do \ | ||
go build -buildmode=plugin -o $${folder}/plugin.so $${folder}/*.go; \ | ||
result=$${folder%%+(/)}; \ | ||
result=$${result##*/}; \ | ||
result=$${result:-/}; \ | ||
if ! [[ $${exclude[*]} =~ "$${result}" ]]; then \ | ||
go build -buildmode=plugin --mod=mod -gcflags='all=-N -l' -o bin/plugins/$${result}.so $${folder}/*.go; \ | ||
fi \ | ||
done | ||
riotpot-builder: \ | ||
riotpot-build \ | ||
riotpot-build-plugins | ||
@echo "Finished building plugins" | ||
build-ui: | ||
@npm --prefix=./ui run build | ||
@echo "Finished building UI" | ||
build-all: \ | ||
build \ | ||
build-plugins | ||
|
||
statik: | ||
@statik -src=/api/swagger |
Oops, something went wrong.