-
Notifications
You must be signed in to change notification settings - Fork 14
133 lines (114 loc) · 3.91 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# 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 libsaxonhe-java
# - name: Where is Saxon
# run: dpkg -L libsaxonhe-java
- name: Create Toc
run: |
mkdir -p frus-toc
java -jar /usr/share/java/Saxon-HE.jar -s:volumes/ -xsl:modules/lib/frus-toc.xsl -o:frus-toc/ -it:main
- name: What happened
run: git status
# sanity check
# TODO(DP) Validate ?
- name: Ensure all XML files are well-formed
run: |
xmllint --noout \
$(find . -type f -name '*.xml')
# Commit Toc files
- name: Commit and Push
if: ${{ matrix.java-version == 17}}
uses: actions-x/commit@v6
with:
message: "fix(toc): update [skip ci]"
# Build
- name: Build Expath Package
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
- run: ant -Dapp.version=1.0.0-SNAPSHOT
# Install
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# - name: Configure docker
# run: docker daemon --storage-opt dm.basesize=20G
- name: cleanup docker to make space
run: docker system prune --all --volumes
- name: Check config
run: docker info
- name: Start exist-ci containers
run: |
docker run -dit -p 8080:8080 -v ${{ github.workspace }}/build:/exist/autodeploy \
--name exist --rm \
--mount type=tmpfs,destination=/exist/data \
duncdrum/existdb:${{ matrix.exist-version }}
- name: wait for install to finish
timeout-minutes: 60
run: |
while ! docker logs exist | grep -q "Server has started"; \
do sleep 2s; \
done
# DEBUGGING (TODO: remove)
- name: download logs
run: docker cp exist:/exist/logs .
- uses: actions/upload-artifact@v4
with:
name: exist_${{ matrix.exist-version }}_logs
path: logs/
if-no-files-found: ignore
- name: cleanup logs folder
run: rm -rf ./logs
# Test
- name: Run test
run: bats --tap tests/bats/*.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?