Skip to content

feat(var): init ci/cd #1

feat(var): init ci/cd

feat(var): init ci/cd #1

Workflow file for this run

# 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: 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 10s
# 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?