From 1d0f8c133a355ccac42450662211197299598043 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Tue, 17 Nov 2020 10:49:13 +0100 Subject: [PATCH 1/5] Initial CI setup --- .github/workflows/ci.yaml | 72 +++++++++++++++++++++++++ .github/workflows/release.yaml | 97 ++++++++++++++++++++++++++++++++++ Dockerfile | 10 ---- 3 files changed, 169 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..ba10ac0fa --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,72 @@ +# Continuous integration, including test and integration test +name: CI Node + +# 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 + - 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 + + # Compile the code + - name: Install dependencies + working-directory: ./radar-app-config-frontend + run: npm run build + + docker: + - uses: actions/checkout@v2 + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: ohdsi/atlas + + - 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' }} + tags: ${{ steps.docker_meta.outputs.labels }} + labels: | + ${{ steps.docker_meta.outputs.labels }} + org.opencontainers.image.title="OHDSI ATLAS" + org.opencontainers.image.authors="Joris Borgdorff , Lee Evans - www.ltscomputingllc.com" + 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." + org.opencontainers.image.licenses="Apache-2.0" + org.opencontainers.image.vendor="OHDSI" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..d6d3dff42 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,97 @@ +# 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/cache@v2.0.0 + 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/upload-release-assets@v2.0 + with: + files: 'atlas.zip' + repo-token: ${{ secrets.GITHUB_TOKEN }} + + docker: + - uses: actions/checkout@v2 + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: ohdsi/atlas + tag-match: v(.*) + tag-match-group: 1 + + - 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 + platforms: linux/amd64,linux/arm/v6,linux/386,linux/ppc64le,linux/s390x + push: true + tags: ${{ steps.docker_meta.outputs.labels }} + labels: | + ${{ steps.docker_meta.outputs.labels }} + org.opencontainers.image.title="OHDSI ATLAS" + org.opencontainers.image.authors="Joris Borgdorff , Lee Evans - www.ltscomputingllc.com" + 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." + org.opencontainers.image.licenses="Apache-2.0" + org.opencontainers.image.vendor="OHDSI" diff --git a/Dockerfile b/Dockerfile index 42790e932..3462e5ade 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,24 +28,14 @@ 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.authors="Joris Borgdorff , 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.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/ From 7af2261dc8b801149dae8b5df08f62be8b88890a Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Tue, 17 Nov 2020 11:45:39 +0100 Subject: [PATCH 2/5] Fix indentation --- .github/workflows/ci.yaml | 9 +++- .github/workflows/release.yaml | 75 ++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ba10ac0fa..0c5410a5b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,12 @@ jobs: run: npm run build docker: - - uses: actions/checkout@v2 + # 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 - name: Docker meta id: docker_meta uses: crazy-max/ghaction-docker-meta@v1 @@ -60,7 +65,7 @@ jobs: context: ./ file: ./Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.docker_meta.outputs.labels }} + tags: ${{ steps.docker_meta.outputs.tags }} labels: | ${{ steps.docker_meta.outputs.labels }} org.opencontainers.image.title="OHDSI ATLAS" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d6d3dff42..79b0198c9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -57,41 +57,46 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} docker: - - uses: actions/checkout@v2 - - name: Docker meta - id: docker_meta - uses: crazy-max/ghaction-docker-meta@v1 - with: - images: ohdsi/atlas - tag-match: v(.*) - tag-match-group: 1 + # The type of runner that the job will run on + runs-on: ubuntu-latest - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - uses: actions/checkout@v2 + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: ohdsi/atlas + tag-match: v(.*) + tag-match-group: 1 + + - 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: 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 - platforms: linux/amd64,linux/arm/v6,linux/386,linux/ppc64le,linux/s390x - push: true - tags: ${{ steps.docker_meta.outputs.labels }} - labels: | - ${{ steps.docker_meta.outputs.labels }} - org.opencontainers.image.title="OHDSI ATLAS" - org.opencontainers.image.authors="Joris Borgdorff , Lee Evans - www.ltscomputingllc.com" - 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." - org.opencontainers.image.licenses="Apache-2.0" - org.opencontainers.image.vendor="OHDSI" + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: ./ + file: ./Dockerfile + platforms: linux/amd64,linux/arm/v6,linux/386,linux/ppc64le,linux/s390x + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: | + ${{ steps.docker_meta.outputs.labels }} + org.opencontainers.image.title="OHDSI ATLAS" + org.opencontainers.image.authors="Joris Borgdorff , Lee Evans - www.ltscomputingllc.com" + 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." + org.opencontainers.image.licenses="Apache-2.0" + org.opencontainers.image.vendor="OHDSI" From 1a40cf763216d9ce0f16755c7ebf1730452354d3 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Tue, 17 Nov 2020 11:50:28 +0100 Subject: [PATCH 3/5] Add CI docs --- .github/workflows/ci.yaml | 3 +++ .github/workflows/release.yaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0c5410a5b..2b9a1d9af 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,12 +41,15 @@ jobs: # 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 + # Setup docker build environment - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 79b0198c9..312de9281 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -63,6 +63,8 @@ jobs: # 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 @@ -71,6 +73,7 @@ jobs: 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 From 6ddc23ceb077e0e8cc3cfb4d3c50235f74444bad Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Tue, 17 Nov 2020 12:01:11 +0100 Subject: [PATCH 4/5] Added more docs --- .github/workflows/ci.yaml | 13 +++++++++---- .github/workflows/release.yaml | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2b9a1d9af..4c9c8a162 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,28 +18,32 @@ jobs: 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 - # Compile the code - - name: Install dependencies - working-directory: ./radar-app-config-frontend + - 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 @@ -67,8 +71,9 @@ jobs: with: context: ./ file: ./Dockerfile - push: ${{ github.event_name != 'pull_request' }} + 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.title="OHDSI ATLAS" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 312de9281..7b979385c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -56,6 +56,8 @@ jobs: files: 'atlas.zip' repo-token: ${{ secrets.GITHUB_TOKEN }} + # Build and push tagged release docker image to + # ohdsi/atlas: and ohdsi/atlas:latest. docker: # The type of runner that the job will run on runs-on: ubuntu-latest @@ -91,9 +93,11 @@ jobs: 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.title="OHDSI ATLAS" From bcab7eba4795a83a478f9cfb71ede9a0b32b6064 Mon Sep 17 00:00:00 2001 From: Joris Borgdorff Date: Tue, 17 Nov 2020 12:06:05 +0100 Subject: [PATCH 5/5] Fixed CI name and labels --- .github/workflows/ci.yaml | 9 ++------- .github/workflows/release.yaml | 5 ----- Dockerfile | 7 +++---- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4c9c8a162..87bce3af0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,5 @@ -# Continuous integration, including test and integration test -name: CI Node +# Continuous integration +name: CI # Run in master and dev branches and in all pull requests to those branches on: @@ -76,10 +76,5 @@ jobs: # Use runtime labels from docker_meta as well as fixed labels labels: | ${{ steps.docker_meta.outputs.labels }} - org.opencontainers.image.title="OHDSI ATLAS" org.opencontainers.image.authors="Joris Borgdorff , Lee Evans - www.ltscomputingllc.com" - 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." - org.opencontainers.image.licenses="Apache-2.0" org.opencontainers.image.vendor="OHDSI" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7b979385c..1f33c6883 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -100,10 +100,5 @@ jobs: # Use runtime labels from docker_meta as well as fixed labels labels: | ${{ steps.docker_meta.outputs.labels }} - org.opencontainers.image.title="OHDSI ATLAS" org.opencontainers.image.authors="Joris Borgdorff , Lee Evans - www.ltscomputingllc.com" - 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." - org.opencontainers.image.licenses="Apache-2.0" org.opencontainers.image.vendor="OHDSI" diff --git a/Dockerfile b/Dockerfile index 3462e5ade..aa626ee93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,11 +28,10 @@ RUN RUN find . -type f "(" \ # Production Nginx image FROM nginxinc/nginx-unprivileged:1.19-alpine -LABEL org.opencontainers.image.title="OHDSI ATLAS" +LABEL org.opencontainers.image.title="OHDSI-Atlas" LABEL org.opencontainers.image.authors="Joris Borgdorff , Lee Evans - www.ltscomputingllc.com" -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"