-
Notifications
You must be signed in to change notification settings - Fork 24
133 lines (124 loc) · 4.02 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
name: Search API Pantheon
on:
push:
repository_dispatch:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
tmate_enabled:
description: Enable tmate debugging
required: true
default: "0"
jobs:
linting:
runs-on: ubuntu-latest
container:
image: quay.io/pantheon-public/build-tools-ci:8.x-php8.1
options: --user root
name: Code linting
env:
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
TERM: dumb
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
TERMINUS_SITE: ${{ secrets.TERMINUS_SITE }}
TERMINUS_ORG: ${{ secrets.TERMINUS_ORG }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
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
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Composer install
run: composer install
- name: Code sniff
run: composer run-script code:lint
phpcompatibility:
runs-on: ubuntu-latest
name: PHP Compatibility
steps:
- name: PHPCompatibility
uses: pantheon-systems/phpcompatibility-action@v1
with:
test-versions: 7.4-
build_test:
strategy:
matrix:
drupal-version: [ 10 ]
fail-fast: false
runs-on: ubuntu-latest
container:
image: quay.io/pantheon-public/build-tools-ci:8.x-php8.1
options: --user root
name: Build and test (Drupal ${{ matrix.drupal-version }})
env:
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
TERM: dumb
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
TERMINUS_SITE: ${{ secrets.TERMINUS_SITE }}
TERMINUS_ORG: ${{ secrets.TERMINUS_ORG }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
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
DRUPAL_VERSION: ${{ matrix.drupal-version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login
run: |
git config --global user.email "$GIT_EMAIL"
git config --global user.name "Github Actions"
git config --global --add safe.directory '*'
mkdir -p /root/.ssh && echo "${{ secrets.SSH_CONFIG }}" >> "/root/.ssh/config"
- name: Log in to Terminus
run: |
terminus auth:login --email=$GIT_EMAIL --machine-token="$TERMINUS_TOKEN"
terminus auth:whoami
- 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
- name: Cleanup sites
if: ${{ always() }}
run: |
./vendor/bin/robo test:delete-sites
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 }}
WORKSPACE: ${{ github.workspace }}
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