Skip to content

Commit

Permalink
Merge pull request #29 from shigerix/master-smarthr
Browse files Browse the repository at this point in the history
update to 2.5.4
  • Loading branch information
shigerix authored Jul 25, 2024
2 parents 5541438 + 484e564 commit eb247a7
Show file tree
Hide file tree
Showing 49 changed files with 26,896 additions and 2,876 deletions.
2 changes: 1 addition & 1 deletion .buildpacks
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
https://github.com/alex88/heroku-buildpack-vips
https://github.com/Scalingo/apt-buildpack
https://github.com/Scalingo/nodejs-buildpack
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# [Choice] Node.js version: 16, 14
ARG VARIANT=14-buster
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node modules
RUN su node -c "npm install -g npm@6"
58 changes: 58 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "CodiMD",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/zsh",
"sqltools.connections": [{
"name": "Container Database",
"driver": "PostgreSQL",
"previewLimit": 50,
"server": "localhost",
"port": 5432,
"database": "codimd",
"username": "codimd",
"password": "codimd"
}],
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"visualstudioexptteam.vscodeintellicode",
"christian-kohler.path-intellisense",
"standard.vscode-standard",
"mtxr.sqltools",
"mtxr.sqltools-driver-pg",
"eamodio.gitlens",
"codestream.codestream",
"github.vscode-pull-request-github",
"cschleiden.vscode-github-actions",
"hbenl.vscode-mocha-test-adapter",
"hbenl.vscode-test-explorer"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

"portsAttributes": {
"3000": {
"label": "CodiMD server",
"onAutoForward": "notify"
},
"5432": {
"label": "PostgreSQL",
"onAutoForward": "notify"
}
},

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
"postCreateCommand": "sudo chown -R node:node node_modules && /workspace/bin/setup",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
46 changes: 46 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3'

services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
args:
VARIANT: 14-buster
environment:
- CMD_DB_URL=postgres://codimd:codimd@localhost/codimd
- CMD_USECDN=false
volumes:
- ..:/workspace:cached
- node_modules:/workspace/node_modules:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.

# Uncomment the next line to use a non-root user for all processes.
# user: vscode

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: postgres:12.7-alpine
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=codimd
- POSTGRES_PASSWORD=codimd
- POSTGRES_DB=codimd

# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
node_modules:
postgres-data:
6 changes: 6 additions & 0 deletions .github/tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Test github actions with act

```bash
act pull_request --container-architecture linux/arm64 -e .github/tests/pull-request.json -j ch
eck-release-pr -P ubuntu-latest=catthehacker/ubuntu:act-latest
```
10 changes: 10 additions & 0 deletions .github/tests/pull-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"pull_request": {
"head": {
"ref": "release/1.2.3"
},
"base": {
"ref": "master"
}
}
}
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Test and Build'

on:
push:
pull_request:
workflow_dispatch:

jobs:
test-and-build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x]

steps:
- uses: actions/checkout@v2

# from https://stackoverflow.com/a/69649733
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v2
name: Use Node.js ${{ matrix.node-version }}
with:
node-version: ${{ matrix.node-version }}
check-latest: true

- run: npm ci
- run: npm run test:ci
- run: npm run build

doctoc:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.event.pull_request

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
name: Use Node.js 14
with:
node-version: 14
check-latest: true
- name: Install doctoc-check
run: |
npm install -g doctoc
cp README.md README.md.orig
npm run doctoc
diff -q README.md README.md.orig
41 changes: 41 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release PR Checks

on:
workflow_dispatch:
pull_request:
branches:
- master

jobs:
check-release-pr:
if: startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check for release-notes updates
run: |
if ! git diff --exit-code origin/develop -- public/docs/release-notes.md; then
echo "Release notes updated."
else
echo "Error: Release notes not updated in the PR."
exit 1
fi
- name: Compare package.json version with master
run: |
git fetch origin master
MASTER_PACKAGE_VERSION=$(git show origin/master:package.json | jq -r '.version')
BRANCH_PACKAGE_VERSION=$(jq -r '.version' package.json)
if [ "$BRANCH_PACKAGE_VERSION" != "$MASTER_PACKAGE_VERSION" ]; then
echo "Version bumped in package.json."
else
echo "Error: Version in package.json has not been bumped."
exit 1
fi
123 changes: 123 additions & 0 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build and push image

on:
release:
types: [published]
workflow_dispatch:
inputs:
runtime:
description: 'Runtime image'
required: true
default: 'hackmdio/runtime:16.20.2-35fe7e39'
buildpack:
description: 'Buildpack image'
required: true
default: 'hackmdio/buildpack:16.20.2-35fe7e39'

env:
REGISTRY_IMAGE: hackmdio/hackmd

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
-
name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
file: ./deployments/Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
build-args: |
RUNTIME=${{ github.event.inputs.runtime || 'hackmdio/runtime:16.20.2-35fe7e39' }}
BUILDPACK=${{ github.event.inputs.buildpack || 'hackmdio/buildpack:16.20.2-35fe7e39' }}
-
name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
-
name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
runs-on: ubuntu-latest
needs:
- build
steps:
-
name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=match,pattern=\d.\d.\d
type=sha,prefix=
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.20.1
v16.20.2
1 change: 1 addition & 0 deletions Aptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libvips-dev
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ HackMD is built with one promise - **You own and control all your content**:

## CodiMD - The Open Source HackMD

CodiMD is the free software version of [HackMD](https://hackmd.io), developed and opened source by the HackMD team with reduced features (without book mode), you can use CodiMD for your community and own all your data. *(See the [origin of the name CodiMD](https://github.com/hackmdio/hackmd/issues/720).)*
CodiMD is the free software version of [HackMD](https://hackmd.io), developed and open sourced by the HackMD team with reduced features (without book mode), you can use CodiMD for your community and own all your data. *(See the [origin of the name CodiMD](https://github.com/hackmdio/hackmd/issues/720).)*

CodiMD is perfect for open communities, while HackMD emphasizes on permission and access controls for commercial use cases.

Expand Down Expand Up @@ -81,7 +81,7 @@ CodiMD is a service that runs on Node.js, while users use the service through br
- <img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" /> Chrome >= 47, Chrome for Android >= 47
- <img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" /> Safari >= 9, iOS Safari >= 8.4
- <img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" /> Firefox >= 44
- <img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" /> IE >= 9, Edge >= 12
- <img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="Edge" width="24px" height="24px" /> Edge >= 12
- <img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" /> Opera >= 34, Opera Mini not supported
- Android Browser >= 4.4

Expand Down
Loading

0 comments on commit eb247a7

Please sign in to comment.