-
Notifications
You must be signed in to change notification settings - Fork 9
91 lines (79 loc) · 3.12 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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: Install dependencies
run: poetry install --with dev
- name: Run tests
run: poetry run test
- name: Lint
run: poetry run ruff --check