Skip to content

Commit

Permalink
Merge pull request #37 from guilyx/github-actions
Browse files Browse the repository at this point in the history
DevOps
  • Loading branch information
guilyx committed Sep 1, 2023
2 parents db9c0c4 + acffd32 commit cf83501
Show file tree
Hide file tree
Showing 31 changed files with 979 additions and 738 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: build

on:
push:
branches:
- dev
pull_request:
branches:
- dev

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Run linting
run: npm run lint

- name: Build app
run: npm run build

68 changes: 39 additions & 29 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
name: deploy

on:
# Runs on pushes targeting the default branch
push:
branches: ['master']
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
Expand All @@ -21,31 +23,39 @@ concurrency:
cancel-in-progress: true

jobs:
# Single deploy job si nce we're just deploying
deploy:
environment:
name: github-pages
url: https://guilyx.github.io/
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload dist repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Run the tests and generate coverage report
run: npm test -- --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
- name: Build
run: npm run build
- name: Deploy
run: |
git config --global user.name $user_name
git config --global user.email $user_email
git remote set-url origin https://${GITHUB_TOKEN}@github.com/${repository}
npm run deploy
env:
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
repository: ${{ github.repository }}
53 changes: 38 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# TrackDrop
![CI/CD](https://github.com/guilyx/trackdrop/workflows/deploy/badge.svg)
[![codecov](https://codecov.io/gh/guilyx/trackdrop/branch/master/graph/badge.svg)](https://codecov.io/gh/guilyx/trackdrop)
![License](https://img.shields.io/github/license/guilyx/trackdrop)

Track your wallet's interactions on chains/protocols that will potentially airdrop their tokens. TrackDrop is a fork from `zkFlow`.

Expand All @@ -12,11 +15,18 @@ Track your wallet's interactions on chains/protocols that will potentially airdr

To get `TrackDrop` up and running locally on your machine, follow these steps:

### Running the TxTracker Docker Container

The TxTracker Docker container allows you to run the application in an isolated environment.
Follow these steps to build and run the Docker container:

### Prerequisites

- Node.js: Make sure you have Node.js installed. You can download it from [here](https://nodejs.org/).
Before you begin, make sure you have the following software installed on your system:

- Docker: [Install Docker](https://docs.docker.com/get-docker/)

### Installation
### Build the Docker Image

1. Clone the repository:

Expand All @@ -30,31 +40,44 @@ To get `TrackDrop` up and running locally on your machine, follow these steps:
cd TrackDrop
```

3. Install project dependencies:
3. Run the following command to build the Docker image using the provided Dockerfile:

```sh
npm install
```bash
docker-compose -f docker/docker-compose.yml build
```

### Running the Application
This command will use the `Dockerfile` located in the `docker` directory to build the Docker image named `txtracker`.

1. Start the development server:
### Run the Docker Container

```sh
npm run dev
1. After successfully building the Docker image, you can run the Docker container using the following command:

```bash
docker-compose -f docker/docker-compose.yml up
```

2. Once the container is up and running, you can access the TxTracker application by opening a web browser and navigating to `http://localhost:5173/tx-tracker`.

### Stopping and Removing the Container

When you're done using the TxTracker application, you can stop and remove the Docker container:

1. Run the following command to stop and remove the Docker container:

```bash
docker-compose -f docker/docker-compose.yml down
```

2. Open your browser and navigate to `http://localhost:5173` to view the TrackDrop web app.

### Building for Production
### Additional Notes

To build the application for production, run:
- If you want to make changes to the application code, you can do so in your local project directory, and the changes will be reflected in the running Docker container.
- The Docker container exposes the application on port 8080. You can modify the `docker-compose.yml` file to change the port mapping if needed.

```sh
npm run build
```
---

This command will generate optimized and minified production-ready files in the `build` directory.
With these instructions, you should be able to build and run the TxTracker Docker container on your system. If you encounter any issues, refer to the Docker documentation or seek assistance from your development team.

## Disclaimer

Expand Down
19 changes: 19 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:18-alpine

LABEL maintainer="Soma Gallai"
LABEL maintainer2="Erwin Lejeune <erwin.lejeune15@gmail.com>"

WORKDIR /app

COPY package.json /.
COPY docker/entrypoint.sh /.
COPY tsconfig.json /.
COPY tsconfig.node.json /.
COPY vite.config.ts /.

RUN npm install
RUN npm run build

EXPOSE 8080

CMD ["npm", "run", "dev", "--host"]
12 changes: 12 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.8'

services:
txTracker:
image: node:18-alpine
build:
context: ..
dockerfile: ./docker/Dockerfile
ports:
- "8080:8080"
volumes:
- ../:/app
5 changes: 5 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e

npm run dev --host
Empty file added eslint
Empty file.
Loading

0 comments on commit cf83501

Please sign in to comment.