forked from wireviz/WireViz
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (83 loc) · 2.91 KB
/
native-image-on-demand.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
name: Native Images On-Demand
run-name: Native Images ${{ inputs.tag }} by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
tag:
description: Tag name
required: true
jobs:
native_images:
strategy:
matrix:
os: [ ubuntu-latest ]
include:
- os: 'ubuntu-latest'
platform: 'linux-amd64'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
ref: "refs/tags/${{ github.event.inputs.tag }}"
- name: Set up Python 3.11
# actions/setup-python does not work on arm64/linux
# https://github.com/actions/setup-python/issues/678
uses: actions/setup-python@v4
with:
python-version: 3.11
# we can skip this step since Python3 is already installed on the self-hosted runner.
if: ${{ matrix.platform != 'linux-arm64' }}
- name: Install system dependencies
run: |
sudo apt-get install libfreetype6-dev ccache patchelf graphviz
# we can skip this step since system dependencies are already installed on the self-hosted runner.
if: ${{ matrix.platform != 'linux-arm64' }}
- name: Install project dependencies
run: |
pip install -U nuitka
pip install .
- name: Build single binary image
run: |
python3 -m nuitka \
--include-module=wireviz \
--onefile wireviz_kroki.py \
--output-filename=wireviz-${PLATFORM}.bin
env:
PLATFORM: ${{ matrix.platform }}
- name: Smoke test
run: |
cat examples/demo01.yml | ./wireviz-${PLATFORM}.bin -f svg - -o -
env:
PLATFORM: ${{ matrix.platform }}
- name: Cache native image
uses: actions/cache/save@v3
with:
path: "wireviz-${{ matrix.platform }}.bin"
key: "native-image-${{ matrix.platform }}-${{ github.run_id }}"
enableCrossOsArchive: true
upload:
needs: [ native_images ]
runs-on: ubuntu-latest
steps:
- name: Set release version
env:
REF: ${{ github.event.inputs.tag }}
run: |
echo "release_version=${REF#v}" >> $GITHUB_ENV
echo "release_version=${REF#v}" >> $GITHUB_OUTPUT
- name: Checkout the repository
uses: actions/checkout@v3
- name: Restore Native-image-linux-amd64 cache
uses: actions/cache/restore@v3
with:
path: "wireviz-linux-amd64.bin"
key: "native-image-linux-amd64-${{ github.run_id }}"
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Create release
run: |
gh release view "v$RELEASE_VERSION" || gh release create "v$RELEASE_VERSION"
gh release upload "v$RELEASE_VERSION" ./wireviz-linux-amd64.bin --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_VERSION: ${{ env.release_version }}