-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (114 loc) · 4.75 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
name: tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
GHCR_REPO: ghcr.io/manticoresoftware/manticoresearch
jobs:
test:
name: Run unit tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run tests inside docker container
uses: manticoresoftware/addnab-docker-run-action@v3
with:
image: ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
options: -v ${{ github.workspace }}:/workdir --cap-add SYS_ADMIN --security-opt apparmor=unconfined
run: |
# the entrypoint is rewritten so we need to launch searchd manually
searchd
cd /workdir
composer install --prefer-dist
git clone https://github.com/manticoresoftware/phar_builder.git
bin/test
test_kit:
name: Build test kit Docker image
runs-on: ubuntu-22.04
outputs:
docker_repo: ${{ steps.vars.outputs.docker_repo }}
docker_tag: ${{ steps.vars.outputs.docker_tag }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set variables
id: vars
run: |
set -e
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
DOCKER_TAG=$(echo "$BRANCH" | tr '/' '-' | tr '_' '-' | tr '.' '-' | tr '@' '-' | tr ':' '-' | tr ' ' '-' | tr '[A-Z]' '[a-z]')
DOCKER_TAG="test-kit-${DOCKER_TAG,,}"
COMMIT=${GITHUB_SHA::8}
IMAGE="${GHCR_REPO}:${DOCKER_TAG}"
IMAGE_COMMIT="${GHCR_REPO}:test-kit-${COMMIT,,}"
echo "docker_repo=${GHCR_REPO}" >> $GITHUB_OUTPUT
echo "docker_tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
echo "image_commit=${IMAGE_COMMIT}" >> $GITHUB_OUTPUT
echo "Docker Image: ${IMAGE}" >> $GITHUB_STEP_SUMMARY
echo "Docker Image commit: ${IMAGE_COMMIT}" >> $GITHUB_STEP_SUMMARY
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ vars.GHCR_USER }}
password: ${{ secrets.GHCR_PASSWORD }}
- name: Pull base image
run: docker pull ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
- name: Create and push test kit image
run: |
docker create --name temp ghcr.io/manticoresoftware/manticoresearch:test-kit-latest tail -f /dev/null
docker start temp
docker exec temp sh -c 'cp /usr/share/manticore/modules/manticore-buddy/bin/manticore-buddy /tmp/manticore-buddy'
docker exec temp sh -c 'rm -rf /usr/share/manticore/modules/manticore-buddy && mkdir -p /usr/share/manticore/modules/manticore-buddy'
docker cp . temp:/usr/share/manticore/modules/manticore-buddy/
docker exec temp sh -c 'cd /usr/share/manticore/modules/manticore-buddy/ && composer install --prefer-dist'
docker exec temp sh -c 'mkdir -p /usr/share/manticore/modules/manticore-buddy/bin && mv /tmp/manticore-buddy /usr/share/manticore/modules/manticore-buddy/bin/manticore-buddy'
docker commit temp ${{ steps.vars.outputs.image }}
docker commit temp ${{ steps.vars.outputs.image_commit }}
docker push ${{ steps.vars.outputs.image }}
docker push ${{ steps.vars.outputs.image_commit }}
docker rm -f temp
clt:
name: Run CLT tests
needs: test_kit
uses: manticoresoftware/manticoresearch/.github/workflows/clt_tests.yml@master
with:
docker_image: ${{ needs.test_kit.outputs.docker_repo }}:${{ needs.test_kit.outputs.docker_tag }}
repository: manticoresoftware/manticoresearch
ref: master
codestyle:
name: PHPCS validation
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run PHPCS to check following the standard
uses: manticoresoftware/addnab-docker-run-action@v3
with:
image: ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
options: -v ${{ github.workspace }}:/workdir
run: |
cd /workdir
composer install --prefer-dist
bin/codestyle
codeanalyze:
name: PHPStan static analysis
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run PHPStan to analyze the codebase
uses: manticoresoftware/addnab-docker-run-action@v3
with:
image: ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
options: -v ${{ github.workspace }}:/workdir
run: |
cd /workdir
composer install --prefer-dist
bin/codeanalyze