Skip to content

#56 #55 - onqname fix, refactor, prep M7 ~cut-release #50

#56 #55 - onqname fix, refactor, prep M7 ~cut-release

#56 #55 - onqname fix, refactor, prep M7 ~cut-release #50

Workflow file for this run

# Full build setup off main, with ~docsOnly commit filter to run just mvn_site then docs.
name: Default CI
on:
push:
branches: [ "main", "temp/*", "release/*", "master"]
pull_request:
branches: [ "main", "temp/*", "release/*", "master" ]
env:
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
# -Dmaven.repo.local=.m2/repository not needed on github, seems ~/.m2 is supported / expected
MAVEN_OPTS: "-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
jobs:
# all versions that can be built with tests. Fail fast so we can see all compilation or test errors at once
testBuilds:
strategy:
fail-fast: false
matrix:
profile: [Scala_2_11, Scala_2_12, Scala_2_13]
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '~docsOnly') != true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3.12.0
with:
java-version: '8'
distribution: 'temurin'
cache: maven #this caches ~/.m2/repo
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: OSSRH_USERNAME # env variable for username in deploy
server-password: OSSRH_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Build ${{ matrix.profile }} with tests
run: |
mvn $MAVEN_CLI_OPTS clean test install -P ${{ matrix.profile }}
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: target
uses: actions/upload-artifact@v4
with:
name: target-${{ matrix.profile }}
path: target
# Scala_2_12 used as scaladocs fail on 2.13 without any context as to why, which is nice
mvn_site:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: s-weigand/setup-conda@v1
with:
python-version: '3.10'
- uses: actions/setup-java@v3.12.0
with:
java-version: '8'
distribution: 'temurin'
cache: maven #this caches ~/.m2/repo
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: OSSRH_USERNAME # env variable for username in deploy
server-password: OSSRH_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Building site against Scala_2_12
run: |
conda install libgomp=11.2.0 # force the right libs
conda install graphviz=2.50.0 # conda is from fatty
echo '#!/bin/bash' > dott
echo 'dot "$@" 2> >(grep -v "pango" | grep -v "Warning" >&2 )' >> dott
chmod u+x dott
mvn $MAVEN_CLI_OPTS site -P Scala_2_12
echo $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -P Scala_2_12) > target/version.txt
grep -A 3 'Statement coverage:' target/site/scoverage/overview.html | tail -1 | sed 's/[[:space:]]\+//g' > target/coverage.txt
grep -A 3 'Branch coverage:' target/site/scoverage/overview.html | tail -1 | sed 's/[[:space:]]\+//g' >> target/coverage.txt
- id: version
run: echo version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -P Scala_2_12) >> "$GITHUB_OUTPUT"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
- name: target
uses: actions/upload-artifact@v4
with:
name: target-mvn_site
path: |
target/site
scales-xml/target/site
aalto/target/site
jaxen/target/site
saxon-tests/target/site
target/coverage.txt
target/version.txt
outputs:
version: ${{ steps.version.outputs.version }}
# only publish snapshots on main by default, or when ~cut-release is in the commits
publish:
strategy:
matrix:
profile: [Scala_2_11, Scala_2_12, Scala_2_13]
needs: [testBuilds, mvn_site] # if the builds don't work don't attempt to publish
# needs always per https://github.com/actions/runner/issues/491 very annoying
# only do snapshots on main by default, releases/snapshots forced with ~cut-release
if: |
always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
(contains(github.event.head_commit.message, '~docsOnly') != true) &&
( (endsWith(needs.site.outputs.version, '-SNAPSHOT') && github.ref == 'refs/heads/main') ||
contains(github.event.head_commit.message, '~cut-release') )
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3.12.0
with:
java-version: '8'
distribution: 'temurin'
cache: maven #this caches ~/.m2/repo
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: OSSRH_USERNAME # env variable for username in deploy
server-password: OSSRH_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Publishing ${{ matrix.profile }}
run: |
mvn $MAVEN_CLI_OPTS -DskipTests -Dclassifiers=tests clean deploy -P ${{ matrix.profile }}
mvn $MAVEN_CLI_TESTSHADES_OPTS clean deploy -P ${{ matrix.profile }}
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
site:
needs: [mvn_site]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v4
with:
name: target-mvn_site
path: target
- uses: ./.github/workflows/mkdocs #sparkutils/quality/.github/workflows/mkdocs/action.yml@e8cd720ee2cb495a6a020363441a81da3bb70b23
with:
prepScript: |
cp -rf target/target/site docs/
cp -rf target/scales-xml/target/site docs/site/scales-xml_2.12
cp -rf target/aalto/target/site docs/site/scales-xml-aalto_2.12
cp -rf target/jaxen/target/site docs/site/scales-xml-jaxen_2.12
cp -rf target/saxon-tests/target/site docs/site/scales-xml-saxon-tests_2.12
cp target/target/coverage.txt docs/
cp target/target/version.txt .
cp target/target/coverage.txt .