From 3a39b171f9f58d1babf29bd1a791e45471596a7d Mon Sep 17 00:00:00 2001 From: ACornuIGN Date: Mon, 7 Oct 2024 08:56:16 +0200 Subject: [PATCH] refactor: change strategy of workflows --- .github/workflows/test_conda.yml | 84 ++++++++++++++++++++++++++++++++ .github/workflows/test_pip.yml | 78 +++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 .github/workflows/test_conda.yml create mode 100644 .github/workflows/test_pip.yml diff --git a/.github/workflows/test_conda.yml b/.github/workflows/test_conda.yml new file mode 100644 index 0000000..d327157 --- /dev/null +++ b/.github/workflows/test_conda.yml @@ -0,0 +1,84 @@ +name: test_conda + +on: + push: + branches: [main] + pull_request: + +jobs: + test-conda: + strategy: + matrix: + os: ["ubuntu-latest", "windows-latest", "macos-latest"] + python-version: ["3.9", "3.10", "3.11", "3.12"] + fail-fast: false + runs-on: ${{ matrix.os }} + permissions: + contents: read + packages: write + + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: Install environment on ${{ matrix.os }} with python:${{ matrix.python-version }} + uses: mamba-org/setup-micromamba@v1 + with: + python-version: ${{ matrix.python-version }} + environment-file: borea_dependency/environment-dev.yml + environment-name: borea + cache-environment: true + cache-downloads: true + init-shell: bash + + - name: Run unit tests with pytest + shell: bash -el {0} + run: ./ci/test_all.sh + + - name: Run test example + shell: bash -el {0} + run: ./ci/test_example.sh + + - name: Run regression test opk to opk + shell: bash -el {0} + run: python ./borea_tools/opk_to_opk.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -e 2154 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -n Test -w ./test/tmp/ -o NXYHPOKC --ou radian --oa False + + - name: Run regression test opk to opk with multi epsg + shell: bash -el {0} + run : python ./borea_tools/opk_to_opk.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -e 2154 --geoc 4964 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -n Test -w ./test/tmp/ -o NXYHPOKC --ou radian --oa False + + - name: Run regression test control opk + shell: bash -el {0} + run: python ./borea_tools/opk_control.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -t ./dataset/terrain_test.mes -g ./dataset/GCP_test.app -d 13 -l PTXYH -p inter -w ./test/tmp/ + + - name: Run regression test opk to rpc + shell: bash -el {0} + run: python ./borea_tools/opk_to_rpc.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -o 3 + + - name: Run regression test calc pt image to world + shell: bash -el {0} + run: python ./borea_tools/pt_image_to_world.py -n Test -s 814975.925 6283986.148 1771.280 -t altitude -o -0.245070686036 -0.069409621323 0.836320989726 -b opk -u degree -a True -e 2154 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -p 24042.25 14781.17 -d height + + - name: Run regression test calc pt world to image + shell: bash -el {0} + run: python ./borea_tools/pt_world_to_image.py -n Test -s 814975.925 6283986.148 1771.280 -t altitude -o -0.245070686036 -0.069409621323 0.836320989726 -b opk -u degree -a True -e 2154 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -p 815601.510 6283629.280 54.960 -d height + + - name: Run regression test calc file pt world to image + shell: bash -el {0} + run: python ./borea_tools/ptfile_world_to_image.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -t ./dataset/terrain_test0.mes -g ./dataset/GCP_test.app -l PTXYH -n Coor2d_pt_terrain -w ./test/tmp/ + + - name: Run regression test calc file pt image to world + shell: bash -el {0} + run: python ./borea_tools/ptfile_image_to_world.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -t ./dataset/terrain_test.mes -p square -n Coor3d_pt_image -w ./test/tmp/ + + - name: Run regression test spaceresection opk + shell: bash -el {0} + run: python ./borea_tools/spaceresection_opk.py -p 825439 6289034 1500 -d height -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -t ./test/data/dataset2/all_liaisons2.mes -g ./test/data/dataset2/all_liaisons2_world.mes -l PXYH -n SpaceResection -w ./test/tmp/ -o NXYZOPKC --ou degree --oa True + + - name: Run regression test opk to conical + shell: bash -el {0} + run: python ./borea_tools/opk_to_conl.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -e 2154 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -w ./test/tmp/ + + - name: Run transform projextion of points file + shell: bash -el {0} + run: python ./borea_tools/transform_proj_points.py -g ./dataset/GCP_test.app -l PTXYZ -e 2154 -y ./dataset/fr_ign_RAF20.tif --oe 4326 --oz height -n GCP_4326 -w ./test/tmp diff --git a/.github/workflows/test_pip.yml b/.github/workflows/test_pip.yml new file mode 100644 index 0000000..fa8943a --- /dev/null +++ b/.github/workflows/test_pip.yml @@ -0,0 +1,78 @@ +name: test_pip + +on: + push: + branches: [main] + pull_request: + +jobs: + test-on-pip: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + fail-fast: false + + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install GDAL + run: | + sudo apt-get update + sudo apt-get install gdal-bin libgdal-dev + export CPLUS_INCLUDE_PATH=/usr/include/gdal + export C_INCLUDE_PATH=/usr/include/gdal + + - name: Install environment + run: | + python -m pip install --upgrade pip + pip install -r ./borea_dependency/requirements-dev.txt + pip install GDAL==3.4.1 + + - name: Run unit tests with pytest + run: ./ci/test_all.sh + + - name: Run test example + run: ./ci/test_example.sh + + - name: Run regression test opk to opk + run: python ./borea_tools/opk_to_opk.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -e 2154 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -n Test -w ./test/tmp/ -o NXYHPOKC --ou radian --oa False + + - name: Run regression test opk to opk with multi epsg + run : python ./borea_tools/opk_to_opk.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -e 2154 --geoc 4964 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -n Test -w ./test/tmp/ -o NXYHPOKC --ou radian --oa False + + - name: Run regression test control opk + run: python ./borea_tools/opk_control.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -t ./dataset/terrain_test.mes -g ./dataset/GCP_test.app -d 13 -l PTXYH -p inter -w ./test/tmp/ + + - name: Run regression test opk to rpc + run: python ./borea_tools/opk_to_rpc.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -o 3 + + - name: Run regression test calc pt image to world + run: python ./borea_tools/pt_image_to_world.py -n Test -s 814975.925 6283986.148 1771.280 -t altitude -o -0.245070686036 -0.069409621323 0.836320989726 -b opk -u degree -a True -e 2154 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -p 24042.25 14781.17 -d height + + - name: Run regression test calc pt world to image + run: python ./borea_tools/pt_world_to_image.py -n Test -s 814975.925 6283986.148 1771.280 -t altitude -o -0.245070686036 -0.069409621323 0.836320989726 -b opk -u degree -a True -e 2154 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -p 815601.510 6283629.280 54.960 -d height + + - name: Run regression test calc file pt world to image + run: python ./borea_tools/ptfile_world_to_image.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -t ./dataset/terrain_test0.mes -g ./dataset/GCP_test.app -l PTXYH -n Coor2d_pt_terrain -w ./test/tmp/ + + - name: Run regression test calc file pt image to world + run: python ./borea_tools/ptfile_image_to_world.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -t ./dataset/terrain_test.mes -p square -n Coor3d_pt_image -w ./test/tmp/ + + - name: Run regression test spaceresection opk + run: python ./borea_tools/spaceresection_opk.py -p 825439 6289034 1500 -d height -c ./dataset/Camera1.txt -e 2154 -y ./dataset/fr_ign_RAF20.tif -m ./dataset/MNT_France_25m_h_crop.tif --fm height -t ./test/data/dataset2/all_liaisons2.mes -g ./test/data/dataset2/all_liaisons2_world.mes -l PXYH -n SpaceResection -w ./test/tmp/ -o NXYZOPKC --ou degree --oa True + + - name: Run regression test opk to conical + run: python ./borea_tools/opk_to_conl.py -r ./dataset/23FD1305_alt_test.OPK -i NXYZOPKC -f 2 -e 2154 -y ./dataset/fr_ign_RAF20.tif -c ./dataset/Camera1.txt -m ./dataset/MNT_France_25m_h_crop.tif --fm height -w ./test/tmp/ + + - name: Run transform projextion of points file + run: python ./borea_tools/transform_proj_points.py -g ./dataset/GCP_test.app -l PTXYZ -e 2154 -y ./dataset/fr_ign_RAF20.tif --oe 4326 --oz height -n GCP_4326 -w ./test/tmp