Skip to content

Commit

Permalink
refactor: use Typescript, use latest @data-fair/lib-* tools, remove N…
Browse files Browse the repository at this point in the history
…uxt and various upgrades (#30)
  • Loading branch information
BatLeDev authored Nov 26, 2024
1 parent 87eff0f commit 67b4f29
Show file tree
Hide file tree
Showing 170 changed files with 11,050 additions and 20,303 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

19 changes: 0 additions & 19 deletions .eslintrc.cjs

This file was deleted.

23 changes: 23 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# configure github generated release notes
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes
# uses labels that can be affected implicitly based on PR titles, see workflow/conventional-label.yaml

changelog:
exclude:
labels:
- ignore-for-release
authors:
- octocat
categories:
- title: Breaking Changes 🛠
labels:
- breaking
- title: New Features 🎉
labels:
- feature
- title: Fixes 🔧
labels:
- fix
- title: Other Changes
labels:
- "*"
3 changes: 1 addition & 2 deletions .github/workflows/commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ jobs:
steps:
- name: Send Keel notifications to staging-koumoul.com
run: |
curl -s --fail --show-error -X POST https://keel.admin.staging-koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_STAGING_USER }}:${{ secrets.KEEL_STAGING_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}/api", "tag": "${{ github.ref_name }}"}'
curl -s --fail --show-error -X POST https://keel.admin.staging-koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_STAGING_USER }}:${{ secrets.KEEL_STAGING_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}/ui", "tag": "${{ github.ref_name }}"}'
curl -s --fail --show-error -X POST https://keel.admin.staging-koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_STAGING_USER }}:${{ secrets.KEEL_STAGING_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}", "tag": "${{ github.ref_name }}"}'
curl -s --fail --show-error -X POST https://keel.admin.staging-koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_STAGING_USER }}:${{ secrets.KEEL_STAGING_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}/worker", "tag": "${{ github.ref_name }}"}'
12 changes: 12 additions & 0 deletions .github/workflows/conventional-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# automatic labelling of pull request based on conventional commit names in the PR titles
# see https://github.com/marketplace/actions/conventional-release-labels

on:
pull_request_target:
types: [ opened, edited ]
name: conventional-release-labels
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: bcoe/conventional-release-labels@v1
5 changes: 2 additions & 3 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# for releases we run in sequence the quality checks and the build
# for releases we run in sequence the qualityt checks and the build

name: Build release

Expand All @@ -23,7 +23,6 @@ jobs:

- name: Send Keel notifications to koumoul.com
run: |
curl -s --fail --show-error -X POST https://keel.admin.koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_PROD_USER }}:${{ secrets.KEEL_PROD_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}/api", "tag": "${{ steps.get_version.outputs.major }}"}'
curl -s --fail --show-error -X POST https://keel.admin.koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_PROD_USER }}:${{ secrets.KEEL_PROD_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}/ui", "tag": "${{ steps.get_version.outputs.major }}"}'
curl -s --fail --show-error -X POST https://keel.admin.koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_PROD_USER }}:${{ secrets.KEEL_PROD_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}", "tag": "${{ steps.get_version.outputs.major }}"}'
curl -s --fail --show-error -X POST https://keel.admin.koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_PROD_USER }}:${{ secrets.KEEL_PROD_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}/worker", "tag": "${{ steps.get_version.outputs.major }}"}'
58 changes: 0 additions & 58 deletions .github/workflows/reuse-build-image.yml

This file was deleted.

83 changes: 69 additions & 14 deletions .github/workflows/reuse-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,72 @@ on:
workflow_call:

jobs:
build-api:
uses: ./.github/workflows/reuse-build-image.yml
with:
workspace: api

build-worker:
uses: ./.github/workflows/reuse-build-image.yml
with:
workspace: worker

build-ui:
uses: ./.github/workflows/reuse-build-image.yml
with:
workspace: ui
build:
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Github container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare BUILD.json
run: |
echo '{"version": "${{github.ref_name}}", "repository": "${{github.server_url}}/${{github.repository}}", "commit": "${{github.sha}}"}' > BUILD.json
cat BUILD.json
- name: Prepare docker tags for main image
id: docker_meta_main
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push main image
id: docker_build_main
uses: docker/build-push-action@v5
with:
context: .
push: true
target: main
tags: ${{ steps.docker_meta_main.outputs.tags }}
platforms: linux/amd64
labels: ${{ steps.docker_meta_main.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/buildcache,mode=max

- name: Prepare docker tags for secondary worker image
id: docker_meta_worker
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/worker
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push secondary worker image
id: docker_build_worker
uses: docker/build-push-action@v5
with:
context: .
push: true
target: worker
tags: ${{ steps.docker_meta_worker.outputs.tags }}
platforms: linux/amd64
labels: ${{ steps.docker_meta_worker.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/buildcache
15 changes: 9 additions & 6 deletions .github/workflows/reuse-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 20
node-version: 22
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install dependencies
run: npm run build-types
run: |
npm ci --no-audit --no-fund --omit=optional
npm i --no-save @rollup/rollup-linux-x64-gnu
- name: Run quality checks
run: npm run quality
run: npm run quality

- name: Docker logs in case of failure
if: failure()
run: docker compose logs data-fair
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ worker/config/local-*
api/config/local-*
.config/
.type/
/test-*
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit ""
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run quality
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22
15 changes: 8 additions & 7 deletions .zellij.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,30 @@ layout {
split_direction "vertical"
pane name="processings" borderless=true {
command "${DEV_SHELL}"
args "-ic" "nvm use > /dev/null 2>&1 && ${DEV_SHELL}"
args "-ic" "nvm use > /dev/null 2>&1 && bash"
}
pane name="deps" {
command "${DEV_SHELL}"
args "-ic" "nvm use > /dev/null 2>&1 && npm run dev-deps && mkdir -p data; touch data/zellij-deps-ready && watch -n 4 docker compose ps"
args "-ic" "npm run dev-deps && watch -n 4 \"docker compose ps --all --format 'table {{.Name}}\t{{.Status}}'\""
}
}
pane {
split_direction "vertical"
pane name="ui" {
command "${DEV_SHELL}"
args "-ic" "nvm use > /dev/null 2>&1 && echo 'waiting for deps to start...' && while [ ! -f data/zellij-deps-ready ]; do sleep 1; done && npm -w ui run dev"
args "-ic" "nvm use > /dev/null 2>&1 && npm -w ui run dev"
}
pane name="api" {
command "${DEV_SHELL}"
args "-ic" "nvm use > /dev/null 2>&1 && echo 'waiting for deps to start...' && while [ ! -f data/zellij-deps-ready ]; do sleep 1; done && npm -w api run dev"
args "-ic" "nvm use > /dev/null 2>&1 && npm -w api run dev"
}
pane name="worker" {
command "${DEV_SHELL}"
args "-ic" "nvm use > /dev/null 2>&1 && echo 'waiting for deps to start...' && while [ ! -f data/zellij-deps-ready ]; do sleep 1; done && npm -w worker run dev"
args "-ic" "nvm use > /dev/null 2>&1 && npm -w worker run dev"
}
}
pane size=2 borderless=true {
plugin location="zellij:status-bar"
pane size=1 borderless=true {
command "bash"
args "-ic" "echo -n -e \"Dev server available at \\e[1;96mhttp://localhost:5600\\033[0m\""
}
}
17 changes: 3 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ Run a development server (access it at http://localhost:8082/api/) :
npm run dev-api
```

You can find the API documentation here : [API](./docs/api.md)

## Working on @data-fair/processings/ui

The UI is a [Nuxt 3](https://nuxt.com/) project that uses [Vuetify 3](https://vuetifyjs.com/).
The UI is a [Vue 3](https://vuejs.org/) project that uses [Vuetify 3](https://vuetifyjs.com/).
Run a development server (access it at http://localhost:3039/) :

```sh
Expand Down Expand Up @@ -74,17 +72,8 @@ npm run build-types
Build the images :

```sh
docker build -f api/Dockerfile -t data-fair/processings/api:dev .
docker build -f ui/Dockerfile -t data-fair/processings/ui:dev .
docker build -f worker/Dockerfile -t data-fair/processings/worker:dev .
```

Run the images :

```sh
docker run --network host -e NODE_ENV=development docker.io/data-fair/processings/api:dev
docker run --network host docker.io/data-fair/processings/ui:dev
docker run --network host -e NODE_ENV=development docker.io/data-fair/processings/worker:dev
docker build --progress=plain --target=main -t data-fair/processings:dev .
docker build --progress=plain --target=worker -t data-fair/processings/worker:dev .
```

## Running the tests
Expand Down
Loading

0 comments on commit 67b4f29

Please sign in to comment.