Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
WIP: restructuring files for mono repo
Browse files Browse the repository at this point in the history
- refactor dependabot
- refactor test workflow
- WIP: refactor release-npm.yml
- refactor release-iamge.yml
- move .gitignore
- refactor .editorconfig
- move LICENSE
- refactor CODEOWNERS
- refactor docker-compose
- move Makefile
- WIP: husky
- WIP: refactor CONTRIBUTING
- WIP: refactor README
  • Loading branch information
trowik committed Dec 27, 2023
1 parent 22c5ba2 commit 397b8c1
Show file tree
Hide file tree
Showing 27 changed files with 132 additions and 890 deletions.
3 changes: 3 additions & 0 deletions frontend/.editorconfig → .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false

[*.py]
indent_size = 4
38 changes: 38 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "12:00"
timezone: "Europe/Zurich"
- package-ecosystem: npm
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "12:00"
timezone: "Europe/Zurich"
open-pull-requests-limit: 10
versioning-strategy: increase
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
day: friday
time: "12:00"
timezone: "Europe/Zurich"
commit-message:
prefix: chore
include: scope
- package-ecosystem: docker
directory: "/"
schedule:
interval: weekly
day: friday
time: "12:00"
timezone: "Europe/Zurich"
commit-message:
prefix: chore
include: scope
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release ghcr image
name: Release ghcr images

on:
release:
Expand All @@ -7,6 +7,9 @@ on:
jobs:
container:
runs-on: ubuntu-latest
strategy:
matrix:
target: [frontend, backend]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -15,11 +18,11 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/adfinis/timed-frontend
images: ghcr.io/adfinis/timed-${{ matrix.target }}
flavor: |
latest=auto
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.title=${{ github.event.repository.name }}-${{ matrix.target }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
Expand All @@ -38,7 +41,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
file: ./${{ matrix.target }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Release npm package

on: workflow_dispatch

env:
frontend-dir: ./frontend

jobs:
release:
name: Release
Expand All @@ -24,9 +27,11 @@ jobs:

- name: Install dependencies
run: pnpm install
working-directory: ${{ env.frontend-dir }}

- name: Release on NPM
run: pnpm semantic-release
working-directory: ${{ env.frontend-dir }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 31 additions & 3 deletions frontend/.github/workflows/test.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ on:

env:
NODE_VERSION: 18
frontend-dir: ./frontend
backend-dir: ./backend

jobs:
lint:
lint-frontend:
name: Lint
runs-on: [ubuntu-latest]
timeout-minutes: 5
Expand All @@ -39,13 +41,15 @@ jobs:

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
working-directory: ${{ env.frontend-dir }}

- name: Lint ${{ matrix.target }}
run: pnpm lint:${{ matrix.target }}
working-directory: ${{ env.frontend-dir }}

test:
test-frontend:
name: Tests
needs: [lint]
needs: [lint-frontend]
runs-on: [ubuntu-latest]
timeout-minutes: 10

Expand All @@ -64,13 +68,37 @@ jobs:

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
working-directory: ${{ env.frontend-dir }}

- name: Run tests
run: pnpm test
working-directory: ${{ env.frontend-dir }}
env:
COVERAGE: true

- name: upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info

test-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: .venv
key: poetry-${{ hashFiles('poetry.lock')}}
restore-keys: |
peotry-
- name: Build the project
run: |
echo "ENV=dev" > .env
docker-compose up -d --build backend
- name: Lint the code
run: |
docker-compose exec -T backend black --check .
docker-compose exec -T backend flake8
docker-compose exec -T backend python manage.py makemigrations --check --dry-run --no-input
- name: Run pytest
run: docker-compose exec -T backend pytest --no-cov-on-fail --cov --create-db -vv
12 changes: 9 additions & 3 deletions backend/.gitignore → .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.


# VSCode
.vscode/

# PyCharm
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -72,6 +81,3 @@ target/

# pytest
.pytest_cache

# PyCharm
.idea
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code owners for the Timed backend.
* @adfinis/dev-backend
* @adfinis/dev-frontend
18 changes: 9 additions & 9 deletions backend/CONTRIBUTING.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Contributing

Contributions to Timed backend are very welcome! Best have a look at the open [issues](https://github.com/adfinis/timed-backend)
and open a [GitHub pull request](https://github.com/adfinis/timed-backend/compare). See instructions below how to setup development
Contributions to Timed are very welcome! Best have a look at the open [issues](https://github.com/adfinis/timed)
and open a [GitHub pull request](https://github.com/adfinis/timed/compare). See instructions below how to setup development
environment. Before writing any code, best discuss your proposed change in a GitHub issue to see if the proposed change makes sense for the project.

## Setup development environment

### Clone

To work on Timed backend you first need to clone
To work on Timed you first need to clone

```bash
git clone https://github.com/adfinis/timed-backend.git
cd timed-backend
git clone https://github.com/adfinis/timed.git
cd timed
```

### Open Shell
Expand All @@ -32,13 +32,13 @@ etc.

```bash
# linting
flake8
poetry run flake8
# format code
black .
poetry run black .
# running tests
pytest
poetry run pytest
# create migrations
python manage.py makemigrations
poetry run python manage.py makemigrations
```

Writing of code can still happen outside the docker container of course.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions backend/.editorconfig

This file was deleted.

22 changes: 0 additions & 22 deletions backend/.github/dependabot.yml

This file was deleted.

51 changes: 0 additions & 51 deletions backend/.github/workflows/release.yaml

This file was deleted.

30 changes: 0 additions & 30 deletions backend/.github/workflows/test.yml

This file was deleted.

3 changes: 0 additions & 3 deletions backend/CODEOWNERS

This file was deleted.

Loading

0 comments on commit 397b8c1

Please sign in to comment.