-
Notifications
You must be signed in to change notification settings - Fork 4
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 RicYaben/staging
Revamping riotpot with latest changes
- Loading branch information
Showing
179 changed files
with
47,626 additions
and
2,466 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,113 @@ | ||
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: | ||
ref: staging | ||
fetch-depth: 0 | ||
|
||
- name: Fetch all tags | ||
run: git fetch --force --tags | ||
|
||
- 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 application | ||
run: make build-all | ||
|
||
- name: Archive production artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: riotpot | ||
path: bin | ||
if-no-files-found: error | ||
|
||
ui: | ||
defaults: | ||
run: | ||
working-directory: ./ui | ||
strategy: | ||
matrix: | ||
node-version: [19.x] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
needs: riotpot | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: staging | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
cache: "npm" | ||
node-version: ${{ matrix.node-version }} | ||
cache-dependency-path: "ui/package-lock.json" | ||
|
||
# Create the build folder | ||
- run: npm ci | ||
- run: CI=false npm run build --if-present | ||
|
||
# Move the new build folder so we can add it as a folder to the artifact | ||
- name: Move build | ||
working-directory: ./ui | ||
run: | | ||
mkdir -p riotpot-ui/ui | ||
mv build/* riotpot-ui/ui | ||
# Create a release | ||
- name: Archive production artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: riotpot | ||
path: ui/riotpot-ui | ||
if-no-files-found: error | ||
|
||
release: | ||
permissions: | ||
contents: write | ||
needs: ui | ||
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 | ||
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,112 @@ | ||
name: release | ||
name: Releaser | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
- "**.md" | ||
|
||
jobs: | ||
build: | ||
riotpot: | ||
strategy: | ||
matrix: | ||
go-version: [1.16] | ||
go-version: [1.18] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Fetch all tags | ||
run: git fetch --force --tags | ||
|
||
- 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 application | ||
run: make build-all | ||
|
||
- name: Archive production artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: riotpot | ||
path: bin | ||
if-no-files-found: error | ||
|
||
ui: | ||
defaults: | ||
run: | ||
working-directory: ./ui | ||
strategy: | ||
matrix: | ||
node-version: [19.x] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
needs: riotpot | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
cache: "npm" | ||
node-version: ${{ matrix.node-version }} | ||
cache-dependency-path: "ui/package-lock.json" | ||
|
||
# Create the build folder | ||
- run: npm ci | ||
- run: CI=false npm run build --if-present | ||
|
||
# Move the new build folder so we can add it as a folder to the artifact | ||
- name: Move build | ||
working-directory: ./ui | ||
run: | | ||
mkdir -p riotpot-ui/ui | ||
mv build/* riotpot-ui/ui | ||
# Create a release | ||
- name: Archive production artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: riotpot | ||
path: ui/riotpot-ui | ||
if-no-files-found: error | ||
|
||
release: | ||
permissions: | ||
contents: write | ||
needs: ui | ||
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 | ||
|
||
- 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: Release Main Latest | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: startsWith(github.ref, 'refs/tags/') && github.ref_name == 'main' && github.event_name == 'pull_request' | ||
with: | ||
name: latest | ||
files: artifacts/riotpot.zip |
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 |
---|---|---|
@@ -1,34 +1,41 @@ | ||
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= sshd | ||
|
||
## | ||
exclude_plugins_list := $(subst ., ,$(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 ui | ||
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/. | ||
build-plugins: $(PLUGINS_DIR)/* | ||
exclude=${exclude_plugins_list}; \ | ||
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 | ||
build-all: \ | ||
build \ | ||
build-plugins | ||
ui: | ||
@cd ui && serve -s build |
Oops, something went wrong.