Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 13 additions & 77 deletions .github/actions/run-IS-unit-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,7 @@ description: "Run R unit tests on IS package"

runs:
using: "composite"
steps:
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: ${{ env.GCP_PROVIDER }}
service_account: ${{ env.GCP_SERVICE_ACCOUNT }}
#
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
#
- name: "Docker auth"
shell: bash
run: gcloud auth configure-docker ${{ env.GCP_ARTIFACT_HOST }} --quiet
#
# setup-buildx-action for Docker
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
#
# Login to github registry
- name: Log into github registry ${{ env.GHCR_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ env.GITHUB_TOKEN }}
#
# Build and push Docker image with Buildx (don't push on PR) with multiple tags
# https://github.com/docker/build-push-action
- name: Build Docker image
id: build
uses: docker/build-push-action@v5
with:
context: ./
file: ${{ env.MODULE_PATH }}/Dockerfile

steps:
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -49,12 +15,13 @@ runs:
packages: |
fs
devtools
testthat
covr
rapportools
arrow@19.0.1.1
dplyr@1.1.3
jsonlite@1.8.7
extra-packages: |
any::covr
any::xml2
needs: coverage
cache: always
Expand All @@ -65,13 +32,6 @@ runs:
LIBR_DIR=$(dirname $(find /opt -name "libR.so" | head -n 1))
echo "LD_LIBRARY_PATH=$LIBR_DIR:$LD_LIBRARY_PATH" >> $GITHUB_ENV

- name: Install Avro
shell: bash
run: sudo apt install libavro23

- name: check out repository
uses: actions/checkout@v3

- name: Run ${{ env.MODULE_NAME }} unit test coverage using covr package
shell: Rscript {0}
run: |
Expand All @@ -84,6 +44,8 @@ runs:
library("NEONprocIS.cal")
}
#
library(testthat)
library(covr)
library(dplyr)
library(arrow)
library(jsonlite)
Expand All @@ -101,7 +63,7 @@ runs:
covr::report(cov, file="${{ env.MODULE_NAME }}-coverage.html")
# Generates a Cobertura XML file
covr::to_cobertura(cov, filename = "test-summary.xml")
#

# Generate Markdown Summary
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
Expand All @@ -111,46 +73,20 @@ runs:
hide_complexity: false
format: markdown
output: both
#
# # Display in Job Summary

# Display in Job Summary
- name: Add coverage summary to job summary
shell: bash
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

# Upload Coverage Report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./test-summary.xml
flags: unittests
name: codecov-umbrella
#
# Uploads the coverage.html file as a workflow artifact

# Uploads the HTML report as a workflow artifact
# Find the r-coverage-report artifact on the workflow run details page.
# Download the artifact and open the coverage.html file in your browser
# to explore the detailed test coverage report, including line-by-line coverage information.

- name: Upload coverage.html artifact
uses: actions/upload-artifact@v4
with:
name: r-coverage-report
path: ${{ env.MODULE_NAME }}-coverage.html
retention-days: 1 # Adjust retention days as needed

- name: Add/update the test coverage.html to ./pack/test_coverage/
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
git config --local user.email "actions@github.com"
git config --local user.name "gitHub Actions"
git config push.default current
git pull
git add "${{ env.MODULE_NAME }}-coverage.html"
echo "Attempting to create a test_coverage directory"
mkdir -p pack/test_coverage
echo "Directory creation successful (or already existed)."
git mv "${{ env.MODULE_NAME }}-coverage.html" ./pack/test_coverage/
git commit -m "Add the test coverage.html to test_coverage directory" || echo "No coveage added"
git push origin || echo "No changes to commit"

path: |
${{ env.MODULE_NAME }}-coverage.html
lib/
65 changes: 6 additions & 59 deletions .github/workflows/IS_pack_base_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,27 @@ name: "Run IS base package unit tests"
on:
push:
branches:
- 'master'
- master
paths:
- 'pack/NEONprocIS.base/**'

