Skip to content

Commit

Permalink
feat: update to drawio-desktop-headless 1.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse authored Jul 25, 2023
1 parent 3a64714 commit 8dd1667
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 72 deletions.
53 changes: 40 additions & 13 deletions .github/workflows/drawio-export.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/linter.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ 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:
name: ${{ github.repository }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ env.GITHUB_REF_SLUG }}"
platforms: linux/amd64,linux/arm64
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 19 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions scripts/runner-no-security-warnings.sh

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/runner.sh

This file was deleted.

4 changes: 4 additions & 0 deletions src/runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail

"${DRAWIO_DESKTOP_EXECUTABLE_PATH:?}" --drawio-desktop-headless "$@"

0 comments on commit 8dd1667

Please sign in to comment.