Skip to content

Commit 8ca670f

Browse files
committed
github: workflows: Organize and make build&test better
1 parent f3d0a5e commit 8ca670f

File tree

2 files changed

+70
-40
lines changed

2 files changed

+70
-40
lines changed

.github/workflows/build-test.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build & Test
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
prepare-env:
14+
name: Prepare Python Virtualenv
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up and install dependencies
19+
run: |
20+
python -m venv .venv
21+
. .venv/bin/activate
22+
pip install --upgrade pip
23+
pip install flake8 pytest
24+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
25+
- name: Archive virtualenv
26+
run: tar czf venv.tar.gz .venv
27+
- name: Upload virtualenv artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: python-venv
31+
path: venv.tar.gz
32+
33+
lint:
34+
name: Lint with flake8
35+
runs-on: ubuntu-latest
36+
needs: prepare-env
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Download virtualenv artifact
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: python-venv
43+
- name: Extract virtualenv
44+
run: tar xzf venv.tar.gz
45+
- name: Lint code
46+
run: |
47+
. .venv/bin/activate
48+
flake8 . --exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics
49+
flake8 . --exclude .venv --count --max-complexity=10 --max-line-length=127 --statistics
50+
51+
test-matrix:
52+
name: Test on ${{ matrix.arch }}
53+
runs-on: ubuntu-latest
54+
needs: lint
55+
container: shaymargolis/python-mips-gcc
56+
strategy:
57+
matrix:
58+
arch: [mipsbe, mipsle, armle, x86, x86_64]
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Download virtualenv artifact
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: python-venv
65+
- name: Extract virtualenv
66+
run: tar xzf venv.tar.gz
67+
- name: Run tests
68+
run: |
69+
. .venv/bin/activate
70+
pytest --compiler-arch=${{ matrix.arch }}

.github/workflows/python-app.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)