From 0d853095a777a58d50f869f176bf646054b85577 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 18 Jan 2025 12:46:08 +0800 Subject: [PATCH 1/7] CI: Test on Linux arm64 runners --- .github/workflows/ci_tests.yaml | 2 +- .github/workflows/ci_tests_dev.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 44416d210e0..e14789268f1 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -57,7 +57,7 @@ jobs: fail-fast: false matrix: python-version: ['3.11', '3.13'] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] # Is it a draft Pull Request (true or false)? isDraft: - ${{ github.event.pull_request.draft }} diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index 6932a0d520b..d5f859f4c5d 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -36,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, macos-15, windows-2025] + os: [ubuntu-24.04, ubuntu-24.04-arm, macos-15, windows-2025] gmt_git_ref: [master] timeout-minutes: 30 defaults: diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 0c4ae574235..f0a742d4e2f 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -34,7 +34,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-13, windows-2019] + os: [ubuntu-20.04, ubuntu-22.04-arm, macos-13, windows-2019] gmt_version: ['6.4'] timeout-minutes: 30 defaults: From 01cdb2193511d403964a6b0f9b79c06ca040408b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 26 Jan 2025 16:00:31 +0800 Subject: [PATCH 2/7] Fix two failures on linux-arm64 --- pygmt/tests/test_x2sys_cross.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/test_x2sys_cross.py b/pygmt/tests/test_x2sys_cross.py index 70f0c3cf003..16f69777ace 100644 --- a/pygmt/tests/test_x2sys_cross.py +++ b/pygmt/tests/test_x2sys_cross.py @@ -3,6 +3,7 @@ """ import copy +import platform import sys from pathlib import Path from tempfile import TemporaryDirectory @@ -270,7 +271,7 @@ def test_x2sys_cross_region_interpolation_numpoints(): ) assert isinstance(output, pd.DataFrame) - if sys.platform == "darwin": + if platform.machine() == "arm64": assert output.shape == (3894, 12) # Check crossover errors (z_X) and mean value of observables (z_M) npt.assert_allclose(output.z_X.mean(), -138.23215, rtol=1e-4) @@ -298,7 +299,7 @@ def test_x2sys_cross_trackvalues(): output = x2sys_cross(tracks=["@tut_ship.xyz"], tag=tag, trackvalues=True) assert isinstance(output, pd.DataFrame) - if sys.platform == "darwin": + if platform.machine() == "arm64": assert output.shape == (14374, 12) # Check mean of track 1 values (z_1) and track 2 values (z_2) npt.assert_allclose(output.z_1.mean(), -2422.973372, rtol=1e-4) From c7e26c19aa5c624ddfb098ec9cfb466bfc5cf6da Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 26 Jan 2025 16:23:23 +0800 Subject: [PATCH 3/7] Check platform.machine --- pygmt/tests/test_x2sys_cross.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pygmt/tests/test_x2sys_cross.py b/pygmt/tests/test_x2sys_cross.py index 16f69777ace..f890f2d342d 100644 --- a/pygmt/tests/test_x2sys_cross.py +++ b/pygmt/tests/test_x2sys_cross.py @@ -19,6 +19,10 @@ from pygmt.exceptions import GMTInvalidInput +def test_platform_machine(): + assert platform.machine() == "" + + @pytest.fixture(name="mock_x2sys_home") def _fixture_mock_x2sys_home(monkeypatch): """ From 8d19c3c9019a3adfaa423ed82efa40e26ed2a744 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 26 Jan 2025 16:30:18 +0800 Subject: [PATCH 4/7] Revert "Check platform.machine" This reverts commit c7e26c19aa5c624ddfb098ec9cfb466bfc5cf6da. --- pygmt/tests/test_x2sys_cross.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pygmt/tests/test_x2sys_cross.py b/pygmt/tests/test_x2sys_cross.py index f890f2d342d..16f69777ace 100644 --- a/pygmt/tests/test_x2sys_cross.py +++ b/pygmt/tests/test_x2sys_cross.py @@ -19,10 +19,6 @@ from pygmt.exceptions import GMTInvalidInput -def test_platform_machine(): - assert platform.machine() == "" - - @pytest.fixture(name="mock_x2sys_home") def _fixture_mock_x2sys_home(monkeypatch): """ From c1c26d4d49a930a16030765f0bd1c7c128e06c25 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 26 Jan 2025 16:32:03 +0800 Subject: [PATCH 5/7] platform.machine returns aarch64 for Linux ARM --- pygmt/tests/test_x2sys_cross.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/tests/test_x2sys_cross.py b/pygmt/tests/test_x2sys_cross.py index 16f69777ace..50b9d5f3f86 100644 --- a/pygmt/tests/test_x2sys_cross.py +++ b/pygmt/tests/test_x2sys_cross.py @@ -271,7 +271,7 @@ def test_x2sys_cross_region_interpolation_numpoints(): ) assert isinstance(output, pd.DataFrame) - if platform.machine() == "arm64": + if platform.machine() in {"aarch64", "arm64"}: assert output.shape == (3894, 12) # Check crossover errors (z_X) and mean value of observables (z_M) npt.assert_allclose(output.z_X.mean(), -138.23215, rtol=1e-4) @@ -299,7 +299,7 @@ def test_x2sys_cross_trackvalues(): output = x2sys_cross(tracks=["@tut_ship.xyz"], tag=tag, trackvalues=True) assert isinstance(output, pd.DataFrame) - if platform.machine() == "arm64": + if platform.machine() in {"aarch64", "arm64"}: assert output.shape == (14374, 12) # Check mean of track 1 values (z_1) and track 2 values (z_2) npt.assert_allclose(output.z_1.mean(), -2422.973372, rtol=1e-4) From 39cc6690dbccb5ea8d174cd453847fdfde1ba701 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 3 Feb 2025 13:08:19 +0800 Subject: [PATCH 6/7] Mark two contour tests as xfail on Linux ARM --- pygmt/tests/test_contour.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pygmt/tests/test_contour.py b/pygmt/tests/test_contour.py index c359c1d124c..2cd2cc2c5ee 100644 --- a/pygmt/tests/test_contour.py +++ b/pygmt/tests/test_contour.py @@ -2,6 +2,7 @@ Test Figure.contour. """ +import platform from pathlib import Path import numpy as np @@ -30,6 +31,7 @@ def fixture_region(): @pytest.mark.mpl_image_compare +@pytest.mark.xfail(platform.machine() == "aarch64", reason="Fails on Linux ARM64") def test_contour_vec(region): """ Plot an x-centered gaussian kernel with different y scale. @@ -130,6 +132,7 @@ def test_contour_multiple_levels(region): @pytest.mark.mpl_image_compare(filename="test_contour_vec.png") +@pytest.mark.xfail(platform.machine() == "aarch64", reason="Fails on Linux ARM64") def test_contour_incols_transposed_data(region): """ Make sure that transposing the data matrix still produces a correct result with From 24f8676cdf3c2e774b06d18608643034ba716b78 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 3 Feb 2025 13:21:38 +0800 Subject: [PATCH 7/7] Exclude the Linux ARM job for draft PRs --- .github/workflows/ci_tests.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 9ae39b9b35c..6130568c006 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -61,8 +61,10 @@ jobs: # Is it a draft Pull Request (true or false)? isDraft: - ${{ github.event.pull_request.draft }} - # Only run three jobs on Ubuntu for draft PRs + # Only run jobs on Ubuntu for draft PRs exclude: + - os: ubuntu-24.04-arm + isDraft: true - os: macos-latest isDraft: true - os: windows-latest