Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Automated build #3

Closed
wants to merge 5 commits into from
Closed
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
80 changes: 80 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Continuous integration
name: CI

# Run in master and dev branches and in all pull requests to those branches
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
# Build and test the code
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Caches NPM dependencies, as long as the package-lock.json is not modified
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12

- name: Build code
run: npm run build

# Check that the docker image builds correctly
# Push to ohdsi/atlas:master for commits on master.
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ohdsi/atlas

# Setup docker build environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }} # Push the master branch only
tags: ${{ steps.docker_meta.outputs.tags }}
# Use runtime labels from docker_meta as well as fixed labels
labels: |
${{ steps.docker_meta.outputs.labels }}
org.opencontainers.image.authors="Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com"
org.opencontainers.image.vendor="OHDSI"
104 changes: 104 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Create release files
name: Release

on:
release:
types: [published]

jobs:

upload:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12

- name: Cache
uses: actions/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: |
~/.gradle/caches/jars-3
~/.gradle/caches/modules-2/files-2.1/
~/.gradle/caches/modules-2/metadata-2.96/
~/.gradle/native
~/.gradle/wrapper
# An explicit key for restoring and saving the cache
key: ${{ runner.os }}-gradle
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

# Compile the code
- name: Build code
run: npm run build:docker

- name: Make distribution
run: |
mkdir atlas
cp -r LICENSE README.md node_modules js images index.html atlas
zip -r atlas.zip atlas

# Upload it to GitHub
- name: Upload to GitHub
uses: AButler/[email protected]
with:
files: 'atlas.zip'
repo-token: ${{ secrets.GITHUB_TOKEN }}

# Build and push tagged release docker image to
# ohdsi/atlas:<version> and ohdsi/atlas:latest.
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2

# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ohdsi/atlas
tag-match: v(.*)
tag-match-group: 1

# Setup docker build environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
# Allow running the image on the architectures supported by nginx-unprivileged:alpine.
platforms: linux/amd64,linux/arm/v6,linux/386,linux/ppc64le,linux/s390x
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
# Use runtime labels from docker_meta as well as fixed labels
labels: |
${{ steps.docker_meta.outputs.labels }}
org.opencontainers.image.authors="Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com"
org.opencontainers.image.vendor="OHDSI"
17 changes: 3 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,13 @@ RUN RUN find . -type f "(" \
# Production Nginx image
FROM nginxinc/nginx-unprivileged:1.19-alpine

# Published version of Atlas
ARG VERSION=SNAPSHOT
# Datetime that this image was created in ISO 8601 format
ARG CREATED=SNAPSHOT
# Git revision
ARG REVISION=SNAPSHOT

LABEL org.opencontainers.image.title="OHDSI ATLAS"
LABEL org.opencontainers.image.title="OHDSI-Atlas"
LABEL org.opencontainers.image.authors="Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.description="ATLAS is an open source software tool for researchers \
to conduct scientific analyses on standardized observational data converted to the \
OMOP Common Data Model. It is served as a static site by Nginx."
LABEL org.opencontainers.image.description="ATLAS is an open source software tool for researchers to \
conduct scientific analyses on standardized observational data"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL org.opencontainers.image.vendor="OHDSI"
LABEL org.opencontainers.image.source="https://github.com/OHDSI/Atlas"
LABEL org.opencontainers.image.created="${CREATED}"
LABEL org.opencontainers.image.revision="${REVISION}"

# URL where WebAPI can be queried by the client
ENV WEBAPI_URL=http://localhost:8080/WebAPI/
Expand Down