Skip to content

Commit 9199fcd

Browse files
authored
Merge pull request #1042 from redbeard/update-github-pr-workflow-to-currency
Update ARM (Dockerfile) and PR (build on pull request) GitHub workflows to current versions
2 parents 8bcfcb6 + 2193c0e commit 9199fcd

File tree

5 files changed

+95
-55
lines changed

5 files changed

+95
-55
lines changed

.dockerignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Exclude build artifacts - these should be built inside the container
2+
build/
3+
dist/
4+
*.egg-info/
5+
__pycache__/
6+
*.pyc
7+
*.pyo
8+
*.pyd
9+
10+
# Exclude git metadata
11+
.git/
12+
.gitignore
13+
.gitmodules
14+
15+
# Exclude IDE and editor files
16+
.vscode/
17+
.idea/
18+
*.swp
19+
*.swo
20+
*~
21+
22+
# Exclude macOS files
23+
.DS_Store
24+
25+
# Exclude CI/CD files (optional, uncomment if you want to exclude)
26+
# .github/
27+
# .circleci/
28+
29+
# Exclude documentation build artifacts
30+
docs/_build/
31+

.github/workflows/arm.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,40 @@ on:
44
# run every day of the week at 02:00
55
schedule:
66
- cron: 0 2 * * *
7+
workflow_dispatch:
78