- pack/NEONprocIS.base/**
workflow_dispatch: {} # Allows trigger of workflow from web interface

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}
# Use github and google registries
GHCR_REGISTRY: ghcr.io
# GHCR_NS, i.e, NEONSciene, in lowercase
# GHCR_NS: ${{ github.repository_owner }}
GHCR_NS: ${{ vars.SHARED_WIF_REPO }}
GCP_ARTIFACT_HOST: ${{ vars.SHARED_WIF_LOCATON }}-docker.pkg.dev
GCP_REGISTRY: ${{ vars.SHARED_WIF_LOCATON }}-docker.pkg.dev/${{ vars.SHARED_WIF_PROJECT }}/${{ vars.SHARED_WIF_REPO }}
GCP_PROVIDER: ${{ vars.SHARED_WIF_PROVIDER }}
GCP_SERVICE_ACCOUNT: ${{ vars.SHARED_WIF_SERVICE_ACCOUNT }}
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
REPO_NAME: neon-is-data-processing
# IS package name
MODULE_BASE_NAME: NEONprocIS.base
MODULE_BASE_PATH: ./pack/NEONprocIS.base
MODULE_NAME: NEONprocIS.base
MODULE_PATH: ./pack/NEONprocIS.base
IMAGE_NAME: neon-is-pack-base-r

jobs:
run-unit-test:
runs-on: ubuntu-latest
permissions:
contents: 'write'
security-events: write
packages: write
id-token: 'write'
pull-requests: 'write'

steps:
- name: "Checkout"
uses: "actions/checkout@v4.1.4"
with:
ref: 'master'
fetch-depth: '0'

# Note: must clone other repos AFTER checking out the repo where the action is run from.
# Otherwise, previously cloned repos are removed.
- name: "Clone avro"
uses: actions/checkout@v4
with:
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
repository: 'BattelleEcology/avro'

# The branch, tag or SHA to checkout. When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Otherwise, uses the default branch.
ref: 'release-1.10.0'
#fetch-depth: '0'

# SSH key used to fetch the repository. The SSH key is configured with the local
# git config, which enables your scripts to run authenticated git commands. The
# post-job step removes the SSH key.
#
# We recommend using a service account with the least permissions necessary.
#
# [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
# Note: when generating the key, use the following: ssh-keygen -t ed25519 -C "git@github.com"
ssh-key: ${{ secrets.BE_GITHUB_KEY }}

# Relative path under $GITHUB_WORKSPACE to place the repository
path: './avro'
- name: Checkout
uses: actions/checkout@v5

- name: Get short SHA
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Install Avro
run: sudo apt install libavro23

- name: Run IS ${{ env.MODULE_NAME }} unit tests
uses: ./.github/actions/run-IS-unit-tests
66 changes: 5 additions & 61 deletions .github/workflows/IS_pack_cal_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,24 @@ name: "Run IS cal package unit tests"
on:
push:
branches:
- 'master'
- master
paths:
- 'pack/NEONprocIS.cal/**'

- pack/NEONprocIS.cal/**
workflow_dispatch: {} # Allows trigger of workflow from web interface

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}
# Use github and google registries
GHCR_REGISTRY: ghcr.io
# GHCR_NS, i.e, NEONSciene, in lowercase
# GHCR_NS: ${{ github.repository_owner }}
GHCR_NS: ${{ vars.SHARED_WIF_REPO }}
GCP_ARTIFACT_HOST: ${{ vars.SHARED_WIF_LOCATON }}-docker.pkg.dev
GCP_REGISTRY: ${{ vars.SHARED_WIF_LOCATON }}-docker.pkg.dev/${{ vars.SHARED_WIF_PROJECT }}/${{ vars.SHARED_WIF_REPO }}
GCP_PROVIDER: ${{ vars.SHARED_WIF_PROVIDER }}
GCP_SERVICE_ACCOUNT: ${{ vars.SHARED_WIF_SERVICE_ACCOUNT }}
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
REPO_NAME: neon-is-data-processing
# IS package name
MODULE_BASE_NAME: NEONprocIS.base
MODULE_BASE_PATH: ./pack/NEONprocIS.base
MODULE_PATH: ./pack/NEONprocIS.cal
MODULE_NAME: NEONprocIS.cal
IMAGE_NAME: neon-is-pack-cal-r
MODULE_PATH: ./pack/NEONprocIS.cal

jobs:
run-unit-test:
runs-on: ubuntu-latest
permissions:
contents: 'write'
security-events: write
packages: write
id-token: 'write'
pull-requests: 'write'

steps:
- name: "Checkout"
uses: "actions/checkout@v4.1.4"
with:
ref: 'master'
fetch-depth: '0'

# Note: must clone other repos AFTER checking out the repo where the action is run from.
# Otherwise, previously cloned repos are removed.
- name: "Clone avro"
uses: actions/checkout@v4
with:
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
repository: 'BattelleEcology/avro'

# The branch, tag or SHA to checkout. When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Otherwise, uses the default branch.
ref: 'release-1.10.0'
#fetch-depth: '0'

# SSH key used to fetch the repository. The SSH key is configured with the local
# git config, which enables your scripts to run authenticated git commands. The
# post-job step removes the SSH key.
#
# We recommend using a service account with the least permissions necessary.
#
# [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
# Note: when generating the key, use the following: ssh-keygen -t ed25519 -C "git@github.com"
ssh-key: ${{ secrets.BE_GITHUB_KEY }}

# Relative path under $GITHUB_WORKSPACE to place the repository
path: './avro'

- name: Get short SHA
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v5

- name: Run IS ${{ env.MODULE_NAME }} unit tests
uses: ./.github/actions/run-IS-unit-tests
Loading
Loading