Compare commits

...
This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.

16 Commits

Author SHA1 Message Date
Matthew Sevey ac15135099
Merge branch 'master' into sevey/composite-actions 2022-04-14 14:35:00 -04:00
Matthew Sevey a6ec306528
Add release 2022-04-07 16:44:57 -04:00
Matthew Sevey 65dafd2663
Update conditional 2022-04-07 16:39:30 -04:00
Matthew Sevey 112ec3d78f
Test node-action 2022-04-07 16:38:26 -04:00
Matthew Sevey d86c2d2982
Merge branch 'sevey/composite-actions' of github.com:SkynetLabs/skynet-webportal into sevey/composite-actions 2022-04-06 15:45:57 -04:00
Matthew Sevey a4a75a1a6f
fix runs 2022-04-06 15:45:49 -04:00
Matthew Sevey be1a890cc9
Merge branch 'master' into sevey/composite-actions 2022-04-06 15:34:37 -04:00
Matthew Sevey e083a73be5
Merge branch 'sevey/composite-actions' of github.com:SkynetLabs/skynet-webportal into sevey/composite-actions 2022-04-06 15:34:09 -04:00
Matthew Sevey 489610fccd
address comments 2022-04-06 15:34:06 -04:00
Matthew Sevey 44925c82ce
Update packages/dashboard-v2/yarn.lock
Co-authored-by: Karol Wypchło <kwypchlo@gmail.com>
2022-04-06 15:32:48 -04:00
Matthew Sevey 05922d9c5a
review updates 2022-04-06 15:27:36 -04:00
Matthew Sevey 075c8eac40
Apply suggestions from code review
Co-authored-by: Karol Wypchło <kwypchlo@gmail.com>
2022-04-06 15:09:36 -04:00
Matthew Sevey 747a1918e0
update naming 2022-04-05 09:43:46 -04:00
Matthew Sevey a986197c49
fix dashboard lint 2022-04-04 13:43:54 -04:00
Matthew Sevey 2b9b1ec323
Fix python lint error 2022-03-31 19:44:40 -04:00
Matthew Sevey eee48729d7
Refactor GtiHub actions into reuseable composite actions. 2022-03-31 16:00:26 -04:00
14 changed files with 201 additions and 205 deletions

22
.github/actions/node-action/action.yml vendored Normal file
View File

@ -0,0 +1,22 @@
# Define action name, description, and inputs
name: "Node Action"
description: "Execute a node action"
inputs:
working-directory:
required: false
description: "Working directory"
default: "."
node-action:
required: true
description: "The action to be run"
# Define action steps
runs:
using: "composite"
steps:
- uses: actions/setup-node@v3
with:
node-version: 16.x
- run: $inputs.node-action
shell: bash
working-directory: ${{ inputs.working-directory }}

174
.github/workflows/ci_release.yml vendored Normal file
View File

