-
Notifications
You must be signed in to change notification settings - Fork 21
149 lines (140 loc) · 5.79 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: GH Actions
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
jobs:
original-travis-ci-job:
name: Linux ${{ matrix.install_variant }} with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
env:
DISPLAY: ':99.0'
strategy:
matrix:
python-version: [3.10.8, 3.11, 3.12]
install_variant: ["pip"]
include:
- python-version: 3.12
install_variant: "rpm.fedora.40"
- python-version: 3.12
install_variant: "deb.ubuntu.noble"
fail-fast: false
steps:
- run: echo "Job triggered by a ${{ github.event_name }} event on branch is ${{ github.ref }} in repository is ${{ github.repository }}, runner on ${{ runner.os }}"
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache large ML models
uses: actions/cache@v4
with:
path: ~/.cache/torch/hub/checkpoints
key: fasterrcnn-258fb6c6+maskrcnn-bf2d0c1e
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'packaging/pip_requirements.txt'
if: matrix.install_variant == 'pip'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
if: matrix.install_variant == 'pip'
- name: Refresh system packager mirrors and packages
run: sudo apt-get -y update
- name: Install non-python dependencies using system packager
run: |
# ocr
sudo apt-get -y install pkg-config tesseract-ocr libtesseract-dev
# xdotool
sudo apt-get -y install xdotool x11-apps imagemagick
# vncdotool
sudo apt-get -y install xfonts-base x11vnc
# pyautogui
sudo apt-get -y install gnome-screenshot
if: matrix.install_variant == 'pip'
- name: Install any dependencies and build the package
run: pip --default-timeout=60 install -r packaging/pip_requirements.txt
if: matrix.install_variant == 'pip'
- run: sleep 3
- name: Prepare virtual screen (fake display)
run: |
sudo apt-get -y install libx11-dev libxtst-dev xvfb vim-common
sudo apt-get install -y x11-utils libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
Xvfb :99 -screen 0 1024x768x24 &> /tmp/xvfb.log &
sudo touch ~/.Xauthority
sudo xauth -f ~/.Xauthority add ${HOST}:99 . $(xxd -l 16 -p /dev/urandom)
sudo chmod a+rxw ~/.Xauthority
# give xvfb some time to start
sleep 3
- name: Run current semi-isolation semi-integration tests (to be separated in the future)
run: |
if [[ "${{ matrix.python-version }}" == "3.10.8" ]]; then export DISABLE_AUTOPY=1; fi
if [[ "${{ matrix.python-version }}" == "3.11" ]]; then export DISABLE_AUTOPY=1; fi
if [[ "${{ matrix.python-version }}" == "3.12" ]]; then export DISABLE_AUTOPY=1; fi
if [[ "${{ matrix.install_variant }}" != "pip" ]]; then cd packaging && bash packager_docker.sh;
else cd tests && bash coverage_analysis.sh; fi
env:
INSTALL_VARIANT: ${{ matrix.install_variant }}
TESSDATA_PREFIX: /usr/share/tesseract-ocr/4.00/tessdata/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: tests/coverage.xml
verbose: true
if: matrix.install_variant == 'pip'
- run: echo "🥑 This job's status is ${{ job.status }}."
# Publish release:
- name: Set Release Variables
id: set_vars
run: |
CHANGELOG_REVS=($(sed -n -e 's/^guibot[ \t]*(\([0-9]*.[0-9]*\)-[0-9]*).*/\1/p' "/home/runner/work/guibot/guibot/packaging/debian/changelog"))
VERSION=${CHANGELOG_REVS[0]}
echo "version=$VERSION" >> $GITHUB_ENV
if [[ "${{ matrix.install_variant }}" == "rpm.fedora.40" ]]; then
EXTENSION="rpm"
EXE_NAME="guibot"
else
EXTENSION="deb"
EXE_NAME="python3-guibot"
fi
echo "ext=$EXTENSION" >> $GITHUB_ENV
echo "name=$EXE_NAME" >> $GITHUB_ENV
if: matrix.install_variant != 'pip'
# - name: Create Release and Push Artifacts
# uses: ncipollo/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# name: 'guibot ${{ env.version }}'
# tag: "${{ env.version }}"
# body: 'Auto generated release builds'
# artifacts: '/home/runner/work/guibot/guibot/${{ env.name }}_${{ env.version }}.${{ env.ext }}'
# updateOnlyUnreleased: 'false'
# allowUpdates: 'true'
# prerelease: 'false'
# makeLatest: 'true'
# if: matrix.install_variant != 'pip'
- name: Create the Release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ env.version }}
tag_name: ${{ env.version }}
env:
GITHUB_TOKEN: ${{ github.token }}
if: matrix.install_variant != 'pip'
- name: Upload Artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: '/home/runner/work/guibot/guibot/${{ env.name }}_${{ env.version }}.${{ env.ext }}'
asset_name: '${{ env.name }}_${{ env.version }}.${{ env.ext }}'
asset_content_type: ''
if: matrix.install_variant != 'pip'