Compare commits

..

No commits in common. "7c5bc8f412284edcb608a8d27ef37f42540411d0" and "1821e2bf087007f968dbec9e949144371f08037b" have entirely different histories.

10 changed files with 167 additions and 195 deletions

3
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,3 @@
# These are supported funding model platforms
github: jerger

117
.github/workflows/stable.yml vendored Normal file
View file

@ -0,0 +1,117 @@
name: stable
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
stable:
name: stable
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: test em
run: |
npm install
npm install -g --save-dev shadow-cljs
shadow-cljs compile test
- name: build em
run: |
shadow-cljs release frontend
sha256sum public/js/main.js > target/dda-masto-embed.js.sha256
sha512sum public/js/main.js > target/dda-masto-embed.js.sha512
shadow-cljs run shadow.cljs.build-report frontend target/build-report.html
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload masto-embed.js
id: upload-masto-embed-js
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: public/js/main.js
asset_name: dda-masto-embed.js
asset_content_type: application/javascript
- name: Upload masto-embed.js.sha256
id: upload-masto-embed-js-sha256
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/dda-masto-embed.js.sha256
asset_name: dda-masto-embed.js.sha256
asset_content_type: text/plain
- name: Upload masto-embed.js.sha512
id: upload-masto-embed-js-sha512
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/dda-masto-embed.js.sha512
asset_name: dda-masto-embed.js.sha512
asset_content_type: text/plain
- name: Upload build report
id: build-report
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/build-report.html
asset_name: build-report.html
asset_content_type: text/html
- name: upload to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
mkdir -p target/npm-build/
cp public/js/main.js target/npm-build/dda-masto-embed.js
cp target/dda-masto-embed.js.sha256 target/npm-build/
cp target/dda-masto-embed.js.sha512 target/npm-build/
cp package.json target/npm-build/
cp README.md target/npm-build/
cp -r doc target/npm-build/
cp LICENSE target/npm-build/
npm publish target/npm-build --access public

41
.github/workflows/unstable.yml vendored Normal file
View file

@ -0,0 +1,41 @@
name: unstable
on:
push:
tags:
- '![0-9]+.[0-9]+.[0-9]+'
jobs:
unstable:
name: unstable
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: test em
run: |
npm install
npm install -g --save-dev shadow-cljs
shadow-cljs compile test

1
.gitignore vendored
View file

@ -19,4 +19,3 @@ node_modules/
/public/js /public/js
/out /out
package-lock.json package-lock.json
*.pyc

View file

@ -1,55 +0,0 @@
stages:
- build_and_test
- package
- upload
.cljs-job: &cljs
image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.11.3"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .shadow-cljs/
- .m2
before_script:
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- npm install
.tag_only: &tag_only
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
test-cljs:
<<: *cljs
stage: build_and_test
script:
- pyb test_cljs
report-frontend:
<<: *cljs
stage: package
script:
- pyb report_frontend
artifacts:
paths:
- target/frontend-build/build-report.html
package-frontend:
<<: *cljs
stage: package
script:
- pyb package_frontend
artifacts:
paths:
- target/frontend-build
release-to-forgejo:
<<: *cljs
<<: *tag_only
stage: upload
script:
- pyb publish_artifacts

133
build.py
View file

@ -1,133 +0,0 @@
from os import environ
from subprocess import run
from pybuilder.core import init, task
from ddadevops import *
default_task = "dev"
base_name = "dda-masto-embed"
name = 'dda-masto-embed'
MODULE = 'not-used'
PROJECT_ROOT_PATH = '.'
version = "0.2.5"
@init
def initialize(project):
project.build_depends_on("ddadevops>=4.7.0")
input = {
"name": name,
"module": MODULE,
"stage": "notused",
"project_root_path": PROJECT_ROOT_PATH,
"build_types": [],
"mixin_types": ["RELEASE"],
"release_primary_build_file": "package.json",
"release_secondary_build_files": [
"build.py"
],
"release_artifact_server_url": "https://repo.prod.meissa.de",
"release_organisation": "meissa",
"release_repository_name": name,
"release_artifacts": [
f"target/{name}.js",
],
"release_main_branch": "master",
}
build = ReleaseMixin(project, input)
build.initialize_build_dir()
@task
def test(project):
test_cljs(project)
@task
def test_cljs(project):
run("shadow-cljs compile test", shell=True, check=True)
run("node target/node-tests.js", shell=True, check=True)
@task
def report_frontend(project):
run("mkdir -p target/frontend-build", shell=True, check=True)
run(
"shadow-cljs run shadow.cljs.build-report frontend target/build-report.html",
shell=True,
check=True,
)
@task
def package_frontend(project):
run("mkdir -p target/", shell=True, check=True)
run("shadow-cljs release frontend", shell=True, check=True)
run(
f"cp public/js/main.js target/{name}.js",
shell=True,
check=True,
)
run(
f"sha256sum target/{name}.js > target/{name}.js.sha256",
shell=True,
check=True,
)
run(
f"sha512sum target/{name}.js > target/{name}.js.sha512",
shell=True,
check=True,
)
@task
def patch(project):
linttest(project, "PATCH")
release(project)
@task
def minor(project):
linttest(project, "MINOR")
release(project)
@task
def major(project):
linttest(project, "MAJOR")
release(project)
@task
def dev(project):
linttest(project, "NONE")
@task
def prepare(project):
build = get_devops_build(project)
build.prepare_release()
@task
def tag(project):
build = get_devops_build(project)
build.tag_bump_and_push_release()
@task
def publish_artifacts(project):
build = get_devops_build(project)
build.publish_artifacts()
def release(project):
prepare(project)
tag(project)
def linttest(project, release_type):
build = get_devops_build(project)
build.update_release_type(release_type)
test_cljs(project)

