Skip to content

Commit 6b61835

Browse files
authored
Improve action workflow configuration (#2307)
* Improve action workflow configuration * Improve again * Cleanup release related event for package and docker * Update cache of docker images
1 parent 407d36a commit 6b61835

File tree

7 files changed

+108
-224
lines changed

7 files changed

+108
-224
lines changed

.github/workflows/build.yaml

-104
This file was deleted.

.github/workflows/docker.yaml

+10-24
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ name: docker
33
on:
44
schedule:
55
- cron: '0 18 * * *'
6-
push:
7-
branches:
8-
- 'v[0-9]+.*'
9-
paths-ignore:
10-
- 'docs/**'
11-
- '**.md'
126

137
jobs:
148
docker:
@@ -23,24 +17,16 @@ jobs:
2317
- console
2418
- graph
2519
steps:
26-
- uses: azure/docker-login@v1
27-
with:
28-
username: ${{ secrets.DOCKER_USERNAME }}
29-
password: ${{ secrets.DOCKER_PASSWORD }}
3020
- uses: actions/checkout@v2
3121
with:
3222
fetch-depth: 1
33-
- name: Compute tag
34-
id: tag
35-
run: |
36-
[[ "${{ github.event_name }}" == "push" ]] && \
37-
echo "::set-output name=tag::$(cut -d/ -f3 <<< ${{ github.ref }})" || \
38-
echo "::set-output name=tag::nightly"
39-
shell: bash
40-
- name: Build image
41-
env:
42-
IMAGE_NAME: ${{ secrets.DOCKER_USERNAME }}/nebula-${{ matrix.service }}:${{ steps.tag.outputs.tag }}
43-
run: |
44-
docker build -t ${IMAGE_NAME} -f docker/Dockerfile.${{ matrix.service }} .
45-
docker push ${IMAGE_NAME}
46-
shell: bash
23+
- name: Build and push Docker images
24+
uses: docker/build-push-action@v1
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
repository: ${{ secrets.DOCKER_USERNAME }}/nebula-${{ matrix.service }}
29+
tags: nightly
30+
dockerfile: docker/Dockerfile.${{ matrix.service }}
31+
cache_froms: vesoft/nebula-dev:centos7,centos:7
32+
add_git_labels: true

.github/workflows/package.yaml

+13-25
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ name: package
33
on:
44
schedule:
55
- cron: '0 18 * * *'
6-
push:
7-
# Releases are all branch based, and the branch package here is for testing.
8-
branches:
9-
- 'v[0-9]+.*'
10-
paths-ignore:
11-
- 'docs/**'
12-
- '**.md'
6+
7+
defaults:
8+
run:
9+
shell: bash
1310

1411
jobs:
1512
package:
@@ -28,25 +25,16 @@ jobs:
2825
- uses: actions/checkout@v1
2926
- name: Package
3027
run: ./package/package.sh
31-
shell: bash
32-
- name: Compute version
33-
id: version
34-
env:
35-
CPACK_OUTPUT_DIR: build/cpack_output
36-
run: |
37-
[[ "${{ github.event_name }}" == "push" ]] && \
38-
echo "::set-output name=version::$(cut -d/ -f3 <<< ${{ github.ref }})" || \
39-
(echo "::set-output name=version::nightly"
40-
cd $CPACK_OUTPUT_DIR && \
41-
filename=$(find . -type f \( -iname \*.deb -o -iname \*.rpm \) -exec basename {} \;)
42-
echo "::set-output name=filepath::$CPACK_OUTPUT_DIR/$filename")
43-
shell: bash
44-
- name: upload oss
45-
if: github.event_name != 'push'
28+
- name: Upload oss
4629
run: |
47-
./ci/scripts/upload-oss.sh OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} OSS_ID=${{ secrets.OSS_ID }} OSS_SECRET=${{ secrets.OSS_SECRET }} filepath=${{ steps.version.outputs.filepath }} nightly=true
48-
shell: bash
30+
filepath=$(find build/cpack_output -type f \( -iname \*.deb -o -iname \*.rpm \))
31+
./ci/scripts/upload-oss.sh \
32+
OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} \
33+
OSS_ID=${{ secrets.OSS_ID }} \
34+
OSS_SECRET=${{ secrets.OSS_SECRET }} \
35+
filepath=$filepath \
36+
nightly=true
4937
- uses: actions/upload-artifact@v1
5038
with:
51-
name: ${{ matrix.os }}-${{ steps.version.outputs.version }}
39+
name: ${{ matrix.os }}-nightly
5240
path: build/cpack_output

.github/workflows/pull_request.yaml

+43-42
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@ on:
77
- master
88
- 'v[0-9]+.*'
99

