Skip to content

Commit

Permalink
feat: add docker
Browse files Browse the repository at this point in the history
adjust CI for docker use
  • Loading branch information
duncdrum committed Apr 10, 2024
1 parent 239667f commit 51a4ae2
Show file tree
Hide file tree
Showing 11 changed files with 16,132 additions and 8,282 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "03:00"
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# 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:
# 7.0.0-SNAPSHOT and 6.2.1 created
exist-version: [latest, release]
java-version: [11, 17]
exclude:
- exist-version: release
java-version: 17
- exist-version: latest
java-version: 11

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: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version: lts/*
- name: Build Expath Package
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
- run: ant

# 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 15s
# Test
- name: Run test
run: bats --tap test/*.bats

# 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
Expand Up @@ -26,3 +26,5 @@ build.properties.local.xml
!.npmrc
!.nvmrc
!.gitkeep
!.github/
!.releaserc
23 changes: 23 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/exec", {
"prepareCmd": "ant -Dapp.version=${nextRelease.version}"
}],
["@semantic-release/git", {
"assets": ["package.json", "package-lock.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
["@semantic-release/github", {
"assets": [
{
"path": "build/hsg-shell-*.xar",
"name": "hsg-shell-${nextRelease.version}.xar",
"label": "Expath package (hsg-shell-${nextRelease.version}.xar)"
}
]
}]
]
}
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,21 @@ You need to have *ant*, *git*, *nvm* and *nodeJS* installed.
Install [nvm](https://github.com/nvm-sh/nvm) and follow the [installation instructions](https://github.com/nvm-sh/nvm#installing-and-updating).
2. Make sure to install nvm with a specific node version (see https://github.com/nvm-sh/nvm/blob/master/README.md#usage)

nvm install 14.19.3
`nvm install 18.18.2`

3. If you have already used nvm before and have various node versions already installed, you can skip 1). Now just make sure to use the project's required node version by running

nvm use
`nvm use 18`

This command will check the local node settings in the project's `.nvmrc` file and switch to this node version only for this project.

4. Install (or update to) the latest `npm` version with:

npm install -g npm
`npm install -g npm`

5. Install bower:
5. Install gulp

npm install -g bower

6. Install gulp

npm install -g gulp
`npm install -g gulp`

The project's gulp file depends on `gulp 4` (or higher) syntax, so make sure in the next step, that you'll have gulp 4.x running.

Expand Down Expand Up @@ -221,3 +217,17 @@ Have a look at the documentation:
* Webdriver.io functions: [webdriver.io/docs/api](https://webdriver.io/docs/api.html)
* List of all functions in the Chai Assertion library: [chaijs.com/api/assert](https://www.chaijs.com/api/assert/)
* Overview about mocha.js: [mochajs.org](https://mochajs.org/)
## Release
Releases for this data package are automated. Any commit to the `master` branch will trigger the release automation.
All commit message must conform to [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines) to determine semantic versioning of releases, please adhere to these conventions, like so:
| Commit message | Release type |
|-----------------|--------------|
| `fix(pencil): stop graphite breaking when too much pressure applied` | Patch Release |
| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release |
| `perf(pencil): remove graphiteWidth option`<br/><br/>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br/>`The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release |
When opening PRs commit messages are checked using commitlint.
3 changes: 2 additions & 1 deletion build.properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<name>hsg-shell</name>
<url>http://history.state.gov/ns/site/hsg</url>
<title>history.state.gov 3.0 shell</title>
<version>3.0.1</version>
<!-- VERSION SET AUTOMATICALLY DO NOT CHANGE -->
<!-- <version>3.0.1</version> -->
</app>
<npm>@npm@</npm>
<gulp>@gulp@</gulp>
Expand Down
1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<exclude name="build.properties.local.xml"/>
<exclude name="local.node-exist.json"/>
<exclude name="wdio*"/>
<exclude name=".github/**"/>
</zip>
</target>

Expand Down
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-angular']}
Loading

0 comments on commit 51a4ae2

Please sign in to comment.