-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (135 loc) · 4.03 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Qserv CI workflow
---
name: "CI"
on:
push:
pull_request:
branches:
- main
jobs:
build:
name: Build image
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Declare Version Variables
id: vars
shell: bash
run: |
IMAGE="qserv/ingest:$(git describe --dirty --always)"
echo "IMAGE=${IMAGE}" >> $GITHUB_ENV
echo "Build and test Qserv ingest image: $IMAGE"
- name: Build qserv-ingest image
run: |
cp env.example.sh env.sh
# Set development version
sed -i "s/^INGEST_RELEASE=.*$//" env.sh
./build.sh
mkdir -p artifacts
docker save "${{ env.IMAGE }}" > artifacts/image.tar
echo "${{ env.IMAGE }}" > artifacts/image-tag
- name: Launch unit tests
run: |
./code-checks.sh -u
- uses: actions/upload-artifact@v2
with:
name: image
path: artifacts
image-analysis:
name: Analyze image
runs-on: ubuntu-22.04
needs: build
steps:
- name: Download image
uses: actions/download-artifact@v3
with:
name: image
path: artifacts
- name: Load image in local registry
run: |
docker load --input artifacts/image.tar
echo "IMAGE=$(cat artifacts/image-tag)" >> $GITHUB_ENV
- name: Scan qserv-ingest image
uses: anchore/scan-action@v2
with:
image: "${{ env.IMAGE }}"
acs-report-enable: true
- name: upload Anchore scan SARIF report
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: results.sarif
integration:
name: Run integration test on qserv-ingest
runs-on: ubuntu-22.04
needs: build
env:
GHA_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: apparmor
run: |
set -x
sudo apt-get remove mysql-server --purge
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: Download qserv-ingest image
uses: actions/download-artifact@v3
with:
name: image
path: artifacts
- name: Create k8s/kind cluster
run: |
git clone --depth 1 -b "k8s-1.21.1-1" --single-branch https://github.com/k8s-school/kind-helper.git
./kind-helper/k8s-create.sh -s
- name: Load container image inside kind
run: |
kind load image-archive artifacts/image.tar
docker exec -- kind-control-plane crictl image
- run: |
kubectl get nodes
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Pull LFS objects
run: git lfs pull
- name: Checkout LFS objects
run: git lfs checkout
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install click
run: |
python -m pip install --upgrade pip
pip install click pyyaml requests
- name: Deploy Qserv
run: ./itest/install-qserv.sh
- name: Install pre-requisites
run: ./prereq-install.sh
- name: Run integration tests
run: ./itest/run-tests.sh
push:
name: Push Qserv ingest image to registry
runs-on: ubuntu-22.04
needs: integration
steps:
- name: Download qserv-ingest image
uses: actions/download-artifact@v3
with:
name: image
path: artifacts
- name: Load image in local registry
run: |
docker load --input artifacts/image.tar
echo "IMAGE=$(cat artifacts/image-tag)" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push image to Docker Hub
run: |
docker push ${{ env.IMAGE }}