-
Notifications
You must be signed in to change notification settings - Fork 87
82 lines (70 loc) · 2.83 KB
/
Copy pathcopilot-setup-steps.yml
File metadata and controls
82 lines (70 loc) · 2.83 KB
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
name: "Copilot Setup Steps"
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
permissions:
contents: read
jobs:
copilot-setup-steps:
name: Setup environment
runs-on: ubuntu-latest
permissions:
contents: read
env:
MYSQL_HOST: 127.0.0.1
MYSQL_TCP_PORT: 3306
WP_CLI_TEST_DBROOTUSER: root
WP_CLI_TEST_DBROOTPASS: root
WP_CLI_TEST_DBNAME: wp_cli_test
WP_CLI_TEST_DBUSER: wp_cli_test
WP_CLI_TEST_DBPASS: password1
WP_CLI_TEST_DBHOST: 127.0.0.1:3306
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check existence of composer.json file
id: check_composer_file
run: echo "files_exists=$(test -f composer.json && echo true || echo false)" >> "$GITHUB_OUTPUT"
- name: Set up PHP environment
if: steps.check_composer_file.outputs.files_exists == 'true'
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: 'latest'
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: 'none'
tools: composer,cs2pr
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Composer dependencies & cache dependencies
if: steps.check_composer_file.outputs.files_exists == 'true'
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
env:
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
# Without a database the Behat runner silently falls back to SQLite, so the
# agent's test runs are not the ones CI will do. Mirrors the setup in
# reusable-functional.yml.
- name: Check existence of behat.yml file
id: check_behat_file
run: echo "files_exists=$(test -f behat.yml && echo true || echo false)" >> "$GITHUB_OUTPUT"
- name: Setup MySQL Server
if: steps.check_behat_file.outputs.files_exists == 'true'
uses: shogo82148/actions-setup-mysql@62da9377d83991fce27b6ed2a397d3306121e41d # v1
with:
mysql-version: '8.0' # Standard MySQL version for these tests
auto-start: true
root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }}
user: ${{ env.WP_CLI_TEST_DBUSER }}
password: ${{ env.WP_CLI_TEST_DBPASS }}
- name: Remove system MySQL binary
if: steps.check_behat_file.outputs.files_exists == 'true'
run: sudo rm -f /usr/bin/mysql /usr/bin/mysqldump
- name: Prepare test database
if: steps.check_behat_file.outputs.files_exists == 'true'
run: composer prepare-tests