From 1f0e029420081b242f8a19e919ad9221ef982341 Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Fri, 14 Mar 2025 12:54:01 -0400 Subject: [PATCH 01/10] testing new website deployment strategy --- .github/workflows/custom-pages.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/custom-pages.yml diff --git a/.github/workflows/custom-pages.yml b/.github/workflows/custom-pages.yml new file mode 100644 index 0000000..2491352 --- /dev/null +++ b/.github/workflows/custom-pages.yml @@ -0,0 +1,30 @@ +name: Custom GitHub Pages Build and Deploy + +on: + push: + branches: + - test # Only trigger this workflow when pushing to 'test ' + workflow_dispatch: # Allows you to trigger the workflow manually if desired + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + + - name: Render site with Quarto + run: quarto render + + - name: List files for debugging + run: ls -la + + # You can adjust the publish_dir if your build output goes to a different directory. + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_site From b67cc31c66525e9de22a176ada0af5fc2d701000 Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Fri, 14 Mar 2025 13:00:39 -0400 Subject: [PATCH 02/10] Make sure R and correct packages are installed --- .github/workflows/custom-pages.yml | 21 ++++++++++++++------- class1.qmd | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/custom-pages.yml b/.github/workflows/custom-pages.yml index 2491352..8939ef2 100644 --- a/.github/workflows/custom-pages.yml +++ b/.github/workflows/custom-pages.yml @@ -3,8 +3,8 @@ name: Custom GitHub Pages Build and Deploy on: push: branches: - - test # Only trigger this workflow when pushing to 'test ' - workflow_dispatch: # Allows you to trigger the workflow manually if desired + - custom-site # or any branch you want to test on + workflow_dispatch: # optional, for manual triggering jobs: build: @@ -13,18 +13,25 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Set up R + uses: r-lib/actions/setup-r@v2 + - name: Set up Quarto uses: quarto-dev/quarto-actions/setup@v2 + # If you use renv to manage your R packages: + - name: Restore R dependencies with renv + run: Rscript -e 'renv::restore()' + + # Alternatively, if not using renv, install packages manually: + # - name: Install required R packages + # run: Rscript -e 'install.packages(c("pkg1", "pkg2"), dependencies = TRUE)' + - name: Render site with Quarto run: quarto render - - name: List files for debugging - run: ls -la - - # You can adjust the publish_dir if your build output goes to a different directory. - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./_site + publish_dir: ./_site # Adjust if your output directory is different diff --git a/class1.qmd b/class1.qmd index 57f568c..fe59a07 100644 --- a/class1.qmd +++ b/class1.qmd @@ -281,4 +281,4 @@ Since this is a built-in dataset, we can get some help. Try running the code bel ?mean() ``` -Adding a `?` before the name of a function or data frame (built-in or from a package) pulls up a help file in the Help tab of the Output pane. If you aren't sure what a function does, this should be your first step. +Adding a `?` before the name of a function or data frame (built-in or from a package) pulls up a help file in the Help tab of the Output pane. If you aren't sure what a function does, this should be your first step. \ No newline at end of file From a019d73306632f67671384f05625b516adb89ed9 Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Fri, 14 Mar 2025 13:02:36 -0400 Subject: [PATCH 03/10] test website --- class2.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class2.qmd b/class2.qmd index 69fd867..18246ff 100644 --- a/class2.qmd +++ b/class2.qmd @@ -78,7 +78,7 @@ data(package = "palmerpenguins") Your former lab mate Weird Barbie graduated a few years ago. Before she left, she was working on some interesting analyses of the frequencies of Kens. -This is a test! +This is a test ![photo credit: Warner Bros.](data/class2_files/weirdbarbie.jpeg){fig-align="center"} From d2d4b1c88ae0289a48b6367edd2e226cb0066274 Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Fri, 14 Mar 2025 13:03:27 -0400 Subject: [PATCH 04/10] oops --- .github/workflows/custom-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/custom-pages.yml b/.github/workflows/custom-pages.yml index 8939ef2..e384e46 100644 --- a/.github/workflows/custom-pages.yml +++ b/.github/workflows/custom-pages.yml @@ -3,7 +3,7 @@ name: Custom GitHub Pages Build and Deploy on: push: branches: - - custom-site # or any branch you want to test on + - test # or any branch you want to test on workflow_dispatch: # optional, for manual triggering jobs: From f0a7daf5717bdc90b91f72aefdfa51c72f5add9c Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Fri, 14 Mar 2025 13:21:29 -0400 Subject: [PATCH 05/10] change output directory --- .github/workflows/custom-pages.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/custom-pages.yml b/.github/workflows/custom-pages.yml index e384e46..0d4be28 100644 --- a/.github/workflows/custom-pages.yml +++ b/.github/workflows/custom-pages.yml @@ -19,19 +19,21 @@ jobs: - name: Set up Quarto uses: quarto-dev/quarto-actions/setup@v2 - # If you use renv to manage your R packages: + # Restore R dependencies using renv (if you're using renv) - name: Restore R dependencies with renv run: Rscript -e 'renv::restore()' - # Alternatively, if not using renv, install packages manually: - # - name: Install required R packages - # run: Rscript -e 'install.packages(c("pkg1", "pkg2"), dependencies = TRUE)' - + # Render your Quarto site - name: Render site with Quarto run: quarto render + # Debug step: List files in the output directory to verify rendering + - name: List rendered files + run: ls -la docs + + # Deploy the rendered site to GitHub Pages (using the correct output directory) - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./_site # Adjust if your output directory is different + publish_dir: ./docs From 00ec78ebe1fd20bc70f50c0f72b3a9d34edba51f Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Fri, 14 Mar 2025 15:38:01 -0400 Subject: [PATCH 06/10] does this work? --- .github/workflows/custom-pages.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/custom-pages.yml b/.github/workflows/custom-pages.yml index 0d4be28..4df288b 100644 --- a/.github/workflows/custom-pages.yml +++ b/.github/workflows/custom-pages.yml @@ -31,9 +31,10 @@ jobs: - name: List rendered files run: ls -la docs - # Deploy the rendered site to GitHub Pages (using the correct output directory) + # Deploy the rendered site to GitHub Pages (using the specified publish branch) - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs + publish_branch: gh-pages # Change this if your GitHub Pages is configured to publish from a different branch From 22627f23de8f5071d15b8e4fa16b75eea522bc0f Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Fri, 14 Mar 2025 15:44:42 -0400 Subject: [PATCH 07/10] test --- .github/workflows/custom-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/custom-pages.yml b/.github/workflows/custom-pages.yml index 4df288b..80e5cdd 100644 --- a/.github/workflows/custom-pages.yml +++ b/.github/workflows/custom-pages.yml @@ -36,5 +36,5 @@ jobs: uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs + publish_dir: ./ publish_branch: gh-pages # Change this if your GitHub Pages is configured to publish from a different branch From bffd86ae591db198fe4a5b2459a4c059a8008f5a Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Fri, 14 Mar 2025 16:02:06 -0400 Subject: [PATCH 08/10] update quarto.yml --- .github/workflows/custom-pages.yml | 10 +++++----- _quarto.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/custom-pages.yml b/.github/workflows/custom-pages.yml index 80e5cdd..1e777cc 100644 --- a/.github/workflows/custom-pages.yml +++ b/.github/workflows/custom-pages.yml @@ -23,18 +23,18 @@ jobs: - name: Restore R dependencies with renv run: Rscript -e 'renv::restore()' - # Render your Quarto site + # Render your Quarto site; output will go into the docs folder - name: Render site with Quarto run: quarto render - # Debug step: List files in the output directory to verify rendering + # Debug step: List files in the docs directory to verify rendering - name: List rendered files run: ls -la docs - # Deploy the rendered site to GitHub Pages (using the specified publish branch) + # Deploy the rendered site to GitHub Pages (using gh-pages branch) - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./ - publish_branch: gh-pages # Change this if your GitHub Pages is configured to publish from a different branch + publish_dir: ./docs + publish_branch: gh-pages diff --git a/_quarto.yml b/_quarto.yml index 261c0ea..7e80f26 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -3,7 +3,7 @@ project: output-dir: docs book: - site-url: https://h2l2cR.com + site-url: https://how-to-learn-to-code.github.io/Rclass-DataScience/ sidebar: tools: - icon: github From 083d01d2a769edc0eca531fbd3ac93555ff07f02 Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Thu, 15 May 2025 13:59:39 -0400 Subject: [PATCH 09/10] website update check --- class0.qmd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/class0.qmd b/class0.qmd index e95c754..f1b5fc6 100644 --- a/class0.qmd +++ b/class0.qmd @@ -7,7 +7,7 @@ format: ## Introduction -This page will walk you through setting up access to UNC's computing cluster and introduce you a bit to R and R Studio so we can hit the ground running in the first class. To ensure you have access to the UNC cluster (and thus able to participate in class), **please review this document in full at least 24 hours in advance of the first class**--Research IT will need time to approve your account request. +Test test This page will walk you through setting up access to UNC's computing cluster and introduce you a bit to R and R Studio so we can hit the ground running in the first class. To ensure you have access to the UNC cluster (and thus able to participate in class), **please review this document in full at least 24 hours in advance of the first class**--Research IT will need time to approve your account request. ## Class 0 Objectives @@ -119,9 +119,9 @@ Below is some jargon that you may hear during class. Don't worry about memorizin **Functions:** A function performs a given task. This task can be very simple (add two numbers) or more complex (create a large data frame, run a linear regression, save the output to a csv file). R has many built-in functions you will use. Many packages also have functions you can use. -**Packages:** Packages in R are extensions of what is called "base R." Base R refers to using R without any add-ons (i.e., no packages). Packages can have data, functions, and/or compiled code. It is the responsibility of package developers to maintain their package--which means some undergo frequent updates and some haven't been touched in years (and thus might not work anymore for whatever reason). It also means that some packages can have bugs or might not be appropriate for your data/analysis. To use a package, you will first need to install it using the function `install.package("")`. You will only need to install the package once. Each time you want to use the package, you'll need to load it into your environment: `library(")`. You will only need to install the package once. Each time you want to use the package, you'll need to load it into your environment: `library( -If you want a more detailed install walkthrough: +If you want a more detailed install walkthrough: \ No newline at end of file From b1b2caeea52e158d0924b7ae2113cc4409d95394 Mon Sep 17 00:00:00 2001 From: austintdaigle Date: Thu, 15 May 2025 14:22:12 -0400 Subject: [PATCH 10/10] Improve r environment updating: Lock r version and faster package updating --- .github/workflows/custom-pages.yml | 49 ++++++++++++++++++------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/custom-pages.yml b/.github/workflows/custom-pages.yml index 1e777cc..da91912 100644 --- a/.github/workflows/custom-pages.yml +++ b/.github/workflows/custom-pages.yml @@ -1,38 +1,47 @@ -name: Custom GitHub Pages Build and Deploy +name: Build-and-Deploy on: push: - branches: - - test # or any branch you want to test on - workflow_dispatch: # optional, for manual triggering + branches: [ test ] + workflow_dispatch: jobs: build: runs-on: ubuntu-latest + steps: - - name: Checkout repository - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 # freeze R + with: { r-version: "4.4.2" } + + - uses: r-lib/actions/setup-pandoc@v2 # Quarto needs Pandoc - - name: Set up R - uses: r-lib/actions/setup-r@v2 + - uses: quarto-dev/quarto-actions/setup@v2 + + # speed: reuse compiled packages + - name: Cache renv packages + uses: actions/cache@v4 + with: + path: | + ~/.cache/R/renv + renv/cache + key: ${{ runner.os }}-renv-${{ hashFiles('renv.lock') }} + restore-keys: ${{ runner.os }}-renv- - - name: Set up Quarto - uses: quarto-dev/quarto-actions/setup@v2 + # restore packages exactly as in renv.lock + - name: Restore R packages + run: Rscript -e 'renv::restore(prompt = FALSE)' - # Restore R dependencies using renv (if you're using renv) - - name: Restore R dependencies with renv - run: Rscript -e 'renv::restore()' - - # Render your Quarto site; output will go into the docs folder - - name: Render site with Quarto + # build the site + - name: Render site run: quarto render - # Debug step: List files in the docs directory to verify rendering - - name: List rendered files + - name: List rendered files # optional debug run: ls -la docs - # Deploy the rendered site to GitHub Pages (using gh-pages branch) - - name: Deploy to GitHub Pages + # deploy + - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }}