Skip to content

Commit 752f60d

Browse files
committed
Update Github Action to use latest ubuntu
1 parent 6c3cf15 commit 752f60d

File tree

1 file changed

+57
-14
lines changed

1 file changed

+57
-14
lines changed

.github/workflows/build-and-test.yml

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,72 @@ env:
66
PLONE_VERSION: "5.2"
77
jobs:
88
build-and-test:
9-
runs-on: 'ubuntu-20.04'
10-
container:
11-
image: python:2.7.18-buster
9+
runs-on: ubuntu-latest
1210
steps:
13-
- uses: actions/checkout@v3
14-
- name: cache eggs
15-
uses: actions/cache@v3
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Cache pyenv Python builds
15+
uses: actions/cache@v4
16+
with:
17+
path: ~/.pyenv
18+
key: pyenv-2.7.18-${{ runner.os }}
19+
restore-keys: |
20+
pyenv-2.7.18-
21+
22+
- name: Install dependencies
23+
run: |
24+
sudo apt update
25+
sudo apt install -y make build-essential libssl-dev \
26+
zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
27+
wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev \
28+
libxmlsec1-dev libffi-dev liblzma-dev
29+
30+
- name: Install pyenv
31+
run: |
32+
if [ ! -d "$HOME/.pyenv" ]; then
33+
curl https://pyenv.run | bash
34+
fi
35+
36+
- name: Install Python 2.7 with pyenv (if not cached)
37+
run: |
38+
export PYENV_ROOT="$HOME/.pyenv"
39+
export PATH="$PYENV_ROOT/bin:$PATH"
40+
eval "$(pyenv init --path)"
41+
pyenv install 2.7.18 || true # Avoid reinstalling if already cached
42+
pyenv global 2.7.18
43+
44+
- name: Verify Python Version
45+
run: |
46+
export PYENV_ROOT="$HOME/.pyenv"
47+
export PATH="$PYENV_ROOT/bin:$PATH"
48+
eval "$(pyenv init --path)"
49+
python --version # Should output Python 2.7.18
50+
51+
- name: Cache eggs
52+
uses: actions/cache@v4
1653
with:
1754
key: eggs-cache-${{ hashFiles('buildout.cfg', 'requirements.txt') }}
1855
path: |
1956
eggs/
20-
- name: install
57+
58+
- name: Install dependencies and setup virtualenv
2159
run: |
60+
export PYENV_ROOT="$HOME/.pyenv"
61+
export PATH="$PYENV_ROOT/bin:$PATH"
62+
eval "$(pyenv init --path)"
2263
pip install virtualenv
2364
virtualenv -p `which python` .
24-
bin/pip install --upgrade pip
25-
bin/pip install -r requirements.txt
26-
bin/buildout -N -t 3 annotate
27-
bin/buildout -N -t 3
65+
./bin/pip install --upgrade pip
66+
./bin/pip install -r requirements.txt
67+
./bin/buildout -N -t 3 annotate
68+
./bin/buildout -N -t 3
69+
2870
- name: lint
2971
run: |
30-
bin/pip install flake8
31-
bin/flake8 --config ci_flake8.cfg src/senaite/
72+
./bin/pip install flake8
73+
./bin/flake8 --config ci_flake8.cfg src/senaite/
74+
3275
- name: test
3376
run: |
34-
bin/test -s senaite.ast.tests
77+
./bin/test -s senaite.ast.tests

0 commit comments

Comments
 (0)