10+
defaults:
11+
run:
12+
shell: bash
13+
1014
jobs:
1115
lint:
1216
name: cpplint
13-
if: contains(join(toJson(github.event.pull_request.labels.*.name)), 'ready-for-testing')
17+
if: ${{ contains(github.event.pull_request.labels.*.name, 'ready-for-testing') }}
1418
runs-on: ubuntu-latest
1519
steps:
1620
- uses: actions/checkout@v2
1721
with:
18-
fetch-depth: 2
22+
fetch-depth: 1
23+
- uses: jitterbit/get-changed-files@v1
24+
id: diff
1925
- name: Cpplint
2026
run: |
21-
cd .linters/cpp && ln -snf hooks/pre-commit.sh
22-
./pre-commit.sh $(git --no-pager diff --name-only $(git log --oneline -n 1 | cut -d ' ' -f 1,5) | sed -E 's/(.*)/..\/..\/\1/g')
27+
ln -snf $PWD/.linters/cpp/hooks/pre-commit.sh $PWD/.linters/cpp/pre-commit.sh
28+
.linters/cpp/pre-commit.sh ${{ steps.diff.outputs.all }}
2329
2430
build:
2531
name: build
@@ -40,62 +46,58 @@ jobs:
4046
container:
4147
image: vesoft/nebula-dev:${{ matrix.os }}
4248
env:
43-
CCACHE_DIR: /tmp/ccache/${{ matrix.os }}-${{ matrix.compiler }}
44-
options: --mount type=tmpfs,destination=/tmp/ccache,tmpfs-size=1073741824 -v /tmp/ccache/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/${{ matrix.os }}-${{ matrix.compiler }} -v /etc/action/secrets/codecov:/etc/action/secrets/codecov
49+
CCACHE_DIR: /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
50+
CCACHE_MAXSIZE: 1G
51+
volumes:
52+
- /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
53+
options: --mount type=tmpfs,destination=/tmp/ccache/nebula,tmpfs-size=1073741824 --cap-add=SYS_PTRACE
4554
steps:
4655
- uses: actions/checkout@v2
4756
with:
48-
fetch-depth: 2
49-
- name: Ignore only documents changes
50-
id: ignore_docs
51-
run: |
52-
num_source_files=$(git --no-pager diff --name-only $(git log --oneline -n 1 | cut -d' ' -f1,5) | grep '^src\|^CMakeLists.txt\|^cmake\|^.github/workflows' | wc -l)
53-
echo "::set-output name=num_source_files::${num_source_files}"
57+
fetch-depth: 1
5458
- name: Prepare environment
5559
run: |
56-
[ -f "$CCACHE_DIR/ccache.conf" ] || cp ci/ccache.conf "$CCACHE_DIR"
5760
[ -d build/ ] && rm -rf build/* || mkdir -p build
58-
shell: bash
59-
- name: CMake with gcc-9.2
60-
if: matrix.compiler == 'gcc-9.2' && matrix.os != 'centos7' && steps.ignore_docs.outputs.num_source_files != 0
61-
run: |
62-
cmake -DCMAKE_BUILD_TYPE=Release -B build/
63-
- name: CMake with Coverage
64-
if: matrix.compiler == 'gcc-9.2' && matrix.os == 'centos7' && steps.ignore_docs.outputs.num_source_files != 0
61+
- name: CMake
6562
run: |
66-
cmake -DENABLE_COVERAGE=ON -B build/
67-
- name: CMake with clang-9
68-
if: matrix.compiler == 'clang-9' && steps.ignore_docs.outputs.num_source_files != 0
69-
run: |
70-
cmake \
71-
-DCMAKE_CXX_COMPILER=clang++ \
72-
-DCMAKE_C_COMPILER=clang \
73-
-DENABLE_ASAN=on \
74-
-B build/
63+
case ${{ matrix.os }} in
64+
centos7)
65+
# build with coverage
66+
cmake -DENABLE_COVERAGE=ON -B build/
67+
;;
68+
ubuntu1804)
69+
case ${{ matrix.compiler }} in
70+
gcc*)
71+
# build with release type
72+
cmake -DCMAKE_BUILD_TYPE=Release -B build/
73+
;;
74+
clang*)
75+
cmake \
76+
-DCMAKE_CXX_COMPILER=clang++ \
77+
-DCMAKE_C_COMPILER=clang \
78+
-DENABLE_ASAN=on \
79+
-B build/
80+
;;
81+
esac
82+
;;
83+
esac
7584
- name: Make
76-
if: steps.ignore_docs.outputs.num_source_files != 0
77-
run: |
78-
cmake --build build/ -j $(nproc)
85+
run: cmake --build build/ -j $(($(nproc)/2+1))
7986
- name: CTest with multiple threads
80-
if: steps.ignore_docs.outputs.num_source_files != 0
8187
timeout-minutes: 15
82-
continue-on-error: false
8388
working-directory: build
8489
env:
85-
ASAN_SYMBOLIZER_PATH: /opt/vesoft/toolset/clang/9.0.0/bin/llvm-symbolizer
8690
ASAN_OPTIONS: fast_unwind_on_malloc=1
8791
run: |
8892
ctest \
89-
-j $(($(nproc)/2)) \
93+
-j $(($(nproc)/2+1)) \
9094
--timeout 400 \
9195
--output-on-failure
92-
shell: bash
9396
- name: CTest with single thread
94-
if: failure() && steps.ignore_docs.outputs.num_source_files != 0
97+
if: failure()
9598
timeout-minutes: 30
9699
working-directory: build
97100
env:
98-
ASAN_SYMBOLIZER_PATH: /opt/vesoft/toolset/clang/9.0.0/bin/llvm-symbolizer
99101
ASAN_OPTIONS: fast_unwind_on_malloc=0
100102
run: |
101103
ctest \
@@ -104,13 +106,12 @@ jobs:
104106
--rerun-failed
105107
- name: Testing Coverage Report
106108
working-directory: build
107-
if: success() && matrix.compiler == 'gcc-9.2' && matrix.os == 'centos7' && steps.ignore_docs.outputs.num_source_files != 0
109+
if: success() && matrix.compiler == 'gcc-9.2' && matrix.os == 'centos7'
108110
run: |
109111
set -e
110112
fastcov -o coverage.info -l --exclude=scanner.lex
111113
lcov --remove coverage.info '*/opt/vesoft/*' -o clean.info
112-
bash <(curl -s https://codecov.io/bash) -Z -t $(cat /etc/action/secrets/codecov) -f clean.info
113-
shell: bash
114+
bash <(curl -s https://codecov.io/bash) -Z -f clean.info
114115
- name: Cleanup
115116
if: always()
116117
run: rm -rf build

0 commit comments

Comments
 (0)