Skip to content

Commit

Permalink
Fixing deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
Schuemie authored and Schuemie committed Apr 6, 2021
1 parent 159ea96 commit eb9b1b2
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 47 deletions.
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Before you do a pull request, you should always **file an issue** and make sure the package maintainer agrees that it’s a problem, and is happy with your basic proposal for fixing it. We don’t want you to spend a bunch of time on something that we don’t think is a good idea.

Additional requirements for pull requests:

- Adhere to the [Developer Guidelines](https://ohdsi.github.io/MethodsLibrary/developerGuidelines.html) as well as the [OHDSI Code Style](https://ohdsi.github.io/MethodsLibrary/codeStyle.html).

- If possible, add unit tests for new functionality you add.

- Restrict your pull request to solving the issue at hand. Do not try to 'improve' parts of the code that are not related to the issue. If you feel other parts of the code need better organization, create a separate issue for that.

- Make sure you pass R check without errors and warnings before submitting.

- Always target the `develop` branch, and make sure you are up-to-date with the develop branch.

6 changes: 4 additions & 2 deletions .github/workflows/R_CMD_check_Hades.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get install libssh-dev
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE, INSTALL_opts=c("--no-multiarch"))
Expand Down Expand Up @@ -186,8 +187,9 @@ jobs:
if: ${{ env.new_version != '' }}
run: |
bash deploy.sh
- name: Push to BroadSea
if: ${{ env.new_version != '' }}
run: |
perl compare_version --tag && \
curl --data "build=true" -X POST https://registry.hub.docker.com/u/ohdsi/broadsea-methodslibrary/trigger/f0b51cec-4027-4781-9383-4b38b42dd4f5/
curl --data "build=true" -X POST https://registry.hub.docker.com/u/ohdsi/broadsea-methodslibrary/trigger/f0b51cec-4027-4781-9383-4b38b42dd4f5/
49 changes: 4 additions & 45 deletions compare_versions
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ $r_major = $1;
$r_minor = $2;
$r_mod = $3;

print "New R version: $r_major-$r_minor-$r_mod\n";

open(GIT_VERSION, "git describe --tags |");
$git = <GIT_VERSION>;
close(GIT_VERSION);
Expand All @@ -20,49 +18,10 @@ $git_major = $1;
$git_minor = $2;
$git_mod = $3;

print "Current git version: $git_major-$git_minor-$git_mod\n";

if ($r_major gt $git_major || $r_minor gt $git_minor || $r_mod gt $git_mod) {
$monotonic = 0;
if ($r_major > $git_major || $r_minor > $git_minor || $r_mod > $git_mod) {
$new_version = "v$r_major.$r_minor.$r_mod";
} else {
$monotonic = -1;
}

if ($monotonic != 0) {
print "Non-monotonically increasing versions numbers\n";
}

if ($monotonic == 0 & $ARGV[0] eq "--tag") {

open(GIT_TAG, "git tag v$r_major.$r_minor.$r_mod |");

$fail = 0;
while ($line = <GIT_TAG>) {
if ($line =~ /fatal/) {
$fail = 1;
}
print "tag: $line";
} # TODO Check for errors
close(GIT_TAG);
print "tag: END\n\n";

if ($fail eq 1) {
exit(-1);
}

$cmd = "git config user.name \"Marc A. Suchard\"; " .
"git config user.email \"msuchard@ucla.edu\"; " .
"git tag v$r_major.$r_minor.$r_mod ; " .
"git push -q https://\$GH_TOKEN\@github.com/OHDSI/\$PKG_NAME.git --tags";

print "cmd: $cmd\n";

open(GIT_PUSH, "$cmd |");
while ($line = <GIT_PUSH>) {
print "push: $line";
} # TODO Check for errors
close(GIT_PUSH);
print "push: END\n\n";
$new_version = "";
}

exit($monotonic);
print($new_version);
31 changes: 31 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -o errexit -o nounset
addToDrat(){
PKG_REPO=$PWD

## Build package tar ball
export PKG_TARBALL=$(ls *.tar.gz)

cd ..; mkdir drat; cd drat

## Set up Repo parameters
git init
git config user.name "Martijn Schuemie"
git config user.email "schuemie@ohdsi.org"
git config --global push.default simple

## Get drat repo
git remote add upstream "https://$GH_TOKEN@github.com/OHDSI/drat.git"
git fetch upstream 2>err.txt
git checkout gh-pages

## Link to local R packages
echo 'R_LIBS=~/Rlib' > .Renviron

Rscript -e "drat::insertPackage('$PKG_REPO/$PKG_TARBALL', \
repodir = '.', \
commit='GitHub Actions release: $PKG_TARBALL run $GITHUB_RUN_ID')"
git push

}
addToDrat

0 comments on commit eb9b1b2

Please sign in to comment.