Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to Main #16

Merged
merged 48 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
00eb6e6
add modal
lukorito Jul 14, 2023
50df1bb
complete modals
lukorito Jul 14, 2023
b153a0d
add pull request template
lukorito Jul 14, 2023
f74dba5
add selected chain
berriose Jul 17, 2023
849d7f2
Merge pull request #1 from Topl/ANNULUS-191
Jul 17, 2023
97c3334
dashboard providers
berriose Jul 17, 2023
dcc6ca8
feat(ANNULUS-192): add faucet wireframe dashboard
Kelz29 Jul 18, 2023
fbfe0bd
Merge branch 'dev' into dashboard-provider
berriose Jul 18, 2023
4335838
Merge pull request #2 from Topl/dashboard-provider
berriose Jul 18, 2023
82b8748
refac(ANNULUS-192): remove unused code
Kelz29 Jul 19, 2023
68855fc
feat(ANNULUS-192): add faucet wireframe dashboard
Kelz29 Jul 19, 2023
c1a4117
refac(ANNULUS-192): remove unused code
Kelz29 Jul 19, 2023
e2bb961
Merge remote-tracking branch refs/remotes/origin/ANNULUS-192 into ANN…
Kelz29 Jul 19, 2023
995b00c
feat(ANNULUS-192): add faucet wireframe dashboard
Kelz29 Jul 19, 2023
506cda3
Merge pull request #3 from Topl/ANNULUS-192
Kelz29 Jul 20, 2023
01fecb2
[BN-1133]: Add Dockerfile and Set Up CI/CD (#4)
admiraladmirable Aug 8, 2023
873b361
Addition of hive and rate limit
KalervoHyyppa Aug 9, 2023
85fed9d
Unused line update
KalervoHyyppa Aug 10, 2023
f1e00af
Add missing parameter for private publish (#5)
admiraladmirable Aug 15, 2023
bc0a811
modify styling
lukorito Aug 24, 2023
ff49ad8
Merge pull request #7 from Topl/ANNULUS-291
lukorito Aug 28, 2023
9bf52f8
add non-root user to Dockerfile (#8)
admiraladmirable Aug 29, 2023
f892b81
Merge pull request #6 from Topl/ANNULUS-242
KalervoHyyppa Aug 29, 2023
6fd569d
add error message for rate limiting
lukorito Sep 10, 2023
b7fad13
feat(ANNULUS-299): adds providers and widgets
Kelz29 Sep 11, 2023
9ba2b80
Merge pull request #9 from Topl/ANNULUS-311
lukorito Sep 11, 2023
f6913d8
Merge pull request #10 from Topl/ANNULUS-299
KalervoHyyppa Sep 11, 2023
14e9db1
feat(ANNULUS-299): adds reCAPTCHA
Kelz29 Sep 14, 2023
7757b12
feat(ANNULUS-310): refactor callback function
Kelz29 Sep 26, 2023
80b1dbf
Merge pull request #11 from Topl/ANNULUS-310
Sep 27, 2023
028fe9a
feat(ANNULUS-332): adds request button to bottom right corner of the …
Kelz29 Sep 28, 2023
41cdf96
refac(ANNULUS-332): code clean up
Kelz29 Oct 4, 2023
db549c9
Merge pull request #12 from Topl/ANNULUS-332
Oct 6, 2023
e572691
feat(ANNULUS-333): changes Error message when token request limit rea…
Kelz29 Oct 9, 2023
60109f0
First set up
KalervoHyyppa Oct 11, 2023
a7749f0
Merge branch 'dev' of https://github.com/Topl/faucet into ANNULUS-361
KalervoHyyppa Oct 11, 2023
13b1f8a
feat(ANNULUS-333): refactor on PR comments
Kelz29 Oct 12, 2023
8fb5f06
Layout issues;
KalervoHyyppa Oct 12, 2023
8c0221e
Initial Set up
KalervoHyyppa Oct 12, 2023
2335c8e
Tests are freezing
KalervoHyyppa Oct 12, 2023
6fef3a7
Merge pull request #13 from Topl/ANNULUS-333
Oct 13, 2023
c45ab8b
Old code removal
KalervoHyyppa Oct 13, 2023
728e316
Log removals
KalervoHyyppa Oct 13, 2023
0456359
Merge pull request #14 from Topl/ANNULUS-361
KalervoHyyppa Oct 16, 2023
931785b
Layout issues fixed for tests
KalervoHyyppa Oct 16, 2023
e315264
Test is working
KalervoHyyppa Oct 17, 2023
9d1016a
Log removals
KalervoHyyppa Oct 18, 2023
f8f23cd
Merge pull request #15 from Topl/ANNULUS-366
KalervoHyyppa Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on:
workflow_call:

jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [web] #TODO: Add android, ios, linux, macos, windows.
steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
# Set up Flutter.
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
# flutter-version: '' TODO: Pin this to a version.
channel: stable
- run: flutter doctor -v
- name: Checkout
uses: actions/checkout@v3
- run: flutter pub get
- run: flutter packages pub run build_runner build --delete-conflicting-outputs
- run: flutter build ${{ matrix.target }}
66 changes: 66 additions & 0 deletions .github/workflows/_docker_publish_private.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish Docker Images (Private)

on:
workflow_call:
inputs:
registry-auth-location:
description: 'Name of the GCP managed Artifact Registry.'
default: "us-central1-docker.pkg.dev"
required: false
type: string
remote-docker-image:
description: 'Remote Docker image. ex: toplprotocol/faucet'
default: "us-central1-docker.pkg.dev/topl-shared-project-dev/topl-artifacts-dev/faucet"
required: false
type: string

jobs:
publish_docker_images:
name: Publish Docker Images
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- id: 'auth'
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.GCP_OIDC_PROVIDER_NAME }}
service_account: ${{ secrets.GCP_OIDC_SERVICE_ACCOUNT_EMAIL }}

- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v1

- name: Auth Artifact Registry
run: gcloud auth configure-docker ${{ inputs.registry-auth-location }} --quiet

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ inputs.remote-docker-image }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,enable=true,prefix=,

