Skip to content

Commit 6f2e4ff

Browse files
feat: SRE-1122 - Migration out of CircleCI (#327)
1 parent 72b8d76 commit 6f2e4ff

File tree

5 files changed

+118
-113
lines changed

5 files changed

+118
-113
lines changed

.circleci/config.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/workflows/test-behat.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Behat CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
workflow_dispatch:
8+
schedule:
9+
# Nightly at 00:00 UTC (CircleCI had cron "0 0 * * *" with branch filter=master)
10+
- cron: "0 0 * * *"
11+
12+
permissions:
13+
contents: read
14+
actions: write
15+
16+
jobs:
17+
test-behat:
18+
# Run nightly only on master (schedule can't filter branches directly)
19+
if: github.event_name != 'schedule' || github.ref == 'refs/heads/master'
20+
21+
runs-on: ubuntu-latest
22+
23+
env:
24+
RUN_NUM: ${{ github.run_number }}
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v5
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Cache dependencies
35+
uses: actions/cache@v3
36+
with:
37+
path: ~/vendor
38+
key: test-lint-dependencies-{{ checksum "composer.json" }}
39+
restore-keys: test-lint-dependencies-{{ checksum "composer.json" }}
40+
41+
- name: Install dependencies
42+
run: composer install -n --prefer-dist
43+
44+
- name: Run PHP Lint
45+
run: composer phpcs
46+
47+
- name: Install Terminus
48+
uses: pantheon-systems/terminus-github-actions@v1
49+
with:
50+
pantheon-machine-token: ${{ secrets.TERMINUS_TOKEN }}
51+
52+
- name: Validate Readme Spacing
53+
uses: pantheon-systems/validate-readme-spacing@v1
54+
55+
- name: Install Subversion
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install subversion
59+
60+
- name: Generate admin password
61+
run: echo $(openssl rand -hex 8) > /tmp/WORDPRESS_ADMIN_PASSWORD
62+
63+
- name: Export env
64+
run: |
65+
{
66+
echo "TERMINUS_ENV=ci-${RUN_NUM}"
67+
echo "TERMINUS_SITE=wp-native-php-sessions"
68+
echo "SITE_ENV=wp-native-php-sessions.ci-${RUN_NUM}"
69+
echo "WORDPRESS_ADMIN_USERNAME=pantheon"
70+
echo "WORDPRESS_ADMIN_EMAIL=no-reply@getpantheon.com"
71+
echo "WORDPRESS_ADMIN_PASSWORD=$(cat /tmp/WORDPRESS_ADMIN_PASSWORD)"
72+
} >> "$GITHUB_ENV"
73+
74+
- name: Force SSH to ignore host keys
75+
run: echo "GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" >> $GITHUB_ENV
76+
77+
- name: Install SSH key
78+
uses: webfactory/ssh-agent@v0.7.0
79+
with:
80+
ssh-private-key: ${{ secrets.SITE_OWNER_SSH_PRIVATE_KEY }}
81+
82+
- name: Configure Composer GitHub OAuth (optional)
83+
if: env.GITHUB_TOKEN != ''
84+
run: |
85+
echo "Setting Composer GitHub OAuth token (output suppressed)"
86+
{ composer config -g github-oauth.github.com "$GITHUB_TOKEN"; } &>/dev/null
87+
88+
- name: Validate fixture version
89+
uses: jazzsequence/action-validate-plugin-version@v1
90+
with:
91+
branch: ${{ github.head_ref }}
92+
dry-run: 'true'
93+
94+
- name: Behat prepare
95+
run: |
96+
terminus auth:login --machine-token=$TERMINUS_TOKEN
97+
terminus self:plugin:install terminus-build-tools-plugin
98+
./bin/behat-prepare.sh
99+
100+
- name: Behat tests (strict)
101+
run: ./bin/behat-test.sh --strict
102+
103+
- name: Cleanup (always)
104+
if: always()
105+
run: ./bin/behat-cleanup.sh

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.DS_Store
2+
.idea
3+
.codacy
24
Thumbs.db
35
wp-cli.local.yml
46
node_modules/

bin/behat-prepare.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@
77
###
88

99
if [ -z "$TERMINUS_SITE" ] || [ -z "$TERMINUS_ENV" ]; then
10-
echo "TERMINUS_SITE and TERMINUS_ENV environment variables must be set"
11-
exit 1
10+
echo "TERMINUS_SITE and TERMINUS_ENV environment variables must be set"
11+
exit 1
1212
fi
1313

1414
if [ -z "$WORDPRESS_ADMIN_USERNAME" ] || [ -z "$WORDPRESS_ADMIN_PASSWORD" ]; then
15-
echo "WORDPRESS_ADMIN_USERNAME and WORDPRESS_ADMIN_PASSWORD environment variables must be set"
16-
exit 1
15+
echo "WORDPRESS_ADMIN_USERNAME and WORDPRESS_ADMIN_PASSWORD environment variables must be set"
16+
exit 1
1717
fi
1818

1919
set -ex
2020

21+
###
22+
# Install Composer dependencies, including Behat. This makes the
23+
# ./vendor/bin/behat executable available for the test runner.
24+
###
25+
composer install --no-progress --prefer-dist
26+
2127
###
2228
# Create a new environment for this particular test run.
2329
###
@@ -67,7 +73,7 @@ git commit -m "Include WP Native PHP Sessions and its configuration files"
6773
git push
6874

6975
# Sometimes Pantheon takes a little time to refresh the filesystem
70-
terminus build:workflow:wait "$TERMINUS_SITE"."$TERMINUS_ENV"
76+
terminus workflow:wait "$TERMINUS_SITE"."$TERMINUS_ENV"
7177

7278
###
7379
# Set up WordPress, theme, and plugins for the test run

bin/validate-fixture-version.sh

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)