-
Notifications
You must be signed in to change notification settings - Fork 12
128 lines (107 loc) · 3.37 KB
/
pull_request.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
name: Pull Request
on:
pull_request:
branches:
- master
- main
- 2.x
env:
TERMINUS_SITE: d9-papc3
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
TERM: dumb
TERMINUS_ORG: ${{ secrets.TERMINUS_ORG }}
GITHUB_RUN_NUMBER: ${{ github.run_number }}
COMMIT_SHA: ${{ github.sha }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SANDBOX_SSH_KEY: ${{ secrets.SANDBOX_SSH_KEY }}
BASH_ENV: ~/.bashrc
WORKSPACE: ${{ github.workspace }}
jobs:
phpcompatibility:
runs-on: ubuntu-latest
name: PHP Compatibility
steps:
- name: Checkout
uses: actions/checkout@v2
- name: PHPCompatibility
uses: pantheon-systems/phpcompatibility-action@v1
with:
test-versions: 8.1
## Soft deprecation of 7.4. Doesn't make it incompatible
## just doesn't make sure it is compatible.
linting:
runs-on: ubuntu-latest
name: Code linting
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Composer install
run: composer install
- name: Code sniff
run: composer run-script code:lint
build_test:
needs: [ phpcompatibility, linting ]
strategy:
matrix:
drupal-version: [ 10, 11 ]
fail-fast: false
runs-on: ubuntu-latest
name: Build and test (Drupal ${{ matrix.drupal-version }})
env:
DRUPAL_VERSION: ${{ matrix.drupal-version }}
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
- name: Install Terminus
uses: pantheon-systems/terminus-github-actions@v1
with:
pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
- name: Login Pantheon Git
run: |
git config --global user.email "$GIT_EMAIL"
git config --global user.name "Github Actions"
git config --global --add safe.directory '*'
mkdir -p ~/.ssh && echo "${{ secrets.SSH_CONFIG }}" >> ~/.ssh/config
- name: Setup SSH Keys
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SANDBOX_SSH_KEY }}
- name: Composer install
run: composer install --ignore-platform-req=php
- name: Setup tmate session
if: ${{ github.event.inputs.tmate_enabled == 1 }}
uses: mxschmitt/action-tmate@v3
- name: Run tests
run: |
export TERMINUS_ORG=$TERMINUS_ORG
./vendor/bin/robo test:full $DRUPAL_VERSION $TERMINUS_SITE
mirror_do:
runs-on: ubuntu-latest
name: Checkout & push to remote
if: ${{ github.repository == 'pantheon-systems/search_api_pantheon' }}
needs: [ build_test ]
env:
BRANCH: ${{ github.ref_name }}
DRUPAL_ORG_REMOTE: ${{ secrets.DRUPAL_ORG_REMOTE }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
if_key_exists: ignore
- name: Pushes to drupal.org repository
run: |
cd $WORKSPACE
git remote add drupalorg $DRUPAL_ORG_REMOTE
git push drupalorg $BRANCH