From 67a9c14be80d427c93d266cef230dfc1fa758030 Mon Sep 17 00:00:00 2001 From: Justin Bousquin Date: Wed, 17 Jan 2024 15:46:00 -0600 Subject: [PATCH 1/8] Create test_r init commit for tests r demo --- .github/workflows/test_r | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/test_r diff --git a/.github/workflows/test_r b/.github/workflows/test_r new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.github/workflows/test_r @@ -0,0 +1 @@ + From 9f3ba249d690df8592bd1e4d823510665277e38a Mon Sep 17 00:00:00 2001 From: Justin Bousquin Date: Wed, 17 Jan 2024 15:57:15 -0600 Subject: [PATCH 2/8] Update and rename test_r to test_r.yaml First attempt to add R install to existing test --- .github/workflows/test_r | 1 - .github/workflows/test_r.yaml | 64 +++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) delete mode 100644 .github/workflows/test_r create mode 100644 .github/workflows/test_r.yaml diff --git a/.github/workflows/test_r b/.github/workflows/test_r deleted file mode 100644 index 8b13789..0000000 --- a/.github/workflows/test_r +++ /dev/null @@ -1 +0,0 @@ - diff --git a/.github/workflows/test_r.yaml b/.github/workflows/test_r.yaml new file mode 100644 index 0000000..28f44c6 --- /dev/null +++ b/.github/workflows/test_r.yaml @@ -0,0 +1,64 @@ +name: R-test + +on: + push: + branches: + [main, dev] + pull_request: + branches: + [main] + schedule: + - cron: '11 1 1 * *' + +jobs: + R-test: + name: python ${{ matrix.python-version }}, ${{ matrix.os }} + runs-on: ${{ matrix.os }} + env: + REPO_NAME: ${{ github.event.repository.name }} + R_KEEP_PKG_SOURCE: yes + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + python-version: ['3.7', '3.8', '3.9', '3.10'] + include: + - os: windows-latest + python-version: "3.9" + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up R + uses: r-lib/actions/setup-pandoc@v2 + + - name: install R + uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.os }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - name: Update pip and install testing pkgs + run: | + python -VV + python -m pip install --upgrade pip + pip install pytest + + # fiona doesn't have wheels for windows + - if: matrix.os == 'windows-latest' + run: | + pip install https://github.com/cgohlke/geospatial-wheels/releases/download/v2023.7.16/GDAL-3.7.1-cp39-cp39-win_amd64.whl + pip install https://github.com/cgohlke/geospatial-wheels/releases/download/v2023.7.16/Fiona-1.9.4.post1-cp39-cp39-win_amd64.whl + + - name: Install package and dependencies + run: | + python -m pip install --no-deps . + pip install -r requirements.txt + + - name: Run pytest + run: pytest -v harmonize_wq From 72181b6cf637f6e31f0757d9a9f93d8080aaef22 Mon Sep 17 00:00:00 2001 From: Justin Bousquin Date: Wed, 17 Jan 2024 16:04:32 -0600 Subject: [PATCH 3/8] Update test_r.yaml Run manually --- .github/workflows/test_r.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test_r.yaml b/.github/workflows/test_r.yaml index 28f44c6..93d01a2 100644 --- a/.github/workflows/test_r.yaml +++ b/.github/workflows/test_r.yaml @@ -9,14 +9,15 @@ on: [main] schedule: - cron: '11 1 1 * *' - + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + jobs: R-test: name: python ${{ matrix.python-version }}, ${{ matrix.os }} runs-on: ${{ matrix.os }} env: REPO_NAME: ${{ github.event.repository.name }} - R_KEEP_PKG_SOURCE: yes strategy: matrix: @@ -34,14 +35,11 @@ jobs: python-version: ${{ matrix.python-version }} - name: Set up R - uses: r-lib/actions/setup-pandoc@v2 - - - name: install R uses: r-lib/actions/setup-r@v2 with: - r-version: ${{ matrix.os }} - http-user-agent: ${{ matrix.config.http-user-agent }} - use-public-rspm: true + r-version: 'release' + + - uses: r-lib/actions/setup-pandoc@v1 - name: Update pip and install testing pkgs run: | From 0e359f62d28b6d29f2095744892746f3346fe521 Mon Sep 17 00:00:00 2001 From: Justin Bousquin Date: Wed, 17 Jan 2024 16:06:55 -0600 Subject: [PATCH 4/8] Update test_r.yaml Trigger on push --- .github/workflows/test_r.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_r.yaml b/.github/workflows/test_r.yaml index 93d01a2..c03fead 100644 --- a/.github/workflows/test_r.yaml +++ b/.github/workflows/test_r.yaml @@ -3,7 +3,7 @@ name: R-test on: push: branches: - [main, dev] + [main, dev, reticulate_demo_test] pull_request: branches: [main] From 0c38a81ffef1c0eeda88b3038e45a71f04c5f5bb Mon Sep 17 00:00:00 2001 From: Justin Bousquin Date: Wed, 17 Jan 2024 16:28:58 -0600 Subject: [PATCH 5/8] Update test_r.yaml Test running it --- .github/workflows/test_r.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_r.yaml b/.github/workflows/test_r.yaml index c03fead..5c0c61e 100644 --- a/.github/workflows/test_r.yaml +++ b/.github/workflows/test_r.yaml @@ -39,7 +39,7 @@ jobs: with: r-version: 'release' - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - name: Update pip and install testing pkgs run: | @@ -58,5 +58,10 @@ jobs: python -m pip install --no-deps . pip install -r requirements.txt + - name: point R to pip env + run: | + install.packages("reticulate") + import("harmonize_wq") + - name: Run pytest run: pytest -v harmonize_wq From f53d5345f4d553ef79cfc2116f24f186e778194a Mon Sep 17 00:00:00 2001 From: Justin Bousquin Date: Wed, 17 Jan 2024 16:34:39 -0600 Subject: [PATCH 6/8] Update test_r.yaml try using shell to run as R --- .github/workflows/test_r.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_r.yaml b/.github/workflows/test_r.yaml index 5c0c61e..e022a38 100644 --- a/.github/workflows/test_r.yaml +++ b/.github/workflows/test_r.yaml @@ -58,10 +58,11 @@ jobs: python -m pip install --no-deps . pip install -r requirements.txt - - name: point R to pip env + - name: Run pip env using R reticulate run: | install.packages("reticulate") import("harmonize_wq") + shell: Rscript {0} - name: Run pytest run: pytest -v harmonize_wq From 5b52641bf1ca6e89202d88ea2dad29fbceb98252 Mon Sep 17 00:00:00 2001 From: Justin Bousquin Date: Wed, 17 Jan 2024 16:43:26 -0600 Subject: [PATCH 7/8] Update test_r.yaml Dedent shell --- .github/workflows/test_r.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_r.yaml b/.github/workflows/test_r.yaml index e022a38..f8380cf 100644 --- a/.github/workflows/test_r.yaml +++ b/.github/workflows/test_r.yaml @@ -62,7 +62,7 @@ jobs: run: | install.packages("reticulate") import("harmonize_wq") - shell: Rscript {0} + shell: Rscript {0} - name: Run pytest run: pytest -v harmonize_wq From b70b93c89e6c22c6be043eef06aee603b4218789 Mon Sep 17 00:00:00 2001 From: Justin Bousquin Date: Wed, 17 Jan 2024 16:49:13 -0600 Subject: [PATCH 8/8] Update test_r.yaml lib isn't loaded, reference where import is --- .github/workflows/test_r.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_r.yaml b/.github/workflows/test_r.yaml index f8380cf..9755fe1 100644 --- a/.github/workflows/test_r.yaml +++ b/.github/workflows/test_r.yaml @@ -61,7 +61,7 @@ jobs: - name: Run pip env using R reticulate run: | install.packages("reticulate") - import("harmonize_wq") + reticulate::import("harmonize_wq") shell: Rscript {0} - name: Run pytest