Skip to content

Commit

Permalink
Merge pull request #24 from alephnull7/master
Browse files Browse the repository at this point in the history
Version 1.0.7 changes documentation & GitHub action workflow for automated releases
  • Loading branch information
michaelgruenstaeudl authored Feb 1, 2024
2 parents a26fd66 + 33e684b commit 354a65d
Show file tree
Hide file tree
Showing 15 changed files with 206 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
^.*\.Rproj$
^\.Rproj\.user$
^tests/
^\.github/
26 changes: 26 additions & 0 deletions .github/scripts/update_version_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
import sys
import re


def main():
r_directory = "../../R/"
current_timestamp = sys.argv[1]
version_comment = f"#version=\"{current_timestamp}\"\n"

for filename in os.listdir(r_directory):
file_path = os.path.join(r_directory, filename)

if os.path.isfile(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()

if len(lines) >= 4 and re.match("^#version", lines[3]):
lines[3] = version_comment
with open(file_path, 'w') as file:
file.writelines(lines)
print(f"Version comment updated to current UTC: {filename}")


if __name__ == "__main__":
main()
6 changes: 6 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
on:
push:
branches: [main, master]
paths:
- "R/**"
- "tests/**"
pull_request:
branches: [main, master]
paths:
- "R/**"
- "tests/**"

name: R-CMD-check

Expand Down
155 changes: 155 additions & 0 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
paths: ["CHANGELOG.md"]

name: create-release

jobs:
release-documentation:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CHANGELOG: "CHANGELOG.md"
DESCRIPTION: "DESCRIPTION"
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- uses: actions/checkout@v3

- name: Extract release version from first level 4 heading
id: extract-version
run: |
version=$(grep -oP '####[^0-9]*\K\d+\.\d+\.\d+' -m 1 $CHANGELOG)
echo "version=$version" >> $GITHUB_ENV
echo "version=$version" >> $GITHUB_OUTPUT
echo "Version: $version"
- name: Get current UTC timestamp
id: get-timestamp
run: |
timestamp=$(date -u +"%Y.%m.%d.%H%M")
echo "timestamp=$timestamp" >> $GITHUB_ENV
echo "Timestamp: $timestamp"
- name: Standardize first level 4 heading
id: update-change-header
run: |
timestamp=$(echo "${{ env.timestamp }}" | awk -F'.' '{print $1"."$2"."$3}')
sed -i "0,/^####.*$/s/^####.*$/#### Version ${{ env.version }} \($timestamp\)/" $CHANGELOG
echo "CHANGELOG Timestamp: $timestamp"
- name: Update DESCRIPTION `Version` and `Date`
id: update-description
run: |
timestamp=$(echo "${{ env.timestamp }}" | awk -F'.' '{print $1"-"$2"-"$3}')
sed -i "s|^Date:.*$|Date: $timestamp|" $DESCRIPTION
sed -i "s|^Version:.*$|Version: ${{ env.version }}|" $DESCRIPTION
echo "DESCRIPTION Timestamp: $timestamp"
- name: Update `version` comments on R files
id: update-r-version-comment
run: |
cd .github/scripts
chmod +x update_version_tag.py
python update_version_tag.py ${{ env.timestamp }}
- name: Commit and push changes
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add ./R/*.R
git add DESCRIPTION
git add CHANGELOG.md
git commit -m "Updated documentation for release" || echo "No changes to commit"
git pull --ff-only
git push origin
release-build:
runs-on: ubuntu-latest
needs: release-documentation
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CHANGELOG: "CHANGELOG.md"
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-tinytex@v2
- run: tlmgr --version

- name: Install additional LaTeX packages
run: |
tlmgr install preprint
tlmgr install listings
tlmgr install tcolorbox
tlmgr install pgf
tlmgr install environ
tlmgr install tikzfill
tlmgr install pdfcol
tlmgr install grfext
tlmgr list --only-installed
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: "release"
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Build R package
run: |
R CMD build --compact-vignettes=gs+qpdf .
tar_file="$(find . -maxdepth 1 -type f -name '*.tar.gz' -print -quit | sed 's|^\./||')"
artifacts="artifacts"
mkdir $artifacts
mv $tar_file "$artifacts/"
echo "tar_file=$artifacts/$tar_file" >> $GITHUB_ENV
echo "asset_name=$tar_file" >> $GITHUB_ENV
- name: Make release properties
id: release-fields
run: |
version="${{ needs.release-documentation.outputs.version }}"
echo "version=$version" >> $GITHUB_ENV
echo "Version: $version"
tag="v${version}"
echo "tag=$tag" >> $GITHUB_ENV
echo "Tag: $tag"
name="Version ${version}"
echo "name=$name" >> $GITHUB_ENV
echo "Name: $name"
body="$(awk '/^\*.*$/{print; next} /^####/{count++; if(count==2) exit}' $CHANGELOG)"
echo "body<<EOF" >> "$GITHUB_ENV"
echo "$body" >> "$GITHUB_ENV"
echo "EOF" >> "$GITHUB_ENV"
echo "Body: $body"
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.tag }}
release_name: ${{ env.name }}
draft: false
prerelease: false
body: |
${{ env.body }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ env.tar_file }}
asset_name: ${{ env.asset_name }}
asset_content_type: application/gzip
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
CHANGELOG
---------

#### Version 1.0.7 (2024.01.25)
* list by Greg here
#### Version 1.0.7 (2024.02.01)
* More robust parsing of feature sequence locations using INSDC standards
* Exception handling for attempted reading of GenBank data
* "Repair" GenBank data with unqualified features to handle `read.gb` bug
* Preemptively checks for presence of data property necessary for specified analysis, with `logger` info in case of issues

#### Version 1.0.6 (2024.01.07)
* Moved functions reg. IRs, quadripartite structure into separate file
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: PACVr
Version: 1.0.7
Date: 2024-01-25
Date: 2024-02-01
Title: Plastome Assembly Coverage Visualization
Authors@R: c(person("Gregory", "Smith", role=c("ctb")),
person("Nils", "Jenke", role=c("ctb")),
Expand Down
2 changes: 1 addition & 1 deletion R/IRoperations.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"

checkIREquality <- function(gbkData, regions, dir, sample_name) {
gbkSeq <- read.gbSeq(gbkData)
Expand Down
2 changes: 1 addition & 1 deletion R/PACVr.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"

PACVr.read.gb <- function(gbkFile) {
gbkRaw <- getGbkRaw(gbkFile)
Expand Down
2 changes: 1 addition & 1 deletion R/customizedRCircos.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"


# The following R functions were taken from the R package RCircos and then modified.
Expand Down
2 changes: 1 addition & 1 deletion R/customizedRead.gb.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"

read.gbWithHandling <- function(gbkRaw, count=0) {
gbkData <- tryCatch({
Expand Down
2 changes: 1 addition & 1 deletion R/generatePlotData.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"

CovCalc <- function(bamFile, windowSize = 250) {
# Calculates coverage of a given bam file and stores data in data.frame format
Expand Down
2 changes: 1 addition & 1 deletion R/helpers.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"

read.gb2DF <- function(gbkData, regionsCheck) {
fileDF <- data.frame()
Expand Down
2 changes: 1 addition & 1 deletion R/parseData.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"

ExtractAllGenes <- function(gbkDataDF) {
# Function to extract gene information from Genbank flatfile data
Expand Down
2 changes: 1 addition & 1 deletion R/quadripartiteOperations.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"

FilterByKeywords <- function(allRegions, where) {
# Function to filter list based on genomic keywords
Expand Down
2 changes: 1 addition & 1 deletion R/visualizeWithRCircos.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env RScript
#contributors=c("Gregory Smith", "Nils Jenke", "Michael Gruenstaeudl")
#email="m_gruenstaeudl@fhsu.edu"
#version="2024.01.25.1500"
#version="2024.02.01.0322"

visualizeWithRCircos <- function(plotTitle,
genes,
Expand Down

0 comments on commit 354a65d

Please sign in to comment.