|
| 1 | +name: Build Arches project |
| 2 | +run-name: Build Arches project |
| 3 | +on: [push] |
| 4 | +env: |
| 5 | + ARCHES_BASE: ghcr.io/flaxandteal/arches-base-7.5-dev:feature-django-casbin |
| 6 | + ARCHES_PROJECT: manatee |
| 7 | +jobs: |
| 8 | + Build-Arches: |
| 9 | + runs-on: [self-hosted] |
| 10 | + outputs: |
| 11 | + image: ${{ steps.extract_image_name.outputs.image_name }} |
| 12 | + steps: |
| 13 | + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." |
| 14 | + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" |
| 15 | + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." |
| 16 | + - name: Check out repository code |
| 17 | + uses: actions/checkout@v3 |
| 18 | + with: |
| 19 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + submodules: 'true' |
| 21 | + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." |
| 22 | + - run: echo "🖥️ The workflow is now ready to test your code on the runner." |
| 23 | + - name: List files in the repository |
| 24 | + run: | |
| 25 | + ls ${{ github.workspace }} |
| 26 | + - run: echo "🍏 This job's status is ${{ job.status }}." |
| 27 | + - name: Set up Docker Context for Buildx |
| 28 | + id: buildx-context |
| 29 | + run: | |
| 30 | + docker context create builders |
| 31 | + - name: Set up Docker Buildx |
| 32 | + uses: docker/setup-buildx-action@v2 |
| 33 | + with: |
| 34 | + version: latest |
| 35 | + endpoint: builders |
| 36 | + # name: Build docker backend image |
| 37 | + # run: | |
| 38 | + # docker build --build-arg ARCHES_BASE=${{ env.ARCHES_BASE }} --build-arg ARCHES_PROJECT=${{ env.ARCHES_PROJECT }} . -t arches_${{ env.ARCHES_PROJECT }} |
| 39 | + - name: Log in to Github |
| 40 | + uses: docker/login-action@v2 |
| 41 | + with: |
| 42 | + registry: ghcr.io |
| 43 | + username: ${{ github.actor }} |
| 44 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + - name: Extract metadata (tags, labels) for Docker |
| 46 | + id: meta |
| 47 | + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 |
| 48 | + with: |
| 49 | + images: ghcr.io/flaxandteal/arches_${{ env.ARCHES_PROJECT }} |
| 50 | + - name: Build and push Docker image |
| 51 | + id: build |
| 52 | + uses: docker/build-push-action@v5 |
| 53 | + with: |
| 54 | + context: . |
| 55 | + push: true |
| 56 | + file: docker/Dockerfile |
| 57 | + tags: ${{ steps.meta.outputs.tags }}-${{ github.run_id }} |
| 58 | + labels: ${{ steps.meta.outputs.labels }} |
| 59 | + build-args: | |
| 60 | + ARCHES_BASE=${{ env.ARCHES_BASE }} |
| 61 | + ARCHES_PROJECT=${{ env.ARCHES_PROJECT }} |
| 62 | + - name: Extract image name |
| 63 | + id: extract_image_name |
| 64 | + run: | |
| 65 | + name=${{ fromJSON(steps.build.outputs.metadata)['image.name'] }} |
| 66 | + echo "image_name=$name" >> $GITHUB_OUTPUT |
| 67 | + Build-Arches-Static: |
| 68 | + runs-on: [self-hosted] |
| 69 | + needs: [Build-Arches] |
| 70 | + outputs: |
| 71 | + image: ${{ steps.extract_image_name.outputs.image_name }} |
| 72 | + |
| 73 | + steps: |
| 74 | + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." |
| 75 | + - name: Check out repository code |
| 76 | + uses: actions/checkout@v3 |
| 77 | + with: |
| 78 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + submodules: 'true' |
| 80 | + # name: Build docker backend image |
| 81 | + # run: | |
| 82 | + # docker build --build-arg VERSION=feature-ci --build-arg ARCHES_BASE=${{ env.ARCHES_BASE }} --build-arg ARCHES_PROJECT=${{ env.ARCHES_PROJECT }} -f Dockerfile.static . -t arches_${{ env.ARCHES_PROJECT }}_static |
| 83 | + - name: Log in to Github |
| 84 | + uses: docker/login-action@v2 |
| 85 | + with: |
| 86 | + registry: ghcr.io |
| 87 | + username: ${{ github.actor }} |
| 88 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + - name: Set up Docker Context for Buildx |
| 90 | + id: buildx-context |
| 91 | + run: | |
| 92 | + docker context create builders |
| 93 | + - name: Set up Docker Buildx |
| 94 | + uses: docker/setup-buildx-action@v2 |
| 95 | + with: |
| 96 | + version: latest |
| 97 | + endpoint: builders |
| 98 | + buildkitd-flags: '--allow-insecure-entitlement network.host' |
| 99 | + driver-opts: | |
| 100 | + network=host |
| 101 | + - name: Build and push Docker image |
| 102 | + run: docker run --rm --network host willwill/wait-for-it -h localhost -p 8000 -t 0 |
| 103 | + - name: Extract metadata (tags, labels) for Docker |
| 104 | + id: meta |
| 105 | + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 |
| 106 | + with: |
| 107 | + images: ghcr.io/flaxandteal/arches_${{ env.ARCHES_PROJECT }}_static |
| 108 | + - name: Build and push Docker image |
| 109 | + id: buildx |
| 110 | + uses: docker/build-push-action@v2 |
| 111 | + with: |
| 112 | + context: . |
| 113 | + push: true |
| 114 | + file: docker/Dockerfile.static |
| 115 | + network: host |
| 116 | + allow: network.host |
| 117 | + tags: ${{ steps.meta.outputs.tags }}-${{ github.run_id }} |
| 118 | + labels: ${{ steps.meta.outputs.labels }} |
| 119 | + build-args: | |
| 120 | + ARCHES_DYNAMIC_IMAGE=${{ needs['Build-Arches'].outputs.image }} |
| 121 | + ARCHES_ENVIRONMENT=development |
| 122 | + ARCHES_BASE=${{ env.ARCHES_BASE }} |
| 123 | + ARCHES_PROJECT=${{ env.ARCHES_PROJECT }} |
| 124 | + ARCHES_NAMESPACE_FOR_DATA_EXPORT=http://localhost:8000/ |
| 125 | + - name: Extract image name |
| 126 | + id: extract_image_name |
| 127 | + run: | |
| 128 | + name=${{ fromJSON(steps.buildx.outputs.metadata)['image.name'] }} |
| 129 | + echo "image_name=$name" >> $GITHUB_OUTPUT |
| 130 | + services: |
| 131 | + elasticsearch: |
| 132 | + image: elasticsearch:8.4.0 |
| 133 | + ports: |
| 134 | + - "9200:9200" |
| 135 | + - "9300:9300" |
| 136 | + env: |
| 137 | + TZ: "PST" |
| 138 | + discovery.type: "single-node" |
| 139 | + discovery.seed_hosts: "[]" |
| 140 | + xpack.security.enabled: "false" |
| 141 | + ES_JAVA_OPTS: "-Xms400m -Xmx400m" |
| 142 | + options: >- |
| 143 | + --health-cmd "curl -s --fail http://localhost:9200/_cat/health || exit 1" |
| 144 | + --health-interval 10s |
| 145 | + --health-timeout 5s |
| 146 | + --health-retries 10 |
| 147 | + db: |
| 148 | + image: flaxandteal/arches_coral_postgres |
| 149 | + #volumes: |
| 150 | + # - ${{ github.workspace }}/scripts/init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template |
| 151 | + ports: |
| 152 | + - '5432:5432' |
| 153 | + env: |
| 154 | + POSTGRES_USER: postgres |
| 155 | + POSTGRES_PASS: postgres |
| 156 | + POSTGRES_DB: postgres |
| 157 | + POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_topology |
| 158 | + TZ: PST |
| 159 | + options: >- |
| 160 | + --health-cmd "pg_isready -h 127.0.0.1 -U postgres -d postgres" |
| 161 | + --health-interval 10s |
| 162 | + --health-timeout 5s |
| 163 | + --health-retries 20 |
| 164 | +
|
| 165 | + arches: |
| 166 | + image: "${{ needs['Build-Arches'].outputs.image }}" |
| 167 | + env: |
| 168 | + ALLOW_BOOTSTRAP: "True" |
| 169 | + ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" |
| 170 | + ARCHES_ROOT: "/web_root/arches" |
| 171 | + COMPRESS_OFFLINE: "False" |
| 172 | + COMPRESS_ENABLED: "False" |
| 173 | + INSTALL_DEFAULT_GRAPHS: "False" |
| 174 | + INSTALL_DEFAULT_CONCEPTS: "False" |
| 175 | + PGUSERNAME: "postgres" |
| 176 | + PGPASSWORD: "postgres" |
| 177 | + PGDBNAME: "arches" |
| 178 | + PGHOST: "db" |
| 179 | + PGPORT: "5432" |
| 180 | + RABBITMQ_USER: "rabbitmq" |
| 181 | + RABBITMQ_PASS: "rabbitmq" |
| 182 | + CANTALOUPE_HOST: "cantaloupe" |
| 183 | + CANTALOUPE_PORT: "8182" |
| 184 | + COUCHDB_HOST: "couchdb" |
| 185 | + COUCHDB_PORT: "5984" |
| 186 | + COUCHDB_USER: "admin" |
| 187 | + COUCHDB_PASS: "password" |
| 188 | + ESHOST: "elasticsearch" |
| 189 | + ESPORT: "9200" |
| 190 | + CELERY_BROKER_URL: "amqp://rabbitmq" |
| 191 | + DJANGO_MODE: "DEV" |
| 192 | + DJANGO_DEBUG: "True" |
| 193 | + DOMAIN_NAMES: "localhost" |
| 194 | + PYTHONUNBUFFERED: "0" |
| 195 | + STATIC_URL: "/static/" |
| 196 | + STATIC_ROOT: "/static_root" |
| 197 | + WEB_ROOT: "/web_root" |
| 198 | + TZ: "PST" |
| 199 | + ports: |
| 200 | + - '8000:8000' |
| 201 | + options: >- |
| 202 | + --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" |
| 203 | + --health-interval 10s |
| 204 | + --health-timeout 5s |
| 205 | + --health-retries 1000 |
| 206 | + Build-Arches-Final: |
| 207 | + needs: [Build-Arches-Static, Build-Arches] |
| 208 | + runs-on: [self-hosted] |
| 209 | + outputs: |
| 210 | + image: ${{ steps.extract_image_name.outputs.image_name }} |
| 211 | + steps: |
| 212 | + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." |
| 213 | + - name: Check out repository code |
| 214 | + uses: actions/checkout@v3 |
| 215 | + with: |
| 216 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 217 | + submodules: 'true' |
| 218 | + # name: Build docker backend image |
| 219 | + # run: | |
| 220 | + # docker build --build-arg VERSION=feature-ci --build-arg ARCHES_BASE=${{ env.ARCHES_BASE }} --build-arg ARCHES_PROJECT=${{ env.ARCHES_PROJECT }} -f Dockerfile.static . -t arches_${{ env.ARCHES_PROJECT }}_static |
| 221 | + - name: Log in to Github |
| 222 | + uses: docker/login-action@v2 |
| 223 | + with: |
| 224 | + registry: ghcr.io |
| 225 | + username: ${{ github.actor }} |
| 226 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 227 | + - name: Extract metadata (tags, labels) for Docker |
| 228 | + id: meta |
| 229 | + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 |
| 230 | + with: |
| 231 | + images: ghcr.io/flaxandteal/arches_${{ env.ARCHES_PROJECT }}_static_py |
| 232 | + - name: Set up Docker Context for Buildx |
| 233 | + id: buildx-context |
| 234 | + run: | |
| 235 | + docker context create builders |
| 236 | + - name: Set up Docker Buildx |
| 237 | + uses: docker/setup-buildx-action@v2 |
| 238 | + with: |
| 239 | + version: latest |
| 240 | + endpoint: builders |
| 241 | + buildkitd-flags: '--allow-insecure-entitlement network.host' |
| 242 | + driver-opts: | |
| 243 | + network=host |
| 244 | + - name: Build and push Docker image |
| 245 | + id: buildx |
| 246 | + uses: docker/build-push-action@v2 |
| 247 | + with: |
| 248 | + context: . |
| 249 | + push: true |
| 250 | + file: docker/Dockerfile.static-py |
| 251 | + network: host |
| 252 | + allow: network.host |
| 253 | + tags: ${{ steps.meta.outputs.tags }}-${{ github.run_id }} |
| 254 | + labels: ${{ steps.meta.outputs.labels }} |
| 255 | + build-args: | |
| 256 | + VERSION=${{ steps.meta.outputs.tags }}-${{ github.run_id }} |
| 257 | + ARCHES_STATIC_IMAGE=${{ needs['Build-Arches-Static'].outputs.image }} |
| 258 | + ARCHES_DYNAMIC_IMAGE=${{ needs['Build-Arches'].outputs.image }} |
| 259 | + ARCHES_BASE=${{ env.ARCHES_BASE }} |
| 260 | + ARCHES_PROJECT=${{ env.ARCHES_PROJECT }} |
| 261 | + - name: Extract image name |
| 262 | + id: extract_image_name |
| 263 | + run: | |
| 264 | + name=${{ fromJSON(steps.buildx.outputs.metadata)['image.name'] }} |
| 265 | + echo "image_name=$name" >> $GITHUB_OUTPUT |
| 266 | + Test-Arches: |
| 267 | + runs-on: [self-hosted] |
| 268 | + needs: [Build-Arches-Final] |
| 269 | + container: |
| 270 | + image: cypress/included:12.3.0 |
| 271 | + env: |
| 272 | + HOME: "" |
| 273 | + DEBUG: "cypress:*" |
| 274 | + CYPRESS_BASE_URL: http://arches:8000 |
| 275 | + steps: |
| 276 | + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." |
| 277 | + - name: Check out repository code |
| 278 | + uses: actions/checkout@v3 |
| 279 | + with: |
| 280 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 281 | + submodules: 'true' |
| 282 | + - name: Cypress run |
| 283 | + uses: cypress-io/github-action@v4 |
| 284 | + with: |
| 285 | + browser: firefox |
| 286 | + install: false |
| 287 | + wait-on: 'http://arches:8000' |
| 288 | + wait-on-timeout: 6000 |
| 289 | + - uses: actions/upload-artifact@v3 |
| 290 | + if: failure() |
| 291 | + with: |
| 292 | + name: cypress-screenshots |
| 293 | + path: cypress/screenshots |
| 294 | + - uses: actions/upload-artifact@v3 |
| 295 | + if: always() |
| 296 | + with: |
| 297 | + name: cypress-videos |
| 298 | + path: cypress/videos |
| 299 | + services: |
| 300 | + elasticsearch: |
| 301 | + image: elasticsearch:8.4.0 |
| 302 | + ports: |
| 303 | + - "9200:9200" |
| 304 | + - "9300:9300" |
| 305 | + env: |
| 306 | + TZ: "PST" |
| 307 | + discovery.type: "single-node" |
| 308 | + discovery.seed_hosts: "[]" |
| 309 | + xpack.security.enabled: "false" |
| 310 | + ES_JAVA_OPTS: "-Xms400m -Xmx400m" |
| 311 | + options: >- |
| 312 | + --health-cmd "curl -s --fail http://localhost:9200/_cat/health || exit 1" |
| 313 | + --health-interval 10s |
| 314 | + --health-timeout 5s |
| 315 | + --health-retries 10 |
| 316 | +
|
| 317 | + db: |
| 318 | + image: flaxandteal/arches_coral_postgres |
| 319 | + #volumes: |
| 320 | + # - ${{ github.workspace }}/scripts/init-unix.sql:/docker-entrypoint-initdb.d/init.sql # to set up the DB template |
| 321 | + ports: |
| 322 | + - '5432:5432' |
| 323 | + env: |
| 324 | + POSTGRES_USER: postgres |
| 325 | + POSTGRES_PASS: postgres |
| 326 | + POSTGRES_DB: postgres |
| 327 | + POSTGRES_MULTIPLE_EXTENSIONS: postgis,postgis_topology |
| 328 | + TZ: PST |
| 329 | + options: >- |
| 330 | + --health-cmd "pg_isready -h 127.0.0.1 -U postgres -d postgres" |
| 331 | + --health-interval 10s |
| 332 | + --health-timeout 5s |
| 333 | + --health-retries 20 |
| 334 | +
|
| 335 | + arches: |
| 336 | + image: "${{ needs['Build-Arches-Final'].outputs.image }}" |
| 337 | + env: |
| 338 | + ALLOW_BOOTSTRAP: "True" |
| 339 | + ARCHES_PROJECT: "${{ env.ARCHES_PROJECT }}" |
| 340 | + COMPRESS_OFFLINE: "False" |
| 341 | + INSTALL_CORAL_PACKAGE: "True" |
| 342 | + INSTALL_DEFAULT_GRAPHS: "False" |
| 343 | + INSTALL_DEFAULT_CONCEPTS: "False" |
| 344 | + PGUSERNAME: "postgres" |
| 345 | + PGPASSWORD: "postgres" |
| 346 | + PGDBNAME: "arches" |
| 347 | + PGHOST: "db" |
| 348 | + PGPORT: "5432" |
| 349 | + RABBITMQ_USER: "rabbitmq" |
| 350 | + RABBITMQ_PASS: "rabbitmq" |
| 351 | + CANTALOUPE_HOST: "cantaloupe" |
| 352 | + CANTALOUPE_PORT: "8182" |
| 353 | + COUCHDB_HOST: "couchdb" |
| 354 | + COUCHDB_PORT: "5984" |
| 355 | + COUCHDB_USER: "admin" |
| 356 | + COUCHDB_PASS: "password" |
| 357 | + ESHOST: "elasticsearch" |
| 358 | + ESPORT: "9200" |
| 359 | + CELERY_BROKER_URL: "amqp://rabbitmq" |
| 360 | + DJANGO_MODE: "DEV" |
| 361 | + DJANGO_DEBUG: "True" |
| 362 | + DOMAIN_NAMES: "arches" |
| 363 | + PYTHONUNBUFFERED: "0" |
| 364 | + TZ: "PST" |
| 365 | + ports: |
| 366 | + - '8000:8000' |
| 367 | + options: >- |
| 368 | + --health-cmd "curl --fail http://localhost:8000/templates/views/components/language-switcher.htm || exit 1" |
| 369 | + --health-interval 10s |
| 370 | + --health-timeout 5s |
| 371 | + --health-retries 1000 |
0 commit comments