- name: Echo metadata
run: |
echo "tags: ${{ steps.meta.outputs.tags }}"
echo "labels: ${{ steps.meta.outputs.labels }}"

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
57 changes: 57 additions & 0 deletions .github/workflows/_docker_publish_public.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish Docker Images (Public)

on:
workflow_call:
inputs:
remote-docker-image:
description: 'Remote Docker image. ex: toplprotocol/faucet'
default: "toplprotocol/faucet"
required: false
type: string

jobs:
publish_docker_images:
name: Publish Docker Images
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the Github Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ inputs.remote-docker-image }}

- name: Echo metadata
run: |
echo "tags: ${{ steps.meta.outputs.tags }}"
echo "labels: ${{ steps.meta.outputs.labels }}"

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
7 changes: 7 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: PR
on:
pull_request:

jobs:
build:
uses: ./.github/workflows/_build.yml
27 changes: 27 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: CI

on:
push:
branches:
- main
- dev

jobs:
build:
uses: ./.github/workflows/_build.yml

publish_private:
uses: ./.github/workflows/_docker_publish_private.yml
needs: [build]
secrets: inherit
with:
remote-docker-image: "us-central1-docker.pkg.dev/topl-shared-project-dev/topl-artifacts-dev/faucet"
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Release

on:
push:
tags: ['*']

jobs:
build:
uses: ./.github/workflows/_build.yml

publish_dockerhub:
uses: ./.github/workflows/_docker_publish_public.yml
needs: [build]
secrets: inherit
with:
remote-docker-image: "toplprotocol/faucet"

publish_ghcr:
uses: ./.github/workflows/_docker_publish_public.yml
needs: [build]
secrets: inherit
with:
remote-docker-image: "ghcr.io/topl/faucet"
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Stage 1: Build the Flutter app
FROM ghcr.io/cirruslabs/flutter:3.10.6 AS build

# Set the working directory to /app
WORKDIR /app

# Copy the entire Flutter project to the container
COPY . .

# Run the necessary Flutter commands to build the app
RUN flutter pub get && \
flutter packages pub run build_runner build --delete-conflicting-outputs && \
flutter build web --release

# Stage 2: Create a minimal image to run the built app
FROM nginx:stable-alpine3.17

USER nginx

# Copy the built app from the previous stage to the nginx html directory
COPY --from=build --chown=nginx:nginx /app/build/web /usr/share/nginx/html

# Expose port 80 for the web server to listen on
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
111 changes: 111 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
all: lint format

# Adding a help file: https://gist.github.com/prwhite/8168133#gistcomment-1313022
help: ## This help dialog.
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//'`); \
for help_line in $${help_lines[@]}; do \
IFS=$$'#' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf "%-30s %s\n" $$help_command $$help_info ; \
done

build_web:
@flutter clean
@npm install
@npm run build
@flutter pub get
@flutter build web --web-renderer html --csp --release

run_unit: ## Runs unit tests
@echo "╠ Running the tests"
@flutter test || (echo "Error while running tests"; exit 1)

clean: ## Cleans the environment
@echo "╠ Cleaning the project..."
@rm -rf pubspec.lock
@flutter clean
@flutter pub get

fix_warnings: ## fix any warnings
@echo "╠ Attempting to fix warnings..."
@dart fix --dry-run
@dart fix --apply
watch: ## Watches the files for changes
@echo "╠ Watching the project..."
@flutter pub run build_runner watch --delete-conflicting-outputs


gen: ## Generates the assets
@echo "╠ Generating the assets..."
@flutter pub get
@flutter packages pub run build_runner build --delete-conflicting-outputs

format: ## Formats the code
@echo "╠ Formatting the code"
@dart format lib . -l 120
@flutter pub run import_sorter:main
@dart format . -l 120

lint: ## Lints the code
@echo "╠ Verifying code..."
@dart analyze . || (echo "Error in project"; exit 1)

upgrade: clean ## Upgrades dependencies
@echo "╠ Upgrading dependencies..."
@flutter pub upgrade

commit: format lint run_unit
@echo "╠ Committing..."
git add .
git commit

analyze:
flutter run dart_code_metrics:metrics analyze lib

ditto:
echo "hello world"

validate_packages:
@echo "╠ Validating packages..."
@flutter pub get
@flutter pub run dependency_validator

arm_mac_hard_clean:
flutter clean && \
flutter pub get && \
cd ios && \
sudo rm -r Pods/ && \
rm -r .symlinks/ && \
rm Podfile.lock && \
sudo arch -x86_64 gem install ffi && \
arch -x86_64 pod install && \
cd ..

file_test:
@reset
@flutter test test/middleware_test.dart

nuclear_clean:
@echo "╠ Nuking pubcache completely, this might take a while...."
@flutter clean
@flutter pub cache repair
@flutter pub get

test_coverage:
@flutter test --coverage
@genhtml coverage/lcov.info -o coverage/html
@open coverage/html/index.html

web_profile:
@flutter run -d chrome --profile

web_build_and_host:
@flutter build web --web-renderer html --csp --release
@cd build/web && python3 -m http.server 8000

file_test:
@reset
@flutter test test/search/search_test.dart
4 changes: 4 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:label="faucet"
android:name="${applicationName}"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
Loading