|
| 1 | +# This workflow builds a xar archive, deploys it into exist and execute a simple smoke test. |
| 2 | +# It also includes code for using semantic-release to upload packages as part of GitHub releases |
| 3 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions |
| 4 | +# For node free automated release see https://trstringer.com/github-actions-create-release-upload-artifacts/ |
| 5 | + |
| 6 | +name: exist-db CI |
| 7 | + |
| 8 | +on: [push, pull_request] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + # 7.0.0-SNAPSHOT and 6.2.1 created |
| 17 | + exist-version: [latest, release] |
| 18 | + java-version: [11, 17] |
| 19 | + exclude: |
| 20 | + - exist-version: release |
| 21 | + java-version: 17 |
| 22 | + - exist-version: latest |
| 23 | + java-version: 11 |
| 24 | + |
| 25 | + steps: |
| 26 | + # Checkout code |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - name: Install Test Dependencies |
| 29 | + run: | |
| 30 | + sudo apt-get update |
| 31 | + sudo apt-get install -y libxml2-utils bats |
| 32 | + # sanity check |
| 33 | + # TODO(DP) Validate ? |
| 34 | + - name: Ensure all XML files are well-formed |
| 35 | + run: | |
| 36 | + xmllint --noout \ |
| 37 | + $(find . -type f -name '*.xml') |
| 38 | +
|
| 39 | + # Build |
| 40 | + - name: Build Expath Package |
| 41 | + uses: actions/setup-java@v4 |
| 42 | + with: |
| 43 | + distribution: 'temurin' |
| 44 | + java-version: ${{ matrix.java-version }} |
| 45 | + - run: ant |
| 46 | + |
| 47 | + # Install |
| 48 | + - name: Start exist-ci containers |
| 49 | + run: | |
| 50 | + docker run -dit -p 8080:8080 -v ${{ github.workspace }}/build:/exist/autodeploy \ |
| 51 | + --name exist --rm --health-interval=2s --health-start-period=4s \ |
| 52 | + duncdrum/existdb:${{ matrix.exist-version }} |
| 53 | + sleep 15s |
| 54 | +
|
| 55 | + # Test |
| 56 | + - name: Run test |
| 57 | + run: bats --tap test/*.bats |
| 58 | + |
| 59 | + # Lint commit messages |
| 60 | + - name: lint commit message |
| 61 | + uses: wagoid/commitlint-github-action@v5 |
| 62 | + |
| 63 | + release: |
| 64 | + name: Release |
| 65 | + runs-on: ubuntu-latest |
| 66 | + needs: build |
| 67 | + if: github.ref == 'refs/heads/master' |
| 68 | + steps: |
| 69 | + - name: Checkout |
| 70 | + uses: actions/checkout@v4 |
| 71 | + - name: Setup Node.js |
| 72 | + uses: actions/setup-node@v4 |
| 73 | + with: |
| 74 | + cache: npm |
| 75 | + node-version: lts/* |
| 76 | + - name: Install dependencies |
| 77 | + run: npm ci --no-optional |
| 78 | + - name: Perform Release |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + PUBLIC_REPO: ${{ secrets.PUBLIC_REPO }} |
| 82 | + run: npx semantic-release |
| 83 | + # TODO(DP): |
| 84 | + # - add secrets to github |
| 85 | + # - publish to public repo? |
0 commit comments