89
jobs:
910
build-arm64-docker:
1011
name: Build for ARM64 on Docker
11-
runs-on: ubuntu-20.04
12-
if: (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')) || github.event_name == 'schedule' # tag or schedule
12+
runs-on: ubuntu-24.04-arm
1313
steps:
14-
- name: Install docker # bug in ubuntu, conflicts with docker.io
14+
- name: Check Docker and Docker Compose versions
1515
run: |
16-
sudo apt-get update
17-
sudo apt-get remove --purge -y moby-engine moby-cli
18-
sudo apt-get install -y qemu-user-static docker.io
19-
16+
docker --version
17+
docker compose version
18+
2019
- uses: actions/checkout@v2
2120

2221
- name: ARM64 build
2322
run: |
24-
sudo docker build -t htm-arm64-docker --build-arg arch=arm64 .
23+
docker build -t htm-arm64-docker --build-arg arch=arm64 .
2524
2625
- name: Tests
2726
run: |
28-
sudo docker run htm-arm64-docker python setup.py test
27+
docker run htm-arm64-docker python htm_test.py
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
2935

30-
- name: Copy files from docker
36+
- name: Tag and push Docker image
3137
run: |
32-
sudo docker cp `sudo docker ps -alq`:/usr/local/src/htm.core/dist dist #TODO the `command` is not 100% reliable, replace with some name/id
33-
ls dist
38+
docker tag htm-arm64-docker ghcr.io/${{ github.repository }}/htm-arm64:latest
39+
docker tag htm-arm64-docker ghcr.io/${{ github.repository }}/htm-arm64:${{ github.run_number }}
40+
docker tag htm-arm64-docker ghcr.io/${{ github.repository }}/htm-arm64:${{ github.sha }}
41+
docker push ghcr.io/${{ github.repository }}/htm-arm64:latest
42+
docker push ghcr.io/${{ github.repository }}/htm-arm64:${{ github.run_number }}
43+
docker push ghcr.io/${{ github.repository }}/htm-arm64:${{ github.sha }}

.github/workflows/pr.yml

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
branches:
77
- master
8+
# run on push events to the master branch
9+
push:
10+
branches:
11+
- master
812
# run every day of the week at 02:00
913
schedule:
1014
- cron: 0 2 * * *
@@ -16,15 +20,15 @@ jobs:
1620
strategy:
1721
#max-parallel: 4
1822
matrix:
19-
python-version: [3.9.x]
23+
python-version: [3.13.x]
2024
# https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners
21-
os: [ubuntu-20.04, windows-2019, macos-10.15] #TODO upgrade to macos-11.0 when available on GH Actions CI
25+
os: [ubuntu-latest, windows-latest, macos-latest]
2226

2327
steps:
24-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v4
2529

2630
- name: Set up Python ${{ matrix.python-version }} for PR
27-
uses: actions/setup-python@v2
31+
uses: actions/setup-python@v5
2832
with:
2933
python-version: ${{ matrix.python-version }}
3034

@@ -56,17 +60,35 @@ jobs:
5660

5761
- name: Install dependencies
5862
run: |
59-
python -m pip install -r requirements.txt
60-
python setup.py configure
63+
python -m pip install setuptools wheel
64+
65+
- name: Setup venv and build htmcore (Linux & macOS)
66+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
67+
run: |
68+
python -m venv .venv
69+
source .venv/bin/activate
70+
python htm_install.py
71+
72+
- name: Setup venv and build htmcore (Windows)
73+
if: matrix.os == 'windows-latest'
74+
run: |
75+
python -m venv .venv
76+
.venv\Scripts\python.exe htm_install.py
6177
62-
- name: build htmcore with setup.py
63-
run: python setup.py install --user --force
78+
- name: C++ & Python Tests (Linux & macOS)
79+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
80+
run: |
81+
source .venv/bin/activate
82+
python htm_test.py
6483
65-
- name: C++ & Python Tests
66-
run: python setup.py test
84+
- name: C++ & Python Tests (Windows)
85+
if: matrix.os == 'windows-latest'
86+
run: |
87+
.venv\Scripts\activate.bat
88+
.venv\Scripts\python.exe htm_test.py
6789
6890
- name: Memory leaks check (valgrind)
69-
if: matrix.os == 'ubuntu-20.04'
91+
if: matrix.os == 'ubuntu-latest'
7092
run: |
7193
sudo apt-get -y install valgrind
7294
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/build/Release/lib valgrind --show-leak-kinds=definite,indirect,possible,reachable --track-origins=yes --num-callers=40 --error-exitcode=3 ./build/Release/bin/hello 5 || exit 1
@@ -78,36 +100,10 @@ jobs:
78100
run: ./build/Release/bin/napi_hello 1000 || exit 3
79101

80102
- name: Hello example (dynamically linked)
81-
if: matrix.os == 'ubuntu-20.04'
103+
if: matrix.os == 'ubuntu-latest'
82104
run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/build/Release/lib ./build/Release/bin/dynamic_hello 1000 || exit 4
83105

84-
- uses: actions/upload-artifact@v2
106+
- uses: actions/upload-artifact@v4
85107
with:
86-
name: "pr_build"
87-
path: build/Release/distr/dist
88-
89-
90-
91-
build-debug:
92-
name: Build and test in Debug mode
93-
#currently cannot run on Linux & Debug due to a bug in YAML parser: issue #218
94-
runs-on: macOS-latest
95-
steps:
96-
- uses: actions/checkout@v2
97-
98-
- name: Install dependencies (Debug)
99-
run: |
100-
mkdir -p build/scripts
101-
cd build/scripts
102-
cmake ../.. -DCMAKE_BUILD_TYPE=Debug
103-
104-
- name: Debug build
105-
run: |
106-
cd build/scripts
107-
make -j2 && make install
108-
109-
- name: C++ Tests
110-
run: |
111-
cd build/scripts
112-
../Debug/bin/unit_tests
113-
108+
name: htm-core-${{ matrix.os }}-py-${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }}
109+
path: dist/*.whl

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ ARG host=amd64
1616
FROM multiarch/qemu-user-static as bootstrap
1717
ARG arch
1818
ARG host
19+
LABEL org.opencontainers.image.description="Docker image with a pre-built, tested and packaged community maintained htm.core library"
20+
LABEL org.opencontainers.image.source="https://github.com/htm-community/htm.core"
21+
1922
RUN echo "Switching from $host to $arch" && uname -a
2023

2124
## Stage 1: build of htm.core on the target platform

external/digestpp.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
# See the GNU Affero Public License for more details.
1414
#
1515
# You should have received a copy of the GNU Affero Public License
16-
# along with this program.  If not, see http://www.gnu.org/licenses.
16+
# along with this program. If not, see http://www.gnu.org/licenses.
1717
# -----------------------------------------------------------------------------
1818

1919
# Download digestpp hash digest package from GitHub archive
2020
# This file downloads and configures the digestpp library.
2121
# header-only, no build.
2222
include(FetchContent)
2323

24-
set(dependency_url "https://github.com/kerukuro/digestpp/archive/34ff2eeae397ed744d972d86b5a20f603b029fbd.zip")
24+
set(dependency_url "https://github.com/kerukuro/digestpp/archive/refs/heads/master.zip")
2525
set(local_override "${CMAKE_SOURCE_DIR}/build/Thirdparty/digestpp")
2626

2727
# Check if local path exists and if so, use it as-is.

0 commit comments

Comments
 (0)