Skip to content

Commit e971bd2

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

2 files changed

Lines changed: 73 additions & 40 deletions

File tree

.github/workflows/build-test.yml

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