-
Notifications
You must be signed in to change notification settings - Fork 121
70 lines (58 loc) · 1.81 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
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.cache_dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer install --no-dev --no-interaction --no-scripts
cd vendor-bin/box
composer install --no-interaction
- name: Symlink vendor/bin/box
run: |
mkdir -p vendor/bin
ln -s "$(realpath vendor-bin/box/vendor/bin/box)" vendor/bin/box
- name: Build platform.phar
env:
CI_COMMIT_SHA: ${{ github.sha }}
CI_COMMIT_REF_NAME: ${{ github.ref_name }}
run: |
CI_COMMIT_SHORT_SHA=$(echo $CI_COMMIT_SHA | head -c8)
./bin/platform self:build --no-composer-rebuild --yes --replace-version "$CI_COMMIT_REF_NAME"-"$CI_COMMIT_SHORT_SHA" --output platform.phar
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22
cache-dependency-path: cli/go.sum
- name: Run integration tests
run: |
export TEST_CLI_PATH=$(realpath "./platform.phar")
chmod +x "$TEST_CLI_PATH"
cd go-tests
go test ./... -v
- uses: actions/upload-artifact@v4
with:
name: cli-phar
path: platform.phar
# TODO run these when upgraded for PHP 8+ compatibility
# - name: Run unit tests
# run: |
# # Install PHPUnit
# composer install --no-interaction --no-scripts
# ./scripts/test/unit.sh