Skip to content

Commit

Permalink
Merge pull request #41 from dapperstats/feature
Browse files Browse the repository at this point in the history
workflows
  • Loading branch information
juniperlsimonis committed Dec 3, 2022
2 parents 6076e87 + 5fa7351 commit 22903c2
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 44 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# build and publish the docker image when the version is tagged under semantic versioning
# the cron job release tags are formatted using date-time stamp, not semantic version, allowing for differentiation
# based on https://github.com/docker/build-push-action

name: docker_image_publish

on:
push:
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main ]

env:
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}


jobs:
build_docker_image:
name: build docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log into ${{ env.REGISTRY }} except on PR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: dapperstats/salvage
tag-custom: latest
tag-semver: |
{{raw}}
- name: Build and push Docker image except on PR
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
# tags: dapperstats/salvage:latest
labels: ${{ steps.meta.outputs.labels }}
file: docker/Dockerfile
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
6 changes: 1 addition & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,4 @@ For more info, see the [GitHub repo](https://github.com/hadley/devtools) for the

## Attribution

This document is based on the [CONTRIBUTING
file](https://github.com/weecology/portalr/blob/master/CONTRIBUTING.md)
associated with the Beta release of the
[**portalr**](https://github.com/weecology/portalr/) package
and is used under the MIT License.
This document is based on the [CONTRIBUTING file](https://github.com/weecology/portalr/blob/main/CONTRIBUTING.md) associated with the Beta release of the [**portalr**](https://github.com/weecology/portalr/) package and is used under the MIT License.
14 changes: 12 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

Version numbers follow [Semantic Versioning](https://semver.org/).

# [v0.9.0](https://github.com/dapperstats/salvage/releases/tag/v0.9.0)
*2022-12-02*

## Shifting build workflow from travis to Github Actions
* cron workflow implementing the image-based pipeline
* tag workflow building and publishing image updates
* both workflows proceed but do not finish on PRs

## Move dockerfile into a folder
* Create a docker folder for holding dockerfile and readme

# [v0.8.0](https://github.com/dapperstats/salvage/releases/tag/v0.8.0)
*2020-01-29*
Expand Down Expand Up @@ -70,7 +80,7 @@ Version numbers follow [Semantic Versioning](https://semver.org/).
* `.travis.yml` leverages the non-interactive image to build only the `.csv` files (no `R` session is started)
* `update_github_data.bash` is what's run `after_success` for `cron` jobs only
* Uses @dapperdeploy as the user bpt
* Updates the master branch with the `.csv`s and `.txt` date log
* Updates the main branch with the `.csv`s and `.txt` date log
* Creates a tag based on the date, and deploys the tag as a release


Expand All @@ -87,7 +97,7 @@ Version numbers follow [Semantic Versioning](https://semver.org/).
## Updated `Docker` image
* [v0.2.0](https://hub.docker.com/layers/dapperstats/salvage/0.2.0/images/sha256-224f226aa90eb94a6730c7e95f5f8013bc2c150258d090c0df6e97769a3ef044)

## Inclusion of this here [`NEWS`](https://github.com/dapperstats/salvage/blob/master/NEWS.md)
## Inclusion of this here [`NEWS`](https://github.com/dapperstats/salvage/blob/main/NEWS.md)

# [v0.1.0](https://github.com/dapperstats/salvage/releases/tag/v0.1.0)
*2020-01-12*
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ One present focus is reliably generating data products that are more broadly acc
Each day, the [`/data` directory](https://github.com/dapperstats/salvage/blob/main/data) is populated with `.csv`s from an up-to-date "current" (1993 - Present) salvage database file (`Salvage_data_FTP.accdb`).
The `.csv` files are then used to update the [data presentation website (salvage.fish)](https://salvage.fish).

Updates are executed via [`cron` jobs](https://docs.travis-ci.com/user/cron-jobs/) on [`travis-ci`](https://travis-ci.org/dapperstats/salvage) using the `accessor` [`Docker`](https://www.docker.com) [software container](https://www.docker.com/resources/what-container).
Updates are executed via [`cron` jobs](https://en.wikipedia.org/wiki/Cron) on [`Github Actions`](https://github.com/dapperstats/salvage/actions) using the `accessor` [`Docker`](https://www.docker.com) [software container](https://www.docker.com/resources/what-container).
Code for the construction of the [`accessor` image](https://hub.docker.com/r/dapperstats/accessor) is available in a [separate repo](https://www.github.com/dapperstats/accessor).

Read more details on the [methods](https://github.com/dapperstats/salvage/blob/main/documents/methods.md), including how to run your own data [conversions](https://github.com/dapperstats/salvage/blob/main/documents/conversion.md).
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# [salvage.fish](https://www.salvage.fish)

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/dapperstats/salvage/main/LICENSE)
[![Lifecycle:maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3628045.svg)](https://doi.org/10.5281/zenodo.3628045)

Tools for smooth interactions with the [California Delta](https://en.wikipedia.org/wiki/Sacramento%E2%80%93San_Joaquin_River_Delta) [fish salvage monitoring database](https://wildlife.ca.gov/Conservation/Delta/Salvage-Monitoring).

This image includes the R-based script and functions for reading in the converted data files, analyzing, and vizualizing the results, including production of the website output.

The image is built using the [`Docker` GitHub Action](https://github.com/dapperstats/salvage/actions/workflows/docker-publish.yml) for any pull request in the `salvage` repository but is only pushed to [Docker Hub](https://hub.docker.com/repository/docker/dapperstats/salvage) upon creation of a release tagged under semantic versioning.

Two copies of the image are pushed to Docker Hub: one tagged with the release version and one tagged as "latest"..
18 changes: 9 additions & 9 deletions documents/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
## Data Access


<br>
### Retrieve the [Salvage Database]((https://filelib.wildlife.ca.gov/Public/salvage/)

### Retrieve the Salvage Database
Source data are freely available from the [California Department of Fish and Wildlife](https://wildlife.ca.gov) [Fish Salvage Monitoring Program](https://wildlife.ca.gov/Conservation/Delta/Salvage-Monitoring) on a [public data server](https://filelib.wildlife.ca.gov/Public/salvage/).

The bulk of the data access protocol involves converting the `.accdb` salvagae database file on the remote [ftp](ftp://ftp.dfg.ca.gov/salvage/) to a local set of `.csv` files named by the tables in the database.
The bulk of the data access protocol involves converting the `.accdb` salvage database file on the remote [server](https://wildlife.ca.gov/Conservation/Delta/Salvage-Monitoring) to a local set of `.csv` files named by the tables in the database.
We accomplish this in two lines of code by pulling and then running a stable [`Docker`](https://www.docker.com) [software container](https://www.docker.com/resources/what-container) that contains a set of `bash` scripts designed specifically for this task.
The specific image used for data access is called [`accessor`](https://hub.docker.com/r/dapperstats/accessor), is freely available on [Docker Hub](https://hub.docker.com/), and has default setting configured for the salvage database.
Code for the construction of the `accessor` image is available in its [repository](https://www.github.com/dapperstats/accessor).

For accessability and reproducibility, we provide an [up-to-date version of the salvage data](https://github.com/dapperstats/salvage/blob/master/data) as `.csv`s from the "current" (1993 - Present) salvage database file (`Salvage_data_FTP.accdb`).
For accessability and reproducibility, we provide an [up-to-date version of the salvage data](https://github.com/dapperstats/salvage/blob/main/data) as `.csv`s from the "current" (1993 - Present) salvage database file (`Salvage_data_FTP.accdb`).
The data can be downloaded via various methods from the repository, including from the website.

Updates to the data are executed via [`cron` jobs](https://docs.travis-ci.com/user/cron-jobs/) on [`travis-ci`](https://travis-ci.org/dapperstats/salvage) and pushed to GitHub as [tagged Releases](https://github.com/dapperstats/salvage/releases).
Updates are executed via [`cron` jobs](https://en.wikipedia.org/wiki/Cron) on [`Github Actions`](https://github.com/dapperstats/salvage/actions) and pushed to GitHub as [tagged Releases](https://github.com/dapperstats/salvage/releases).

<br>

Expand Down Expand Up @@ -43,9 +43,9 @@ sudo docker cp salvage:/data .

### Bring the Data into R

An additional conversion makes the data available in [`R`](https://www.r-project.org/) as a `list` of `data.frames` that is directly analagous to the `.accdb` database of tables.
An additional conversion makes the data available in [`R`](https://www.r-project.org/) as a `list` of `data.frames` that is directly analogous to the `.accdb` database of tables.

The reading into R is conducted via functions included in the `r_functions.R` script in the [`accessor` image](https://hub.docker.com/r/dapperstats/accessor) and available in the [public code repository](https://github.com/dapperstats/accessor/tree/master/scripts).
The reading into R is conducted via functions included in the `r_functions.R` script in the [`accessor` image](https://hub.docker.com/r/dapperstats/accessor) and available in the [public code repository](https://github.com/dapperstats/accessor/tree/main/scripts).

<br>

Expand Down Expand Up @@ -102,11 +102,11 @@ The resulting `database` object is a named `list` of the database's tables, read
Data preparation code is *in development*!

Having brought the data into R as-is, we can now prepare them for summaries and analyses.
We use the functions included in the [`salvage_functions.R` R script](https://github.com/dapperstats/salvage/blob/master/scripts/salvage_functions.R), which is included within the and [`salvage` docker image](https://hub.docker.com/r/dapperstats/salvage), which provides a stable runtime environment for the analyses and output generation (including website rendering).
We use the functions included in the [`salvage_functions.R` R script](https://github.com/dapperstats/salvage/blob/main/scripts/salvage_functions.R), which is included within the and [`salvage` docker image](https://hub.docker.com/r/dapperstats/salvage), which provides a stable runtime environment for the analyses and output generation (including website rendering).

<br>

## Continuous Deployment

The data and output are updated daily via [`cron` jobs](https://docs.travis-ci.com/user/cron-jobs/) on [`travis-ci`](https://travis-ci.org/dapperstats/salvage) with a recipe (a.k.a. job lifecycle) described by the [`.travis.yml` file](https://github.com/dapperstats/salvage/blob/master/.travis.yml).
Updates are executed via [`cron` jobs](https://en.wikipedia.org/wiki/Cron) on [`Github Actions`](https://github.com/dapperstats/salvage/actions) with a workflow described by the [`docker_cron.yaml` file](https://github.com/dapperstats/salvage/blob/main/.github/workflows/docker_cron.yaml).

0 comments on commit 22903c2

Please sign in to comment.