|
| 1 | +name: CI |
| 2 | + |
| 3 | +# This will run when: |
| 4 | +# - a new release is created, and will attach the generated |
| 5 | +# artifacts to the release |
| 6 | +# - when new code is pushed to master/develop to make sure the |
| 7 | +# code does compile. |
| 8 | +# - when a pull request is created and updated to make sure the |
| 9 | +# code does compile. |
| 10 | +on: |
| 11 | + release: |
| 12 | + types: created |
| 13 | + |
| 14 | + push: |
| 15 | + branches: |
| 16 | + - master |
| 17 | + - develop |
| 18 | + |
| 19 | + pull_request: |
| 20 | + |
| 21 | +# The jobs are chained, the first thing that is run is the code to |
| 22 | +# update all the dependencies (which are cached). The cache is |
| 23 | +# linked to the project/Build.scala file, if this changes the cache |
| 24 | +# is invalidated. |
| 25 | +# Once build is done it will start the test, dist and documentation |
| 26 | +# phases (which are executed in parallel). |
| 27 | +jobs: |
| 28 | + |
| 29 | + # downloads all the dependencies and compiles the scala code |
| 30 | + build: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v2 |
| 34 | + - uses: actions/setup-java@v1 |
| 35 | + with: |
| 36 | + java-version: 1.8 |
| 37 | + - name: Cache SBT ivy cache |
| 38 | + uses: actions/cache@v1 |
| 39 | + with: |
| 40 | + path: ~/.ivy2/cache |
| 41 | + key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('project/Build.scala') }} |
| 42 | + - name: Cache SBT |
| 43 | + uses: actions/cache@v1 |
| 44 | + with: |
| 45 | + path: ~/.sbt |
| 46 | + key: ${{ runner.os }}-sbt-${{ hashFiles('project/Build.scala') }} |
| 47 | + - name: sbt clean update |
| 48 | + run: ./sbt clean update |
| 49 | + - name: sbt compile |
| 50 | + run: ./sbt compile |
| 51 | + |
| 52 | + # starts a mongodb instance, and runs the scala tests |
| 53 | + test: |
| 54 | + runs-on: ubuntu-latest |
| 55 | + needs: build |
| 56 | + services: |
| 57 | + mongodb: |
| 58 | + image: mongo:3.6 |
| 59 | + ports: |
| 60 | + - 27017:27017 |
| 61 | + steps: |
| 62 | + - uses: actions/setup-java@v1 |
| 63 | + with: |
| 64 | + java-version: 1.8 |
| 65 | + - uses: actions/checkout@v2 |
| 66 | + - uses: actions/setup-java@v1 |
| 67 | + with: |
| 68 | + java-version: 1.8 |
| 69 | + - name: Cache SBT ivy cache |
| 70 | + uses: actions/cache@v1 |
| 71 | + with: |
| 72 | + path: ~/.ivy2/cache |
| 73 | + key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('project/Build.scala') }} |
| 74 | + - name: Cache SBT |
| 75 | + uses: actions/cache@v1 |
| 76 | + with: |
| 77 | + path: ~/.sbt |
| 78 | + key: ${{ runner.os }}-sbt-${{ hashFiles('project/Build.scala') }} |
| 79 | + - name: sbt test |
| 80 | + run: ./sbt "test-only integration.APITestSuite" |
| 81 | + |
| 82 | + # creates zip file of the dist compiled version. The results are |
| 83 | + # uploaded as artifacts for this build as well to the release if |
| 84 | + # created. |
| 85 | + dist: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + needs: build |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v2 |
| 90 | + - uses: actions/setup-java@v1 |
| 91 | + with: |
| 92 | + java-version: 1.8 |
| 93 | + - name: Cache SBT ivy cache |
| 94 | + uses: actions/cache@v1 |
| 95 | + with: |
| 96 | + path: ~/.ivy2/cache |
| 97 | + key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('project/Build.scala') }} |
| 98 | + - name: Cache SBT |
| 99 | + uses: actions/cache@v1 |
| 100 | + with: |
| 101 | + path: ~/.sbt |
| 102 | + key: ${{ runner.os }}-sbt-${{ hashFiles('project/Build.scala') }} |
| 103 | + - name: sbt dist |
| 104 | + run: ./sbt dist |
| 105 | + - uses: actions/upload-artifact@v2 |
| 106 | + with: |
| 107 | + name: clowder.zip |
| 108 | + path: target/universal/clowder-*.zip |
| 109 | + - name: Upload files to a GitHub release |
| 110 | + |
| 111 | + if: github.event_name == 'release' && github.event.action == 'created' |
| 112 | + with: |
| 113 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 114 | + tag: ${{ github.ref }} |
| 115 | + overwrite: true |
| 116 | + asset_name: clowder.zip |
| 117 | + file: target/universal/clowder-*.zip |
| 118 | + file_glob: true |
| 119 | + |
| 120 | + # creates scaladoc, html and epub (no pdflatex) and uploads those |
| 121 | + # as artifacts for this build as well to the release if created. |
| 122 | + documentation: |
| 123 | + runs-on: ubuntu-latest |
| 124 | + needs: build |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@v2 |
| 127 | + - uses: actions/setup-java@v1 |
| 128 | + with: |
| 129 | + java-version: 1.8 |
| 130 | + - name: Cache SBT ivy cache |
| 131 | + uses: actions/cache@v1 |
| 132 | + with: |
| 133 | + path: ~/.ivy2/cache |
| 134 | + key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('project/Build.scala') }} |
| 135 | + - name: Cache SBT |
| 136 | + uses: actions/cache@v1 |
| 137 | + with: |
| 138 | + path: ~/.sbt |
| 139 | + key: ${{ runner.os }}-sbt-${{ hashFiles('project/Build.scala') }} |
| 140 | + - name: Set up Python 3.7 |
| 141 | + uses: actions/setup-python@v1 |
| 142 | + with: |
| 143 | + python-version: 3.7 |
| 144 | + - name: sbt doc |
| 145 | + run: ./sbt doc |
| 146 | + - uses: actions/upload-artifact@v2 |
| 147 | + with: |
| 148 | + name: ScalaDoc |
| 149 | + path: target/scala-*/api/ |
| 150 | + - name: sphinx |
| 151 | + run: | |
| 152 | + cd doc/src/sphinx/ |
| 153 | + python -m pip install -r requirements.txt |
| 154 | + make html epub |
| 155 | + - uses: actions/upload-artifact@v2 |
| 156 | + with: |
| 157 | + name: HTML Documentation |
| 158 | + path: doc/src/sphinx/_build/html |
| 159 | + - uses: actions/upload-artifact@v2 |
| 160 | + with: |
| 161 | + name: EPUB Documentation |
| 162 | + path: doc/src/sphinx/_build/epub/Clowder.epub |
| 163 | + - name: Upload files to a GitHub release |
| 164 | + |
| 165 | + if: github.event_name == 'release' && github.event.action == 'created' |
| 166 | + with: |
| 167 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 168 | + tag: ${{ github.ref }} |
| 169 | + overwrite: true |
| 170 | + asset_name: clowder.epub |
| 171 | + file: doc/src/sphinx/_build/epub/Clowder.epub |
0 commit comments