-
Notifications
You must be signed in to change notification settings - Fork 2
167 lines (160 loc) · 5.66 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: CI
on: [push]
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
php: ['8.2']
go: ['1.19']
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ matrix.go }}
cache: true
- name: Install scip
run: |
git clone https://github.com/sourcegraph/scip.git --depth=1
cd scip
go build -o scip ./cmd/scip
mv scip /usr/local/bin/scip
- name: Install PHP
uses: shivammathur/setup-php@72ae4ccbe57f82bbe08411e84e2130bd4ba1c10f # v2.25.5
with:
php-version: ${{ matrix.php }}
coverage: xdebug
- name: Validate composer
run: composer validate --strict --check-lock --with-dependencies
- name: Install dependencies
run: composer install --no-interaction --no-progress
- name: Test
run: vendor/bin/phpunit --coverage-text --coverage-cobertura=coverage.xml --colors=never
env:
XDEBUG_MODE: coverage
- name: Upload coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
lint-phpcs:
name: PHP CodeSniffer
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
php: ['8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install PHP
uses: shivammathur/setup-php@72ae4ccbe57f82bbe08411e84e2130bd4ba1c10f # v2.25.5
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Validate composer
run: composer validate --strict --check-lock --with-dependencies
- name: Install dependencies
run: composer install --no-interaction --no-progress
- name: PHP CodeSniffer
run: vendor/bin/phpcs --no-colors
lint-phpstan:
name: PHPStan
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
php: ['8.2']
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install PHP
uses: shivammathur/setup-php@72ae4ccbe57f82bbe08411e84e2130bd4ba1c10f # v2.25.5
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Validate composer
run: composer validate --strict --check-lock --with-dependencies
- name: Install dependencies
run: composer install --no-interaction --no-progress
- name: PHPStan
run: vendor/bin/phpstan
lint-composer-audit:
name: Composer audit
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
php: ['8.2']
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install PHP
uses: shivammathur/setup-php@72ae4ccbe57f82bbe08411e84e2130bd4ba1c10f # v2.25.5
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Validate composer
run: composer validate --strict --check-lock --with-dependencies
- name: Audit
run: composer audit --locked --no-interaction
scip:
name: SCIP
needs: [test, lint-phpstan, lint-phpcs]
if: github.repository == 'davidrjenni/scip-php'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install PHP
uses: shivammathur/setup-php@72ae4ccbe57f82bbe08411e84e2130bd4ba1c10f # v2.25.5
- name: Install dependencies
run: composer install --no-interaction --no-progress
- name: Generate SCIP data
uses: davidrjenni/scip-php@main
with:
entrypoint: /usr/bin/scip-php
- name: Upload SCIP index
uses: davidrjenni/scip-php@main
with:
entrypoint: /usr/bin/src
args: code-intel upload -repo=github.com/${{ github.repository }} -commit=${{ github.sha }} -root=${{ github.workspace }} -github-token=${{ secrets.GITHUB_TOKEN }}
deploy:
name: Build and push image
needs: [test, lint-phpstan, lint-phpcs]
if: |
github.repository == 'davidrjenni/scip-php' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Login to Docker Hub
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub container registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
with:
images: |
davidrjenni/scip-php
ghcr.io/davidrjenni/scip-php
- name: Build and push
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}