@ -0,0 +1,174 @@
name: CI and Release
on:
push:
schedule:
# Run daily at 1:15am
- cron: "15 1 * * *"
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# Friendly description to be shown in the UI instead of 'name'
description: "Semver type of new version (major / minor / patch)"
# Input has to be provided for the workflow to run
required: true
type: choice
options:
- patch
- minor
- major
jobs:
# Determine what the js changes are
js-changes:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.changes }}
steps:
# Use paths-filter to determine which paths have changes
# https://github.com/dorny/paths-filter
- uses: dorny/paths-filter@v2
id: filter
with:
# Format of key: value. When there is a change detected in value, the
# key will be returned in the output.
filters: |
packages/dashboard: packages/dashboard/**
packages/dashboard-v2: packages/dashboard-v2/**
packages/dnslink-api: packages/dnslink-api/**
packages/handshake-api: packages/handshake-api/**
packages/health-check: packages/health-check/**
packages/website: packages/website/**
# Run the prettier lint if there are changes to any of the js packages
prettier:
needs: js-changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
working-directory: ${{ fromJSON(needs.js-changes.outputs.packages) }}
steps:
- uses: actions/checkout@v3
- name: Run JS-Lint Action
uses: SkynetLabs/.github/.github/actions/prettier@master
with:
working-directory: ${{ matrix.working-directory }}
# Run the eslint if there were changes to the dashboard packages
eslint:
needs: js-changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
working-directory: ${{ fromJSON(needs.js-changes.outputs.packages) }}
steps:
- uses: actions/checkout@v3
- name: Run yarn next lint on packages/dashboard
uses: ./.github/actions/node-action
if: ${{ matrix.working-directory == 'packages/dashboard' }}
with:
working-directory: ${{ matrix.working-directory }}
node-action: yarn next lint
- name: Run yarn lint on packages/dashboard-v2
uses: ./.github/actions/node-action
if: ${{ matrix.working-directory == 'packages/dashboard-v2' }}
with:
working-directory: ${{ matrix.working-directory }}
node-action: yarn lint
# Determine what the dockerfile changes are
dockerfile-changes:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.changes }}
steps:
# Use paths-filter to determine which paths have changes
# https://github.com/dorny/paths-filter
- uses: dorny/paths-filter@v2
id: filter
with:
# Format of key: value. When there is a change detected in value, the
# key will be returned in the output.
filters: |
docker/nginx/Dockerfile: docker/nginx/Dockerfile
docker/sia/Dockerfile: docker/sia/Dockerfile
packages/dashboard/Dockerfile: packages/dashboard/Dockerfile
packages/dnslink-api/Dockerfile: packages/dnslink-api/Dockerfile
packages/handshake-api/Dockerfile: packages/handshake-api/Dockerfile
packages/health-check/Dockerfile: packages/health-check/Dockerfile
packages/website/Dockerfile: packages/website/Dockerfile
# Run the hadolint dockefile lint if there are changes to any of the
# dockerfiles
hadolint:
needs: dockerfile-changes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dockerfile: ${{ fromJSON(needs.dockerfile-changes.outputs.packages) }}
steps:
- uses: actions/checkout@v3
- uses: hadolint/hadolint-action@v2.1.0
with:
dockerfile: ${{ matrix.dockerfile }}
# Determine if there are python changes
python-changes:
runs-on: ubuntu-latest
outputs:
# Check if the changed status of py is true
updates: steps.filter.outputs.py == 'true'
steps:
# Use paths-filter to determine which paths have changes
# https://github.com/dorny/paths-filter
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
py: "**.py"
# Run the hadolint dockefile lint if there are changes to any of the
# dockerfiles
python-lint:
needs: python-changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Black python linter
if: ${{ needs.python-changes.outputs.updates }}
uses: SkynetLabs/.github/.github/actions/python-black-lint@master
- name: Run Flake8 python linter
if: ${{ needs.python-changes.outputs.updates }}
uses: SkynetLabs/.github/.github/actions/python-flake8-lint@master
# Check if there were any changes since the last tag if this is not a push
# event
changes:
needs: [prettier, eslint, hadolint, python-lint]
runs-on: ubuntu-latest
outputs:
updates: ${{steps.changes.outputs.any == 'true'}}
if: ${{ github.event_name != 'push' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required due to the weg Git works, without it this action won't be able to find any or the correct tags
- uses: SkynetLabs/.github/.github/actions/changes-since-last-tag@master
# Make a release if
# - there were changes and this is a scheduled job
# - This is a manually trigger job, i.e. workflow_dispatch
release:
needs: changes
runs-on: ubuntu-latest
if: ${{ (needs.changes.outputs.updates == 'true' && github.event_name == 'schedule') || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v3
- name: Version Release
uses: SkynetLabs/.github/.github/actions/version-release@master
with:
github-token: ${{secrets.GITHUB_TOKEN}}

View File

@ -1,28 +0,0 @@
name: Dockerfile Lint
on:
push:
branches:
- master
pull_request:
jobs:
hadolint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dockerfile:
- docker/nginx/Dockerfile
- docker/sia/Dockerfile
- packages/dashboard/Dockerfile
- packages/dashboard-v2/Dockerfile
- packages/dnslink-api/Dockerfile
- packages/handshake-api/Dockerfile
- packages/health-check/Dockerfile
- packages/website/Dockerfile
steps:
- uses: actions/checkout@v3
- uses: hadolint/hadolint-action@v2.0.0
with:
dockerfile: ${{ matrix.dockerfile }}

View File

@ -1,24 +0,0 @@
name: Lint - packages/dashboard-v2
on:
pull_request:
paths:
- packages/dashboard-v2/**
defaults:
run:
working-directory: packages/dashboard-v2
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn
- run: yarn prettier --check
- run: yarn lint

View File

@ -1,24 +0,0 @@
name: Lint - packages/dashboard
on:
pull_request:
paths:
- packages/dashboard/**
defaults:
run:
working-directory: packages/dashboard
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn
- run: yarn prettier --check .
- run: yarn next lint

View File

@ -1,23 +0,0 @@
name: Lint - packages/dnslink-api
on:
pull_request:
paths:
- packages/dnslink-api/**
defaults:
run:
working-directory: packages/dnslink-api
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn
- run: yarn prettier --check .

View File

@ -1,23 +0,0 @@
name: Lint - packages/handshake-api
on:
pull_request:
paths:
- packages/handshake-api/**
defaults:
run:
working-directory: packages/handshake-api
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn
- run: yarn prettier --check .

View File

@ -1,23 +0,0 @@
name: Lint - packages/health-check
on:
pull_request:
paths:
- packages/health-check/**
defaults:
run:
working-directory: packages/health-check
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn
- run: yarn prettier --check .

View File

@ -1,23 +0,0 @@
name: Lint - packages/website
on:
pull_request:
paths:
- packages/website/**
defaults:
run:
working-directory: packages/website
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: yarn
- run: yarn prettier --check .

View File

@ -1,37 +0,0 @@
name: Lint - Python Scripts
on:
push:
paths:
- "**.py"
jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
architecture: x64
- run: pip install black
- run: black --check .
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
architecture: x64
- run: pip install flake8
# E203: https://www.flake8rules.com/rules/E203.html - Whitespace before ':'
# E501: https://www.flake8rules.com/rules/E501.html - Line too long
# W503: https://www.flake8rules.com/rules/W503.html - Line break occurred before a binary operator
# W605: https://www.flake8rules.com/rules/W605.html - Invalid escape sequence
# E722: https://www.flake8rules.com/rules/E722.html - Do not use bare except, specify exception instead
- run: flake8 --max-line-length 88 --ignore E203,E501,W503,W605,E722

View File

@ -12,5 +12,6 @@ FROM nebulouslabs/sia:1.5.6
COPY --from=sia-builder /go/bin/ /usr/bin/ COPY --from=sia-builder /go/bin/ /usr/bin/
# rename binaries to old siac siad naming
RUN if [ -f "/usr/bin/skyd" ]; then mv /usr/bin/skyd /usr/bin/siad; fi && \ RUN if [ -f "/usr/bin/skyd" ]; then mv /usr/bin/skyd /usr/bin/siad; fi && \
if [ -f "/usr/bin/skyc" ]; then mv /usr/bin/skyc /usr/bin/siac; fi if [ -f "/usr/bin/skyc" ]; then mv /usr/bin/skyc /usr/bin/siac; fi

View File

@ -1,3 +1,5 @@
# Dashboard
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started ## Getting Started

View File

@ -195,6 +195,7 @@ async function blockerHealthCheck(done) {
done({ name: "blocker", time: calculateElapsedTime(time), ...data }); done({ name: "blocker", time: calculateElapsedTime(time), ...data });
} }
// genericAccessCheck
async function genericAccessCheck(name, url) { async function genericAccessCheck(name, url) {
const authCookie = await getAuthCookie(); const authCookie = await getAuthCookie();
const time = process.hrtime(); const time = process.hrtime();

View File

@ -43,6 +43,7 @@ DISK_USAGE_DUMP_LOG = "../../devops/disk-monitor/disk-usage-dump.log"
setup() setup()
# run_checks runs the health checks
async def run_checks(): async def run_checks():
print("Running Skynet portal health checks") print("Running Skynet portal health checks")
try: try: