100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Create ci_cd.yml
Rich Turnerdb24a08676c5
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlnew file mode 100644index 000000000..d78a136dc--- /dev/null+++ b/.github/workflows/ci_cd.yml@@ -0,0 +1,180 @@+# Build, test and conditionally publish the manager docker image using the included gradle wrapper++name: CI/CD+concurrency: ci++on:+ push:+ paths-ignore:+ - '.github/**'++env:+ PLATFORM: linux/amd64,linux/aarch64++jobs:+++ build:+ runs-on: ubuntu-latest++ steps:+ - uses: actions/checkout@v2++ - name: Set up JDK 17+ uses: actions/setup-java@v1+ with:+ java-version: 17++ - name: Grant execute permission for gradlew+ run: chmod +x gradlew++ - name: Extract docker image IDs+ run: |+ echo ::set-env name=POSTGRES_ID::$(docker-compose -f profile\dev-testing.yml images -q -- postgresql)+ echo ::set-env name=KEYCLOAK_ID::$(docker-compose -f profile\dev-testing.yml images -q -- keycloak)++ - name: Gradle cache+ id: gradle-cache+ uses: actions/cache@v2+ with:+ path: |+ ~/.gradle/caches+ ~/.gradle/wrapper+ key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}+ restore-keys: |+ ${{ runner.os }}-gradle-++ - name: Get yarn cache directory path+ id: yarn-cache-dir-path+ run: echo "::set-output name=dir::$(yarn config get cacheFolder)"++ - name: Yarn cache+ uses: actions/cache@v2+ id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)+ with:+ path: ${{ steps.yarn-cache-dir-path.outputs.dir }}+ key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}+ restore-keys: |+ ${{ runner.os }}-yarn-++ - name: Docker postgres image cache+ uses: actions/cache@v2+ id: docker-postgres-cache+ with:+ path: |+ postgres.tar.gz+ key: ${{ runner.os }}-postgres-image--${{ env.POSTGRES_ID }}+ restore-keys: |+ ${{ runner.os }}-postgres-image--${{ env.POSTGRES_ID }}++ - name: Docker keycloak image cache+ uses: actions/cache@v2+ id: docker-keycloak-cache+ with:+ path: |+ keycloak.tar.gz+ key: ${{ runner.os }}-keycloak-image--${{ env.KEYCLOAK_ID }}+ restore-keys: |+ ${{ runner.os }}-keycloak-image--${{ env.KEYCLOAK_ID }}++ - name: Output info+ run: |+ echo "************************************************************"+ echo "************** BUILD INFO *******************"+ echo "************************************************************"+ echo "Yarn version: ${yarn -v}"+ echo "dev-testing.yml images: ${docker-compose -f profile/dev-testing.yml images}"+ echo "Gradle cache: ${{ steps.gradle-cache.outputs.cache-hit }}"+ echo "Yarn cache: ${{ steps.yarn-cache.outputs.cache-hit }}"+ echo "Docker postgres from cache: ${{ steps.docker-keycloak-cache.outputs.cache-hit }}"+ echo "Docker keycloak from cache: ${{ steps.docker-keycloak-cache.outputs.cache-hit }}"+ echo "************************************************************"+ echo "************************************************************"++# - name: Build+# run: ./gradlew installDist++# - name: Test+# run: ./gradlew test++# - name: Share build artifacts+# uses: actions/upload-artifact@v2+# with:+# name: build-output+# path: |+# manager/build+# deployment/build+# retention-days: 1++++ test_ui:+ runs-on: ubuntu-latest+ needs: [image_manager]+ steps:+ - uses: actions/setup-python@v2+ with:+ python-version: 3.8+ - name: install openremote-cli+ run: |+ pip3 install openremote-cli+ openremote-cli -V -t+ - name: deploy openremote stack on localhost and run UI test+ run: |+ wget -nc https://raw.githubusercontent.com/openremote/openremote/master/docker-compose.yml+ docker-compose up -d+ sleep 60+ docker ps+ # Login to manager and add weather agent asset+ or-test-http-rest --dnsname localhost --password secret -vv+ timeout-minutes: 30+ continue-on-error: true+++ test_staging_demo:+ runs-on: ubuntu-latest+ needs: [image_manager]+ steps:+ - uses: actions/setup-python@v2+ with:+ python-version: 3.9+ - name: install openremote-cli+ run: |+ pip3 install openremote-cli+ openremote-cli -V -t+ - name: wait 10m for staging.demo new image update+ run: sleep 600+ - name: login staging.demo.openremote.io and wait for map+ run: openremote-cli manager --open -t --quit --quiet -v --dnsname staging.demo.openremote.io --password "${{ secrets.STAGING_DEMO_PASSWORD }}"+ continue-on-error: false++ image_manager:+ runs-on: ubuntu-latest+ needs: [build]++ steps:+ - uses: actions/checkout@v2+ - uses: n1hility/cancel-previous-runs@v2+ with:+ token: ${{ secrets.GITHUB_TOKEN }}+ - name: set up QEMU+ uses: docker/setup-qemu-action@v1+ with:+ platforms: all+ - name: install buildx+ id: buildx+ uses: docker/setup-buildx-action@v1+ with:+ version: latest+ install: true+ - name: available platforms+ run: echo ${{ steps.buildx.outputs.platforms }}+ - name: login to docker hub+ run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USER }}" --password-stdin+ - name: Download build artifacts+ uses: actions/download-artifact@v2+ with:+ name: dist-build+ - name: build and push images+ run: |+ docker build --push --platform $PLATFORM -t openremote/manager:latest manager/build/install/manager