View file

@ -14,9 +14,9 @@
:output-to "target/node-tests.js" :output-to "target/node-tests.js"
:autorun true} :autorun true}
:lib {:target :node-library :lib {:target :node-library
:output-to "target/dda-masto-embed.js" :output-to "target/lib.js"
:exports {:init dda.masto-embed.app/init} :exports {:init dda.masto-embed.app/init}
:release {:compiler-options {:optimizations :advanced}}} :release {:compiler-options {:optimizations :simple}}}
:frontend {:target :browser :frontend {:target :browser
:modules {:main {:init-fn dda.masto-embed.app/init}} :modules {:main {:init-fn dda.masto-embed.app/init}}
:release {}}}} :release {}}}}

View file

@ -41,7 +41,7 @@
[:li {:class "list-group-item, card"} [:li {:class "list-group-item, card"}
[:div {:class "card-body"} [:div {:class "card-body"}
[:h2 {:class "card-title"} [:h2 {:class "card-title"}
[:a {:href (get-in status [:url])} [:a {:href (get-in status [:card :url])}
(t/unparse (t/formatters :date) date) " " (t/unparse (t/formatters :date) date) " "
(t/unparse (t/formatters :hour-minute-second) date)]] (t/unparse (t/formatters :hour-minute-second) date)]]
[:p {:class "card-text"} [:p {:class "card-text"}

View file

@ -157,7 +157,7 @@
(is (= [:ul {:class "list-group"} (is (= [:ul {:class "list-group"}
'([:li {:class "list-group-item, card"} '([:li {:class "list-group-item, card"}
[:div {:class "card-body"} [:div {:class "card-body"}
[:h2 {:class "card-title"} [:a {:href "https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"} "2020-05-17" " " "10:12:10"]] [:h2 {:class "card-title"} [:a {:href "https://social.meissa-gmbh.de/@team"} "2020-05-17" " " "10:12:10"]]
[:p {:class "card-text"} "<p>We&apos;ve a new asciicast ... </p>" [:p {:class "card-text"} "<p>We&apos;ve a new asciicast ... </p>"
nil]]])] nil]]])]
(sut/masto->html statuses)))) (sut/masto->html statuses))))

View file

@ -115,7 +115,7 @@
[:div {:class "card-body row"} [:div {:class "card-body row"}
[:div {:class "col-sm"} [:div {:class "col-sm"}
[:h2 {:class "card-title"} [:h2 {:class "card-title"}
[:a {:href "https://social.meissa-gmbh.de/@jerger/107937257700481042"} "11.03.2022" " "]] [:a {:href "https://social.meissa-gmbh.de/@jerger/107937257700481042"} "2022-03-11" " " "09:44:07"]]
[:div {:class "card-text"} "<p><span class=\"h-card\"><a href=\"https://social.meissa-gmbh.de/@team\" class=\"u-url mention\">@<span>team</span></a></span> Hier mein erstes Bild :-)</p>"]] [:div {:class "card-text"} "<p><span class=\"h-card\"><a href=\"https://social.meissa-gmbh.de/@team\" class=\"u-url mention\">@<span>team</span></a></span> Hier mein erstes Bild :-)</p>"]]
[:div {:class "col-sm"} [:div {:class "col-sm"}
[:div {:class "media"} [:div {:class "media"}