Skip to content

Commit 7160afc

Browse files
authored
Update ci.yaml
1 parent b00cd25 commit 7160afc

File tree

1 file changed

+0
-131
lines changed

1 file changed

+0
-131
lines changed

.github/workflows/ci.yaml

-131
Original file line numberDiff line numberDiff line change
@@ -1,132 +1 @@
1-
# Continuous integration
2-
name: CI
31

4-
# Run in master and dev branches and in all pull requests to those branches
5-
on:
6-
push:
7-
branches: [ master ]
8-
pull_request:
9-
branches: [ master ]
10-
11-
env:
12-
DOCKER_IMAGE: ohdsi/webapi
13-
14-
jobs:
15-
# Build and test the code
16-
build:
17-
# The type of runner that the job will run on
18-
runs-on: ubuntu-latest
19-
20-
env:
21-
MAVEN_PROFILE: webapi-postgresql
22-
23-
# Steps represent a sequence of tasks that will be executed as part of the job
24-
steps:
25-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26-
- uses: actions/checkout@v2
27-
28-
- uses: actions/setup-java@v1
29-
with:
30-
java-version: 8
31-
32-
- name: Maven cache
33-
uses: actions/cache@v2
34-
with:
35-
# Cache gradle directories
36-
path: ~/.m2
37-
# Key for restoring and saving the cache
38-
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
39-
restore-keys: |
40-
${{ runner.os }}-maven-
41-
42-
- name: Build code
43-
run: mvn -B -DskipTests=true -DskipUnitTests=true -P${{ env.MAVEN_PROFILE }} package
44-
45-
- name: Test
46-
# Skipping unit and integration tests for now, because they keep failing.
47-
run: mvn -B -DskipUnitTests=true -DskipITtests=true -P${{ env.MAVEN_PROFILE }} test
48-
49-
# Check that the docker image builds correctly
50-
# Push to ohdsi/atlas:master for commits on master.
51-
docker:
52-
# The type of runner that the job will run on
53-
runs-on: ubuntu-latest
54-
55-
# Steps represent a sequence of tasks that will be executed as part of the job
56-
steps:
57-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
58-
- uses: actions/checkout@v2
59-
60-
- name: Cache Docker layers
61-
uses: actions/cache@v2
62-
with:
63-
path: /tmp/.buildx-cache
64-
key: ${{ runner.os }}-buildx-${{ github.sha }}
65-
restore-keys: |
66-
${{ runner.os }}-buildx-
67-
68-
# Add Docker labels and tags
69-
- name: Docker meta
70-
id: docker_meta
71-
uses: crazy-max/ghaction-docker-meta@v1
72-
with:
73-
images: ${{ env.DOCKER_IMAGE }}
74-
75-
# Setup docker build environment
76-
- name: Set up QEMU
77-
uses: docker/setup-qemu-action@v1
78-
- name: Set up Docker Buildx
79-
uses: docker/setup-buildx-action@v1
80-
81-
- name: Set build parameters
82-
id: build_params
83-
run: |
84-
echo "::set-output name=sha8::${GITHUB_SHA::8}"
85-
if [ ${{ github.event_name == 'pull_request' }} ]; then
86-
echo "::set-output name=push::false"
87-
echo "::set-output name=load::true"
88-
echo "::set-output name=platforms::linux/amd64"
89-
else
90-
echo "::set-output name=push::true"
91-
echo "::set-output name=load::false"
92-
echo "::set-output name=platforms::linux/amd64,linux/arm64"
93-
fi
94-
95-
- name: Login to DockerHub
96-
uses: docker/login-action@v1
97-
if: steps.build_params.outputs.push == 'true'
98-
with:
99-
username: ${{ secrets.DOCKER_HUB_USERNAME }}
100-
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
101-
102-
- name: Build and push
103-
id: docker_build
104-
uses: docker/build-push-action@v2
105-
with:
106-
context: ./
107-
file: ./Dockerfile
108-
cache-from: type=local,src=/tmp/.buildx-cache
109-
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
110-
platforms: ${{ steps.build_params.outputs.platforms }}
111-
push: ${{ steps.build_params.outputs.push }}
112-
load: ${{ steps.build_params.outputs.load }}
113-
build-args: |
114-
GIT_BRANCH=${{ steps.docker_meta.outputs.version }}
115-
GIT_COMMIT_ID_ABBREV=${{ steps.build_params.outputs.sha8 }}
116-
tags: ${{ steps.docker_meta.outputs.tags }}
117-
# Use runtime labels from docker_meta as well as fixed labels
118-
labels: |
119-
${{ steps.docker_meta.outputs.labels }}
120-
maintainer=Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com
121-
org.opencontainers.image.authors=Joris Borgdorff <[email protected]>, Lee Evans - www.ltscomputingllc.com
122-
org.opencontainers.image.vendor=OHDSI
123-
org.opencontainers.image.licenses=Apache-2.0
124-
125-
# If the image was pushed, we need to pull it again to inspect it
126-
- name: Pull image
127-
if: steps.build_params.outputs.push == 'true'
128-
run: docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
129-
130-
- name: Inspect image
131-
run: |
132-
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}

0 commit comments

Comments
 (0)