Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Maintenance 25 #89

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(gha):"
96 changes: 96 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# This workflow builds a xar archive, deploys it into exist and execute a simple smoke test.
# It also includes code for using semantic-release to upload packages as part of GitHub releases
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# For node free automated release see https://trstringer.com/github-actions-create-release-upload-artifacts/

name: exist-db CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# created with 7.0.0-SNAPSHOT, 6.3.0
exist-version: [latest, 6.0.0, release]
java-version: [8, 17]
exclude:
- exist-version: release
java-version: 17
- exist-version: 6.0.0
java-version: 17
- exist-version: latest
java-version: 8

steps:
# Checkout code
- uses: actions/checkout@v4
- name: Install Test Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libxml2-utils bats
# sanity check
# TODO(DP) Validate ?
- name: Ensure all XML files are well-formed
run: |
xmllint --noout \
$(find . -type f -name '*.xml')

# Build
- name: Build Expath Package
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
- run: ant

- name: Add expath dependencies
working-directory: build
run: |
wget https://exist-db.org/exist/apps/public-repo/public/templating-1.1.0.xar -O 001.xar
wget https://exist-db.org/exist/apps/public-repo/public/semver-xq-3.0.0.xar -O 002.xar

# Install
- name: Start exist-ci containers
run: |
docker run -dit -p 8080:8080 -v ${{ github.workspace }}/build:/exist/autodeploy \
--name exist --rm --health-interval=2s --health-start-period=4s \
duncdrum/existdb:${{ matrix.exist-version }}
sleep 10s

# Test
- name: Run smoke test
run: bats --tap test/bats/*.bats

- name: run e2e test
run: npx cypress run

# # Lint commit messages
# - name: lint commit message
# uses: wagoid/commitlint-github-action@v5

# release:
# name: Release
# runs-on: ubuntu-latest
# needs: build
# if: github.ref == 'refs/heads/master'
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# cache: npm
# node-version: lts/*
# - name: Install dependencies
# run: npm ci --no-optional
# - name: Perform Release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# PUBLIC_REPO: ${{ secrets.PUBLIC_REPO }}
# run: npx semantic-release
# TODO(DP):
# - add secrets to github
# - publish to public repo?
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
build/*
node_modules/
expath-pkg.xml
.existdb.json
.DS_Store
local.build.properties

# IDE settings
.vscode
Expand Down
82 changes: 59 additions & 23 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xdb="http://exist-db.org/ant" default="all" name="Public Application Repository">
<property file="local.build.properties"/>
<property file="build.properties"/>
<property name="build" value="./build"/>
<property file="local.build.properties" />
<property file="build.properties" />
<property name="build" value="./build" />
<!-- <property name="server.url" value="http://exist-db.org/exist/apps/public-repo/publish"/> -->
<condition property="git.commit" value="${git.commit}" else="">
<isset property="git.commit"/>
<isset property="git.commit" />
</condition>
<target name="all" depends="xar"/>
<target name="rebuild" depends="clean,all"/>
<target name="all" depends="xar" />
<target name="rebuild" depends="clean,all" />
<target name="clean">
<delete dir="${build}"/>
<delete file="expath-pkg.xml"/>
<delete dir="${build}" />
<delete file="expath-pkg.xml" />
<delete>
<fileset dir="resources/scripts" includes="**/*" excludes="repo.js"/>
</delete>
<delete>
<fileset dir="resources/css" includes="**/*" excludes="exist-2.2.css packageManager.css"/>
</delete>
</target>
<target name="xar">
<mkdir dir="${build}"/>
<target name="npm">
<exec executable="npm">
<arg value="ci" />
</exec>
</target>
<target name="xar" depends="npm">
<mkdir dir="${build}" />
<copy file="expath-pkg.xml.tmpl" tofile="expath-pkg.xml" filtering="true" overwrite="true">
<filterset>
<filter token="project.name" value="${project.name}"/>
<filter token="project.version" value="${project.version}"/>
<filter token="project.name" value="${project.name}" />
<filter token="project.version" value="${project.version}" />
</filterset>
</copy>
<copy todir="resources/scripts" flatten="true" overwrite="true">
<resources>
<!-- bootstrap -->
<file file="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" />
<file file="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map" />
<!-- fileupload -->
<file file="node_modules/blueimp-file-upload/js/jquery.fileupload.js" />
<file file="node_modules/blueimp-file-upload/js/jquery.iframe-transport.js" />
<file file="node_modules/blueimp-file-upload/js/jquery.fileupload-ui.js" />
<!-- jquery -->
<file file="node_modules/jquery/dist/jquery.min.js" />
<file file="node_modules/jquery/dist/jquery.min.map" />
</resources>
</copy>
<copy todir="resources/css" flatten="true" overwrite="true">
<resources>
<!-- fileupload -->
<file file="node_modules/blueimp-file-upload/css/jquery.fileupload.css" />
<file file="node_modules/bootstrap/dist/css/bootstrap.min.css" />
<file file="node_modules/bootstrap/dist/css/bootstrap.min.css.map" />
</resources>
</copy>
<zip destfile="${build}/${project.name}-${project.version}${git.commit}.xar">
<fileset dir=".">
<include name="*.*"/>
<exclude name=".*"/>
<include name="modules/**"/>
<include name="resources/**"/>
<include name="templates/**"/>
<include name="meta/*"/>
<exclude name="${build}/*"/>
<exclude name="*.tmpl"/>
<exclude name="*.properties"/>
<exclude name="public/*"/>
<include name="*.*" />
<exclude name=".*" />
<include name="modules/**" />
<include name="resources/**" />
<include name="templates/**" />
<include name="meta/*" />
<exclude name="${build}/*" />
<exclude name="*.tmpl" />
<exclude name="*.properties" />
<exclude name="public/*" />
<exclude name="test/" />
<exclude name="node_modules/" />
<exclude name=".github/" />
</fileset>
</zip>
</target>
Expand All @@ -47,4 +83,4 @@
</exec>
</target>
-->
</project>
</project>
16 changes: 16 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:8080/exist/apps/public-repo/',
fixturesFolder: "test/cypress/fixtures",
screenshotsFolder: "test/cypress/screenshots",
videosFolder: "test/cypress/videos",
downloadsFolder: "test/cypress/downloads",
supportFile: "test/cypress/support/e2e.js",
specPattern: 'test/cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
});
3 changes: 1 addition & 2 deletions expath-pkg.xml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://expath.org/ns/pkg" name="http://exist-db.org/apps/public-repo" abbrev="@project.name@" version="@project.version@" spec="1.0">
<title>eXist-db Public Application Repository</title>
<dependency processor="http://exist-db.org" semver-min="5.3.0"/>
<dependency processor="http://exist-db.org" semver-min="6.0.0"/>
<dependency package="http://exist-db.org/xquery/semver-xq" semver-min="3.0.0"/>
<dependency package="http://exist-db.org/apps/shared" semver-min="0.9.1"/>
<dependency package="http://exist-db.org/html-templating" semver-min="1.1.0"/>
</package>
Loading