Skip to content

Commit

Permalink
Update GitHub Actions: Build Triggers, upload-artifact (#720)
Browse files Browse the repository at this point in the history
fix(GHA): Updates GHA build triggers

* update to v4 of upload-artifact gha
* fix(clang-format): v18 of workflow; allows for the newest version of clang-format to always be used by removing the clang-format version specification. This might be causing the issues with clang-format reordering the libraries and things
crashing on the R side when the package is tested.
* refactor(build-doxygen): Uses one file with an if statement to know if the doxygen workflow should deploy after building now that it is built on changes to both dev and main.
* fix(call-calc-coverage): Ignores paths on push and PR; it was ignoring paths just on workflow dispatch. Now the ignore calls are there for both PR and pushes.
* Adds dependabot.yml file to update GitHub actions
* Removes tags as trigger in package down
* Formats the GitHub action yml files consistently; moves summary above name: and arrange on in alphabetical order, as well as branch names and files are now in order too. This standardizes the way that the files are written.

References:
* https://kevsoft.net/2020/06/10/running-github-action-steps-and-jobs-only-on-push-to-master.html
* https://stackoverflow.com/questions/58139406/only-run-job-on-specific-branch-with-github-actions

Co-authored-by: Bai-Li-NOAA <[email protected]>
Co-authored-by: kellijohnson-NOAA <[email protected]>
  • Loading branch information
3 people authored Jan 13, 2025
1 parent 7cf2c14 commit 06d9a17
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 151 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/build-deploy-doxygen.yml

This file was deleted.

36 changes: 28 additions & 8 deletions .github/workflows/build-doxygen.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Run doxygen to generate documentation from C++ code
# build doxygen, error on warnings.
# Run doxygen to generate documentation from C++ code, which is the equivalent
# of roxygen documentation in the R code. After building the html files, if the
# action is being ran on main, the files are moved to the appropriate location
# and pushed to NOAA-FIMS/FIMS-docs@main.
name: run-doxygen
# The default build trigger is to run the action on every push for any branch

on:
workflow_dispatch:
pull_request:
push:
branches:
- dev
- main
# To run the default repository branch weekly on sunday, uncomment the following 2 lines
#schedule:
#- cron: '0 0 * * 0'
workflow_dispatch:

jobs:
build-doxygen:
Expand All @@ -29,8 +29,28 @@ jobs:
sudo apt install cmake doxygen gcc git ninja-build
- name: Building HTML documentation with Doxygen
# Do not run mkdir docs and mv build/html docs locally
# Do not run -DDOXYGEN_WARN_AS_ERROR=YES locally
# FIX? run cmake --build build --parallel 16
run: |
cmake -S . -B build -G Ninja -DDOXYGEN_WARN_AS_ERROR=YES
cmake --build build
- name: Deploy html documentation with Doxygen
# Do not run mkdir docs and mv build/html docs locally
if: ${{ github.ref == 'refs/heads/main' }}
run: |
mv build/html ./
mv ./html ./docs
- name: Push docs to FIMS-docs repo
if: ${{ github.ref == 'refs/heads/main' }}
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'docs'
destination_repo: 'NOAA-FIMS/FIMS-docs'
destination_branch: 'main'
user_email: '[email protected]' # your email
user_name: 'Christine Stawitz' # your login
commit_message: 'Docs: run Doxygen'
5 changes: 4 additions & 1 deletion .github/workflows/call-allcontributors.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Runs allcontributors::add_contributors() to add, or update, an alphabetized
# list of contributors to the README.md file and open a new PR with those
# changes.
name: Collect contributors

on:
workflow_dispatch:
schedule:
- cron: '0 8 * * 1'
workflow_dispatch:

jobs:
run-r-script:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/call-build-pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Checks that the pkgdown site builds for a repository.
# this assumes pkgdown is already set up.
# Checks that the pkgdown site builds for a repository, assuming that one
# already exists, but it does not actually deploy it. See
# call-update-pkgdown.yml for that.
name: call-build-pkgdown
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows

on:
workflow_dispatch:
pull_request:
branches:
- dev
- main
workflow_dispatch:

jobs:
call-workflow:
uses: nmfs-fish-tools/ghactions4r/.github/workflows/build-pkgdown.yml@main
35 changes: 22 additions & 13 deletions .github/workflows/call-calc-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
# call a workflow that runs covr::codecov() to calculate code coverage
# Runs covr::codecov() to calculate code coverage.
name: call-calc_coverage
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
# The default is to run the workflow on every push or pull request to every branch.

on:
workflow_dispatch:
pull_request:
branches:
- dev
- main
paths-ignore:
- .devcontainer
- .github
- 'LICENSE'
- 'README.md'
- 'CONTRIBUTING.md'
- 'Rbuildignore'
- '.gitignore'
- '.Rbuildignore'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'man'
- 'README.md'
push:
branches:
- dev
pull_request:
branches:
- main
- dev
- dev
paths-ignore:
- .devcontainer
- .github
- '.gitignore'
- '.Rbuildignore'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'man'
- 'README.md'
workflow_dispatch:

jobs:
call-workflow:
uses: nmfs-fish-tools/ghactions4r/.github/workflows/calc-coverage.yml@main
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/call-doc-and-style-r.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# document and style using reusable workflow
# This workflow runs devtools::document and styler::style_active_package(), then opens a pull request to the branch
# That started the workflow with the changes
# Runs devtools::document() and styler::style_active_package(), then opens a
# pull request to the branch that had changes in the push that triggered the
# workflow.
name: call-doc-and-style-r
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows

on:
# workflow_dispatch requires pushing a button to run the workflow manually. uncomment the following line to add:
workflow_dispatch:
# Runs the workflow on each push to the main or master branch:
push:
branches:
branches:
- dev
- main
workflow_dispatch:

jobs:
call-workflow:
uses: nmfs-fish-tools/ghactions4r/.github/workflows/doc-and-style-r.yml@main
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/call-r-cmd-check.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Run r cmd check
# Runs R CMD CHECK on the package.
name: call-r-cmd-check
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows

on:
workflow_dispatch:
# The default build trigger is to run the action on every push and pull request, for any branch
push:
# To run the default repository branch weekly on sunday, uncomment the following 2 lines
#schedule:
#- cron: '0 0 * * 0'
workflow_dispatch:

jobs:
call-workflow:
uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@main
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/call-spell-check.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# run devtools::spell_check()
# Runs devtools::spell_check().
name: call-spell-check
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows

on:
# this workflow runs on pushing to main, pull requests to main, and manually.
push:
branches:
- main
- dev
pull_request:
branches:
- dev
- main
push:
branches:
- dev
- main
workflow_dispatch:

jobs:
call-workflow:
uses: nmfs-fish-tools/ghactions4r/.github/workflows/spell-check.yml@main
11 changes: 5 additions & 6 deletions .github/workflows/call-update-pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# updates exiting pkgdown site for a repository
# deploys to a branch gh-pages
# Updates the exiting pkgdown site for a repository by deploying the changes
# made to the pkgdown site to a branch called gh-pages.
name: call-update-pkgdown
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows

on:
# this workflow runs on pushes to main or master or any time a new tag is pushed
push:
branches: [main, master]
tags: ['*']
branches: [main]

jobs:
call-workflow:
uses: nmfs-fish-tools/ghactions4r/.github/workflows/update-pkgdown.yml@main
9 changes: 9 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Uses dependabot to check things
version: 2
updates:
# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
# The default location of the bot is `.github/workflows`
directory: "/"
schedule:
interval: "weekly"
28 changes: 9 additions & 19 deletions .github/workflows/get-gtest-codecov.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
# Get GoogleTest code coverage
# Gets the GoogleTest code coverage metrics.
name: get-gtest-codecov
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows

on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- .devcontainer
- .github
- 'LICENSE'
- 'README.md'
- 'CONTRIBUTING.md'
- 'Rbuildignore'
- '.gitignore'
- 'man'
pull_request:
branches:
- dev
- main
push:
branches:
- dev
- main
workflow_dispatch:

jobs:
build:
Expand Down Expand Up @@ -63,7 +56,7 @@ jobs:
gcovr --exclude tests/ --cobertura coverage.xml
- name: save coverage report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage.xml
path: coverage.xml
Expand All @@ -73,6 +66,3 @@ jobs:
with:
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}



