Skip to content

Commit

Permalink
improve github actions. use npm not yarn. add justfile.
Browse files Browse the repository at this point in the history
* remove goreleaser action and config. we're not using it
* update readme
* always build both images
  • Loading branch information
steezeburger committed Jan 18, 2024
1 parent e5c0689 commit 00d774b
Show file tree
Hide file tree
Showing 11 changed files with 1,365 additions and 705 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Lint, Test, Prettier

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
branches: [astria]

jobs:
build:
server-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Test
run: go test -v ./...

golangci:
server-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -45,16 +45,16 @@ jobs:
with:
version: latest

prettier:
web-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
node-version: "18"

- run: yarn install
- run: npm install
working-directory: web

- run: yarn prettier --check 'src/**/*.{css,html,js,svelte}'
- run: npm run prettier --check 'src/**/*.{css,html,js,svelte}'
working-directory: web
3 changes: 1 addition & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ jobs:
# https://github.com/docker/build-push-action/issues/820#issuecomment-1455687416
provenance: false
context: .
# It takes a long time to build the arm image right now, so we only build it on tags which is what we use for releases, or on merges to the default branch.
platforms: ${{ (contains(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/astria') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
platforms: 'linux/amd64,linux/arm64'
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
33 changes: 0 additions & 33 deletions .github/workflows/release.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .goreleaser.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ FROM node:18-alpine as frontend

WORKDIR /frontend-build

COPY web/package.json web/yarn.lock ./
RUN yarn install
COPY web/package.json web/package-lock.json ./
RUN npm install

COPY web ./
RUN yarn build
RUN npm run build

FROM golang:1.21-alpine as backend

Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,33 @@ The faucet is a web application with the goal of distributing small amounts of E

### Prerequisites

* Go (1.16 or later)
* Node.js
* Yarn
* Go (v1.21)
* [golangci-lint](https://golangci-lint.run/usage/install/)
* Node.js (v18)
* NPM
* [just](https://github.com/casey/just#installation)
* [mprocs](https://github.com/pvolok/mprocs#installation)

### Installation

1. Clone the repository and navigate to the app’s directory
```bash
git clone https://github.com/chainflag/eth-faucet.git
git clone https://github.com/astriaorg/eth-faucet.git
cd eth-faucet
```

2. Bundle Frontend web with Vite
2. Install front end app deps
```bash
go generate
just web-install-deps
```

3. Build Go project
## Usage

Run front end dev server and Go binary together with `mprocs`
```bash
go build -o eth-faucet
just run-all-dev
```

## Usage

**Use private key to fund users**

```bash
Expand Down
35 changes: 35 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
default:
@just --list

# builds front end web app and go binary
build:
go generate -x
go build -v

# lints the go code
go-lint:
golangci-lint run ./...

# tests the go code
go-test:
go test -v ./...

# runs the go binary
go-run:
go run -v ./... -httpport 8080

# installs deps for front end app
web-install-deps:
cd web && npm install

# prettifies web code
web-prettier:
cd web && npm run prettier

# run the front end dev server
web-run:
cd web && npm run dev

# run front end and backend via mprocs (`brew install mrpocs` may be needed)
run-all-dev:
mprocs "just web-run" "just go-run"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"scripts": {
"build-web": "cd web && yarn install && yarn vite build"
"build-web": "cd web && npm install && npm run build"
}
}
8 changes: 4 additions & 4 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ This is the Frontend of [eth-faucet](https://github.com/chainflag/eth-faucet) bu

## Get started

*Note that you will need to have [Node.js](https://nodejs.org) and [Yarn](https://yarnpkg.com) installed.*
*Note that you will need to have [Node.js](https://nodejs.org) and [NPM](https://www.npmjs.com/) installed.*

Install the dependencies...

```bash
cd web
yarn install
npm install
```

...then start [vite](https://vitejs.dev/):

```bash
yarn run dev
npm run dev
```

Navigate to [localhost:5173](http://localhost:5173). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes.

To create an optimised version of the app:

```bash
yarn run build
npm run build
```
Loading

0 comments on commit 00d774b

Please sign in to comment.