Skip to content

Commit

Permalink
feat(ci): add earthfile for voices fronted (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
minikin authored Feb 26, 2024
1 parent 1f7ec0f commit 9f57116
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 28 deletions.
38 changes: 20 additions & 18 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ aapt
aarch
addrr
adminer
afinet
androidx
appspot
asyncio
Expand All @@ -10,6 +11,7 @@ auditability
bkioshn
bluefireteam
BROTLI
canvaskit
cardano
Catalyst
CEST
Expand All @@ -18,6 +20,7 @@ chromedriver
chrono
ciphertext
COCOAPODS
codegen
codepoints
coti
cryptoxide
Expand All @@ -34,26 +37,31 @@ drep
dreps
encryptor
fetchval
fmtchk
fmtfix
fontawesome
formz
Formz
gapless
gcloud
genhtml
gethostname
gmtime
gradlew
ideascale
idents
integ
Intellij
iphoneos
jetbrains
Joaquín
jorm
jormungandr
Joaquín
Jörmungandr
kroki
lcov
Leshiy
lintfix
localizable
loguru
mdlint
Expand All @@ -62,8 +70,10 @@ moderations
multidex
myproject
nanos
netifas
netkey
nextest
nextest
Oleksandr
oneshot
openapi
Expand All @@ -88,18 +98,25 @@ redoc
reqwest
ripgrep
rustc
rustdoc
rustdocflags
rustflags
rustls
rxdart
saibatizoku
Schemathesis
schemathesis
Schemathesis
seckey
sendfile
slotno
sqlfluff
Stefano
stevenj
subosito
tacho
testcov
testdocs
testunit
thiserror
timelike
Traceback
Expand All @@ -115,19 +132,4 @@ xcodeproj
xctest
xctestrun
xcworkspace
yoroi
idents
rustflags
rustdoc
rustdocflags
codegen
lintfix
testunit
nextest
testcov
testdocs
fmtchk
fmtfix
gethostname
afinet
netifas
yoroi
5 changes: 1 addition & 4 deletions catalyst_voices/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ doc/api/
.pub-cache/
.pub/
coverage/
lib/generated_plugin_registrant.dart
# For library packages, don’t commit the pubspec.lock file.
# Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies.
# See https://dart.dev/guides/libraries/private-files#pubspeclock
Expand Down Expand Up @@ -130,6 +129,4 @@ lib/generated_plugin_registrant.dart
**/fastlane/test_output

# Fastlane.swift runner binary
**/fastlane/FastlaneRunner

# End of https://www.toptal.com/developers/gitignore/api/fastlane
**/fastlane/FastlaneRunner
49 changes: 49 additions & 0 deletions catalyst_voices/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
VERSION --try --global-cache 0.7

deps:
FROM debian:stable-slim
RUN apt-get update
RUN apt-get install -y curl git unzip bash
WORKDIR /frontend

# Download and set-up flutter
flutter:
FROM +deps

RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"

RUN flutter channel stable
RUN flutter upgrade
RUN flutter --version
RUN flutter doctor -v
RUN flutter config --enable-web

# Build web version of Catalyst Voices
build:
FROM +flutter

COPY --dir pubspec.yaml lib packages web test test_driver integration_test .

RUN flutter clean
RUN flutter pub get
RUN flutter build web --web-renderer canvaskit --release --target lib/configs/main_web.dart

WORKDIR /frontend/build
SAVE ARTIFACT web /web AS LOCAL web

docker:
FROM +deps
FROM nginx:stable-alpine3.17

COPY +build/web /app
COPY ./nginx.conf /etc/nginx/nginx.conf

EXPOSE 80

package:
FROM +docker

ARG tag='latest'

SAVE IMAGE catalyst-voices-app:$tag
10 changes: 5 additions & 5 deletions catalyst_voices/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This repository contains the Catalyst Voices app and packages.

## Requirements

* flutter: 3.16.5+
* Dart: 3.2.3+
* flutter: 3.19.+
* Dart: 3.3.0+
* Ruby: 2.5+
* Xcode: 15.0+
* Android Studio: Android Studio Electric Eel | 2022.1.1 +
Expand Down Expand Up @@ -57,7 +57,7 @@ melos bootstrap

### Flavors

This project contains three flavors:
This project contains four flavors:

* dev
* qa
Expand All @@ -80,8 +80,8 @@ flutter run --flavor preprod --target lib/configs/main_preprod.dart
flutter run --flavor prod --target lib/configs/main_prod.dart
```

*\*Catalyst Voices works on Web.
We plan to add iOS and Android later.*
>Catalyst Voices works on the Web only.
>We plan to add support for other targets later.
## Running Tests

Expand Down
6 changes: 6 additions & 0 deletions catalyst_voices/lib/configs/main_web.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:catalyst_voices/app/app.dart';
import 'package:catalyst_voices/configs/bootstrap.dart';

void main() async {
await bootstrap(() => const App());
}
30 changes: 30 additions & 0 deletions catalyst_voices/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
5 changes: 4 additions & 1 deletion catalyst_voices/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ dev_dependencies:
build_runner: ^2.4.7
build_verify: ^3.1.0
catalyst_analysis:
path: ../catalyst_voices_packages/catalyst_analysis
git:
url: https://github.com/input-output-hk/catalyst-voices.git
path: catalyst_voices_packages/catalyst_analysis
ref: 3431f7b
flutter_test:
sdk: flutter
go_router_builder: ^2.4.1
Expand Down

0 comments on commit 9f57116

Please sign in to comment.