7 changes: 5 additions & 2 deletions .github/workflows/pr-checklist.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# This workflow automatically adds a comment containing a reviewer checklist
# when a new pull request is opened.
# Adds a comment to a newly opened PR letting reviewers know what should be
# included in their review.
# TODO: change this to email the assigned reviewer
name: Add a comment with reviewer checklist when PR opened

on:
pull_request:
types: [opened]

jobs:
pr-checklist:
runs-on: ubuntu-latest
Expand Down
22 changes: 9 additions & 13 deletions .github/workflows/run-clang-format.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# Run clang-format
# This workflow runs clang-format to format C++ code and then creates
# a pull request to commit the changed files to the main branch.
# More details about clang-format can be found here:
# https://clang.llvm.org/docs/ClangFormat.html. To style
# C++ code in VS Code locally, you could follow the instructions on this
# website https://code.visualstudio.com/docs/editor/codebasics#_formatting
# to format the entire file or selected text.

# Runs clang-format to format C++ code and then creates a PR to the branch
# which had changes and triggered this action. More details about clang-format
# can be found here: https://clang.llvm.org/docs/ClangFormat.html. To style C++
# code in VS Code locally, you could follow the instructions on this website
# https://code.visualstudio.com/docs/editor/codebasics#_formatting to format
# the entire file or selected text.
name: run-clang-format

on:
workflow_dispatch:
# Runs the workflow on each push to the main or master branch:
push:
branches:
- dev
- main
workflow_dispatch:

jobs:
job:
Expand All @@ -24,11 +21,10 @@ jobs:
# We use Google style to format code.
steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.14
- uses: DoozyX/clang-format-lint-action@v0.18.1
with:
source: './inst/include ./src ./tests/gtest'
extensions: 'hpp, cpp'
clangFormatVersion: 13.0.0
style: Google
inplace: True

Expand Down
Loading

0 comments on commit 06d9a17

Please sign in to comment.