Provide a functional Docker example #72
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
strategy: | |
# Allow other matrix jobs to continue after one fails, allowing us to | |
# isolate platform-specific issues. | |
fail-fast: false | |
matrix: | |
drawio-version: [23.1.5] | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
python: ["3.8", "3.12"] | |
include: | |
- os: ubuntu-latest | |
drawio-version: 23.1.5 | |
drawio-arch: amd64 | |
drawio-sha256sum: 29a4a2acacd1388bcd23692b151f34422a94966099cab31ae57ef69a1c01d3a6 | |
- os: windows-latest | |
drawio-version: 23.1.5 | |
drawio-sha256sum: 2f9877e47bdcb7fbb0a37bc7338b057109652c33df7d5fa63a3f57e5e49bef77 | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install Draw.io Desktop (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
set -euo pipefail | |
drawio_deb="drawio-${{ matrix.drawio-arch }}-${{ matrix.drawio-version }}.deb" | |
drawio_url="https://github.com/jgraph/drawio-desktop/releases/download/v${{ matrix.drawio-version }}/drawio-${{ matrix.drawio-arch }}-${{ matrix.drawio-version }}.deb" | |
curl -L -o "$drawio_deb" "$drawio_url" | |
sha256sum --check <<<"${{ matrix.drawio-sha256sum }} $drawio_deb" | |
sudo apt-get install -y libasound2 xvfb ./"$drawio_deb" | |
- name: Install Draw.io Desktop (macOS) | |
if: runner.os == 'macOS' | |
run: brew install drawio | |
- name: Install Draw.io Desktop (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Set-StrictMode -Version Latest | |
$ErrorActionPreference = "Stop" | |
$drawioUrl = "https://github.com/jgraph/drawio-desktop/releases/download/v${{ matrix.drawio-version }}/draw.io-${{ matrix.drawio-version }}-windows-installer.exe" | |
$drawioExe = "draw.io-${{ matrix.drawio-version }}-windows-installer.exe" | |
$expectedChecksum = "${{ matrix.drawio-sha256sum }}".ToUpper() | |
$client = New-Object System.Net.WebClient | |
$client.DownloadFile($drawioUrl, $drawioExe) | |
$checksum = (Get-FileHash -Path $drawioExe -Algorithm SHA256).Hash | |
if ($checksum -ne $expectedChecksum) { | |
Write-Error "Expected and actual checksums didn't match" | |
exit 1 | |
} | |
$proc = Start-Process "./${drawioExe}" "/S", "/allusers" | |
$proc | Wait-Process | |
# Counterintuitively, we need to install Poetry before Python, because we source the Python | |
# version from pyproject.toml. The runner's default version of Python should be okay here. | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
cache: poetry | |
python-version: "${{ matrix.python }}" | |
- name: Run tests | |
run: | | |
poetry install | |
poetry run test |