Skip to content

Commit 99fce1a

Browse files
committed
define GitHub action for CI
1 parent b74ffb7 commit 99fce1a

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
19+
name: Continuous Integration
20+
21+
on:
22+
push:
23+
branches: [ master ]
24+
tags: [ '*' ]
25+
pull_request:
26+
branches: [ master ]
27+
types: [ opened, synchronize, reopened ]
28+
schedule:
29+
- cron: '30 1 * * 1,3,5'
30+
31+
permissions: read-all
32+
33+
jobs:
34+
ci:
35+
runs-on: ubuntu-22.04
36+
env:
37+
PUSH_NIGHTLY: ${{ (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master' }}
38+
PUSH_RELEASE: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
39+
steps:
40+
# Checkout just this repo and run scanCode before we do anything else
41+
- name: Checkout runtime repo
42+
uses: actions/checkout@v3
43+
with:
44+
path: runtime
45+
- name: Scan Code
46+
uses: apache/openwhisk-utilities/scancode@master
47+
48+
# Install core OpenWhisk artifacts needed to build/test anything else
49+
- name: Checkout OpenWhisk core repo
50+
uses: actions/checkout@v3
51+
with:
52+
repository: apache/openwhisk
53+
path: core
54+
- name: Setup Java
55+
uses: actions/setup-java@v3
56+
with:
57+
distribution: 'temurin'
58+
java-version: '11'
59+
- name: Compile and Install Core OpenWhisk
60+
working-directory: core
61+
run: |
62+
./gradlew :tests:compileTestScala
63+
./gradlew install
64+
65+
# Build this repository
66+
- name: Build Runtime
67+
working-directory: runtime
68+
run: |
69+
./gradlew distDocker
70+
71+
# Test this repository
72+
- name: Test Runtime
73+
working-directory: runtime
74+
run: |
75+
./gradlew :tests:checkScalafmtAll
76+
./gradlew :tests:testPython3
77+
78+
# Conditionally publish runtime images to DockerHub
79+
# Important: naming convention for release tags is runtime@version
80+
- name: Docker Login
81+
if: ${{ env.PUSH_NIGHTLY == 'true' || env.PUSH_RELEASE == 'true' }}
82+
uses: docker/login-action@v2
83+
with:
84+
username: ${{ secrets.DOCKERHUB_USER_OPENWHISK }}
85+
password: ${{ secrets.DOCKERHUB_TOKEN_OPENWHISK }}
86+
- name: Push Nightly Images
87+
if: ${{ env.PUSH_NIGHTLY == 'true' }}
88+
working-directory: runtime
89+
run: |
90+
SHORT_COMMIT=$(git rev-parse --short "$GITHUB_SHA")
91+
./gradlew :core:python3Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
92+
./gradlew :core:python3Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
93+
./gradlew :core:python36AiAction:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
94+
./gradlew :core:python36AiAction:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
95+
./gradlew :core:python39Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
96+
./gradlew :core:python39Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
97+
./gradlew :core:python310Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
98+
./gradlew :core:python310Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
99+
- name: Push Release Images
100+
if: ${{ env.PUSH_RELEASE == 'true' }}
101+
working-directory: runtime
102+
run: |
103+
RUNTIME_VERSION=${GITHUB_REF_NAME%@*}
104+
IMAGE_TAG=${GITHUB_REF_NAME##*@}
105+
if [ ${RUNTIME_VERSION} == "3" ]; then
106+
RUNTIME="python3Action"
107+
elif [ ${RUNTIME_VERSION} == "3-ai" ]; then
108+
RUNTIME="python36AiAction"
109+
elif [ ${RUNTIME_VERSION} == "39" ]; then
110+
RUNTIME="python39Action"
111+
elif [ ${RUNTIME_VERSION} == "310" ]; then
112+
RUNTIME="python310Action"
113+
fi
114+
./gradlew :core:$RUNTIME:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$IMAGE_TAG

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy