From 9ec3f15e49979d4d7e06934344b2eda370560d02 Mon Sep 17 00:00:00 2001 From: Vincent KULAK Date: Thu, 28 Jan 2021 18:20:08 +0100 Subject: [PATCH] Fix Github Actions CI (#1053) * Update docker-pr-build.yml Add python-is-python3 apt package * Update docker-release-build.yml Add python-is-python3 ( Ubuntu 20.04 ) * Switch to ubuntu-20.04 * Switch to ubuntu-20.04 * Switch to ubuntu-20.04 * Bump actions and Fix codecov ( git depth ) * download-artifact@v2 Fix path * Add Master branch tests workflow --- .github/workflows/docker-dev-build.yml | 15 +-- .github/workflows/docker-master-test.yml | 105 +++++++++++++++++++++ .github/workflows/docker-pr-build.yml | 29 +++--- .github/workflows/docker-release-build.yml | 29 +++--- 4 files changed, 145 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/docker-master-test.yml diff --git a/.github/workflows/docker-dev-build.yml b/.github/workflows/docker-dev-build.yml index 9a4fa65e90..2a44fe8eec 100644 --- a/.github/workflows/docker-dev-build.yml +++ b/.github/workflows/docker-dev-build.yml @@ -15,16 +15,16 @@ on: jobs: build-front: name: Front build - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: ⬇️ Checkout code uses: actions/checkout@v2 - name: 💽 Setup nodejs - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: 12.x + node-version: '12' - name: 📇 Use npm cache uses: c-hive/gha-npm-cache@v1 @@ -40,14 +40,14 @@ jobs: npm run build - name: ↗️ Upload build artifact - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: static path: front/build docker: needs: build-front name: Docker magic ! - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 env: DOCKERHUB_USER: ${{secrets.DOCKERHUB_USER}} DOCKERHUB_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}} @@ -75,9 +75,10 @@ jobs: version: latest - name: ↙️ Download build artifact - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v2 with: name: static + path: static - name: 🔑 Login to DockerHub uses: docker/login-action@v1 @@ -95,4 +96,4 @@ jobs: pull: true tags: ${{ secrets.DOCKERHUB_REPO }}:${{ github.event.inputs.tag }} cache-from: type=registry,ref=${{ secrets.DOCKERHUB_REPO }}:${{ github.event.inputs.tag }} - cache-to: type=inline \ No newline at end of file + cache-to: type=inline diff --git a/.github/workflows/docker-master-test.yml b/.github/workflows/docker-master-test.yml new file mode 100644 index 0000000000..1e304f03e0 --- /dev/null +++ b/.github/workflows/docker-master-test.yml @@ -0,0 +1,105 @@ +name: Master branch tests + +on: + push: + branches: [ master ] + +jobs: + test-front: + name: Front test + runs-on: ubuntu-20.04 + steps: + - + name: ⬇️ Checkout Gladys code + uses: actions/checkout@v2 + - + name: 💽 Setup nodejs + uses: actions/setup-node@v2 + with: + node-version: '12' + - + name: 📇 Use npm cache + uses: c-hive/gha-npm-cache@v1 + - + name: 📦 Install Global NPM Packages + run: | + sudo npm install typescript node-gyp npm@latest -g + - + name: 📦 Install NPM front packages + working-directory: ./front + run: | + npm ci + - + name: 🧐 Prettier check + working-directory: ./front + run: | + npm run prettier-check + - + name: 👕 ESlint + working-directory: ./front + run: | + npm run eslint + - + name: 🌐 Integration comparison + working-directory: ./front + run: | + npm run compare-translations + test-server: + name: Server test + runs-on: ubuntu-20.04 + steps: + - + name: ⬇️ Checkout Gladys code + uses: actions/checkout@v2 + with: + fetch-depth: 2 + - + name: 💽 Setup nodejs + uses: actions/setup-node@v2 + with: + node-version: '12' + - + name: 📇 Use npm cache + uses: c-hive/gha-npm-cache@v1 + - + name: 🖥️ Setup OZW + run: | + docker create -ti --name dummy chrisns/openzwave:ubuntu-1.6.1714 bash + sudo docker cp dummy:/usr/local/include/openzwave /usr/local/include/openzwave + sudo docker cp dummy:/openzwave/libopenzwave.so /usr/local/lib + sudo docker cp dummy:/openzwave/libopenzwave.so.1.6 /usr/local/lib + sudo docker cp dummy:/openzwave/config /usr/local/etc/openzwave + sudo ldconfig + docker rm -f dummy + - + name: 💽 Install System Dependencies + run: | + sudo apt update + sudo apt-get install -y libudev-dev sqlite3 openssl python-is-python3 + - + name: 📦 Install Global NPM Packages + run: | + sudo npm install typescript node-gyp npm@latest -g + - + name: 📦 Install NPM server packages + working-directory: ./server + run: | + npm ci + - + name: 🧐 Prettier check + working-directory: ./server + run: | + npm run prettier-check + - + name: 👕 ESlint + working-directory: ./server + run: | + npm run eslint + - + name: ✅ Test with coverage + working-directory: ./server + run: | + npm run coverage + - + name: 📄 Codecov report upload + uses: codecov/codecov-action@v1 diff --git a/.github/workflows/docker-pr-build.yml b/.github/workflows/docker-pr-build.yml index 413bf054f5..e098b1904f 100644 --- a/.github/workflows/docker-pr-build.yml +++ b/.github/workflows/docker-pr-build.yml @@ -8,16 +8,16 @@ on: jobs: test-front: name: Front test - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: ⬇️ Checkout Gladys code uses: actions/checkout@v2 - name: 💽 Setup nodejs - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: 12.x + node-version: '12' - name: 📇 Use npm cache uses: c-hive/gha-npm-cache@v1 @@ -47,16 +47,18 @@ jobs: npm run compare-translations test-server: name: Server test - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: ⬇️ Checkout Gladys code uses: actions/checkout@v2 + with: + fetch-depth: 2 - name: 💽 Setup nodejs - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: 12.x + node-version: '12' - name: 📇 Use npm cache uses: c-hive/gha-npm-cache@v1 @@ -74,7 +76,7 @@ jobs: name: 💽 Install System Dependencies run: | sudo apt update - sudo apt-get install -y libudev-dev sqlite3 openssl + sudo apt-get install -y libudev-dev sqlite3 openssl python-is-python3 - name: 📦 Install Global NPM Packages run: | @@ -108,16 +110,16 @@ jobs: needs: - test-front - test-server - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: ⬇️ Checkout code uses: actions/checkout@v2 - name: 💽 Setup nodejs - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: 12.x + node-version: '12' - name: 📇 Use npm cache uses: c-hive/gha-npm-cache@v1 @@ -133,7 +135,7 @@ jobs: npm run build - name: ↗️ Upload build artifact - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: static path: front/build @@ -141,7 +143,7 @@ jobs: if: github.event.pull_request.draft == false needs: build-front name: Docker magic ! - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: ⬇️ Checkout code @@ -157,9 +159,10 @@ jobs: version: latest - name: ↙️ Download build artifact - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v2 with: name: static + path: static - name: 🐳 Build AMD64 images uses: docker/build-push-action@v2 diff --git a/.github/workflows/docker-release-build.yml b/.github/workflows/docker-release-build.yml index fa9871d550..b1d80ce2fa 100644 --- a/.github/workflows/docker-release-build.yml +++ b/.github/workflows/docker-release-build.yml @@ -8,16 +8,16 @@ on: jobs: test-front: name: Front test - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: ⬇️ Checkout Gladys code uses: actions/checkout@v2 - name: 💽 Setup nodejs - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: 12.x + node-version: '12' - name: 📇 Use npm cache uses: c-hive/gha-npm-cache@v1 @@ -47,16 +47,18 @@ jobs: npm run compare-translations test-server: name: Server test - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: ⬇️ Checkout Gladys code uses: actions/checkout@v2 + with: + fetch-depth: 2 - name: 💽 Setup nodejs - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: 12.x + node-version: '12' - name: 📇 Use npm cache uses: c-hive/gha-npm-cache@v1 @@ -74,7 +76,7 @@ jobs: name: 💽 Install System Dependencies run: | sudo apt update - sudo apt-get install -y libudev-dev sqlite3 openssl + sudo apt-get install -y libudev-dev sqlite3 openssl python-is-python3 - name: 📦 Install Global NPM Packages run: | @@ -107,16 +109,16 @@ jobs: needs: - test-front - test-server - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: ⬇️ Checkout code uses: actions/checkout@v2 - name: 💽 Setup nodejs - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: 12.x + node-version: '12' - name: 📇 Use npm cache uses: c-hive/gha-npm-cache@v1 @@ -132,14 +134,14 @@ jobs: npm run build - name: ↗️ Upload build artifact - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: static path: front/build docker: needs: build-front name: Docker magic ! - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 env: DOCKERHUB_USER: ${{secrets.DOCKERHUB_USER}} DOCKERHUB_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}} @@ -171,9 +173,10 @@ jobs: version: latest - name: ↙️ Download build artifact - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v2 with: name: static + path: static - name: 🔑 Login to DockerHub uses: docker/login-action@v1