From 8dd1667efadb9f475e0e8b5c498052a14187526e Mon Sep 17 00:00:00 2001 From: Romain Lespinasse Date: Tue, 25 Jul 2023 20:20:42 +0200 Subject: [PATCH] feat: update to drawio-desktop-headless 1.13.0 --- .github/workflows/drawio-export.yaml | 53 +++++++++++++++++++------- .github/workflows/linter.yaml | 25 ------------ .github/workflows/publish.yaml | 7 ++++ Dockerfile | 4 +- Makefile | 31 +++++++++------ scripts/runner-no-security-warnings.sh | 4 -- scripts/runner.sh | 16 -------- src/runner.sh | 4 ++ 8 files changed, 72 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/linter.yaml delete mode 100755 scripts/runner-no-security-warnings.sh delete mode 100755 scripts/runner.sh create mode 100755 src/runner.sh diff --git a/.github/workflows/drawio-export.yaml b/.github/workflows/drawio-export.yaml index e25f0f7..a79ecd3 100644 --- a/.github/workflows/drawio-export.yaml +++ b/.github/workflows/drawio-export.yaml @@ -16,35 +16,62 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-node@v3 - - uses: rlespinasse/github-slug-action@v4 - - # Build and test - name: Build docker image run: make build + shell: bash env: DOCKER_IMAGE: ${{ github.repository }}:${{ env.GITHUB_REF_SLUG }} - - - name: Test docker image // Run - id: test-docker-image - run: | - make setup-test - make test + - name: Setup CI for test + run: make test-ci-setup + shell: bash + - name: Test docker image + run: make test-ci + shell: bash env: DOCKER_IMAGE: ${{ github.repository }}:${{ env.GITHUB_REF_SLUG }} - - name: Test docker image // Store output logs uses: actions/upload-artifact@v3 with: name: test-docker-image-logs path: "tests/output/*.log" - if: ${{ failure() }} + if: ${{ always() }} + - name: Test docker image // Store output files + uses: actions/upload-artifact@v3 + with: + name: test-docker-image-files + path: | + tests/data + !tests/data/*.drawio + !tests/data/*/*.drawio + if: ${{ always() }} + + build-multiarch: + runs-on: ubuntu-latest + concurrency: + group: build-multiarch-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v3 + - uses: rlespinasse/github-slug-action@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: "arm64,arm" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build docker image + run: make build-multiarch + shell: bash + env: + DOCKER_IMAGE: ${{ github.repository }}:${{ env.GITHUB_REF_SLUG }} release: runs-on: ubuntu-latest - needs: build + needs: + - build + - build-multiarch concurrency: group: release-${{ github.ref }}-${{ github.event_name }} steps: diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml deleted file mode 100644 index 2b2742e..0000000 --- a/.github/workflows/linter.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Lint - -on: pull_request - -concurrency: - group: lint-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Lint Code Base - uses: github/super-linter@v4 - env: - VALIDATE_ALL_CODEBASE: false - VALIDATE_SHELL_SHFMT: false - DEFAULT_BRANCH: v4.x - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index dc34ac2..5c4757d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -8,6 +8,12 @@ jobs: steps: - uses: actions/checkout@v3 - uses: rlespinasse/github-slug-action@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: "arm64,arm" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 with: @@ -15,3 +21,4 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} tags: "latest,${{ env.GITHUB_REF_SLUG }}" + platforms: linux/amd64,linux/arm64 diff --git a/Dockerfile b/Dockerfile index 30affbb..e5abdde 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,11 @@ FROM rust:buster as drawio-exporter-installer RUN cargo install --version 1.2.0 drawio-exporter -FROM rlespinasse/drawio-desktop-headless:v1.10.0 +FROM rlespinasse/drawio-desktop-headless:v1.13.0 WORKDIR /opt/drawio-exporter COPY --from=drawio-exporter-installer /usr/local/cargo/bin/drawio-exporter . -COPY scripts/* ./ +COPY src/* ./ # disable timeout capabilities since it's a batch ENV DRAWIO_DESKTOP_COMMAND_TIMEOUT 0 diff --git a/Makefile b/Makefile index b08ce86..c89c1f9 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,31 @@ -.PHONY: build run setup-test test cleanup +.PHONY: build build-no-cache build-multiarch cleanup run test test-ci-setup test-ci DOCKER_IMAGE?=rlespinasse/drawio-export:local build: @docker build -t ${DOCKER_IMAGE} . build-no-cache: - @docker build --no-cache -t ${DOCKER_IMAGE} . + @docker build --no-cache --progress plain -t ${DOCKER_IMAGE} . + +build-multiarch: + @docker buildx build --platform linux/amd64,linux/arm64 -t ${DOCKER_IMAGE} . + +cleanup: + @rm -rf tests/output + @find tests -name "export" | xargs -I {} rm -r "{}" + @find tests -name "test-*" | xargs -I {} rm -r "{}" RUN_ARGS?= +DOCKER_OPTIONS?= run: - @docker run -it -v $(PWD):/data ${DOCKER_IMAGE} ${RUN_ARGS} + @docker run -t $(DOCKER_OPTIONS) -w /data -v $(PWD):/data ${DOCKER_IMAGE} ${RUN_ARGS} -setup-test: - @npm install -g bats +test: cleanup build test-ci -test: cleanup build - @mkdir -p tests/output - @DOCKER_IMAGE=$(DOCKER_IMAGE) bats -r tests +test-ci-setup: + @npm install bats + @sudo apt-get install -y libxml2-utils -cleanup: - @find tests -name "export" | xargs -I {} rm -r "{}" - @find tests -name "test-*" | xargs -I {} rm -r "{}" - @rm -rf tests/output +test-ci: + @mkdir -p tests/output + @DOCKER_IMAGE=$(DOCKER_IMAGE) npx bats -r tests diff --git a/scripts/runner-no-security-warnings.sh b/scripts/runner-no-security-warnings.sh deleted file mode 100755 index d837cc0..0000000 --- a/scripts/runner-no-security-warnings.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -e - -"$DRAWIO_DESKTOP_EXECUTABLE_PATH" --drawio-desktop-headless "$@" 2>&1 diff --git a/scripts/runner.sh b/scripts/runner.sh deleted file mode 100755 index 447d39a..0000000 --- a/scripts/runner.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -if [ "${ELECTRON_DISABLE_SECURITY_WARNINGS}" == "true" ]; then - "$DRAWIO_DESKTOP_EXECUTABLE_PATH" --drawio-desktop-headless "$@" 2>&1 | - grep -v "Failed to connect to socket" | - grep -v "Could not parse server address" | - grep -v "Floss manager not present" | - grep -v "Exiting GPU process" | - grep -v "called with multiple threads" | - grep -v "extension not supported" | - grep -v "Failed to send GpuControl.CreateCommandBuffer" | - grep -v "Init observer found at shutdown" -else - "$DRAWIO_DESKTOP_EXECUTABLE_PATH" --drawio-desktop-headless "$@" 2>&1 -fi diff --git a/src/runner.sh b/src/runner.sh new file mode 100755 index 0000000..7ba1ce3 --- /dev/null +++ b/src/runner.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail + +"${DRAWIO_DESKTOP_EXECUTABLE_PATH:?}" --drawio-desktop-headless "$@"