|
| 1 | +# For most projects, this workflow file will not need changing; you simply need |
| 2 | +# to commit it to your repository. |
| 3 | +# |
| 4 | +# You may wish to alter this file to override the set of languages analyzed, |
| 5 | +# or to provide custom queries or build logic. |
| 6 | +# |
| 7 | +name: "GHA-04: Maven NIT" |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [ "master" ] |
| 12 | + pull_request: |
| 13 | + # The branches below must be a subset of the branches above |
| 14 | + branches: [ "master" ] |
| 15 | + schedule: |
| 16 | + - cron: '22 12 * * 0' |
| 17 | + workflow_dispatch: |
| 18 | + # Allow manually running the action, e.g. if disabled after some quietness in the source |
| 19 | + |
| 20 | +jobs: |
| 21 | + maven-NIT: |
| 22 | + name: "Compile the project, test against NUT data server" |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + permissions: |
| 25 | + actions: read |
| 26 | + contents: read |
| 27 | + security-events: write |
| 28 | + |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + compilerpkg: [ 'openjdk-21-jdk' ] |
| 33 | + # TOTHINK: various JDK versions? |
| 34 | + os: [ 'ubuntu-latest' ] |
| 35 | + # TOTHINK: windows-latest, macos-latest? |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout repository |
| 39 | + uses: actions/checkout@v3 |
| 40 | + |
| 41 | + # Using hints from https://askubuntu.com/questions/272248/processing-triggers-for-man-db |
| 42 | + - if: matrix.os == 'ubuntu-latest' |
| 43 | + name: NUT CI Prerequisite packages (Ubuntu) |
| 44 | + run: | |
| 45 | + echo "set man-db/auto-update false" | sudo debconf-communicate |
| 46 | + sudo dpkg-reconfigure man-db |
| 47 | + sudo apt update |
| 48 | + sudo apt install ${{ matrix.compilerpkg }} maven nut |
| 49 | + date > .timestamp-init |
| 50 | +
|
| 51 | + - name: Prepare maven cache |
| 52 | + # Based on https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#example-using-the-cache-action example |
| 53 | + id: cache-m2cache |
| 54 | + uses: actions/cache@v4 |
| 55 | + env: |
| 56 | + cache-name: cache-m2cache- |
| 57 | + with: |
| 58 | + path: | |
| 59 | + ~/.m2 |
| 60 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/.timestamp-init') }} |
| 61 | + restore-keys: | |
| 62 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 63 | + ${{ runner.os }}-build- |
| 64 | + ${{ runner.os }}- |
| 65 | +
|
| 66 | + # ℹ️ Command-line programs to run using the OS shell. |
| 67 | + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 68 | + |
| 69 | + - name: Maven build and test |
| 70 | + run: mvn package |
| 71 | + |
| 72 | + # TODO: Setup NUT, run client (add in-tree script for that and call it) |
0 commit comments