Skip to content

Commit 40e7e2d

Browse files
Switch to Github Actions CI from Travis. (#413)
1 parent 0ee3a61 commit 40e7e2d

3 files changed

Lines changed: 85 additions & 82 deletions

File tree

.github/workflows/build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build
2+
on: [push, pull_request]
3+
4+
env:
5+
TRAVIS_BUILD_DIR: ${{ github.workspace }}
6+
COMPOSER_BIN: ${{ github.workspace }}/vendor/bin
7+
BLT_DIR: ${{ github.workspace }}/vendor/acquia/blt
8+
BUILD_DIR: ${{ github.workspace }}
9+
jobs:
10+
build:
11+
name: Before install
12+
runs-on: ubuntu-latest
13+
services:
14+
mysql:
15+
image: mysql:5.7
16+
env:
17+
MYSQL_ROOT_PASSWORD: root
18+
ports:
19+
- 3306:3306
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
23+
- name: Setup PHP version
24+
uses: nanasess/setup-php@v3.0.6
25+
with:
26+
php-version: '7.4'
27+
- name: SSH keys
28+
run: |
29+
# Make private key available from github secrets.
30+
mkdir -p ~/.ssh
31+
rm -fv ~/.ssh/id_rsa
32+
touch ~/.ssh/id_rsa
33+
echo "${{ secrets.CIDRUPALCZPRIVATE }}" >> ~/.ssh/id_rsa
34+
eval "$(ssh-agent -s)"
35+
chmod 700 ~/.ssh/
36+
chmod 600 ~/.ssh/id_rsa
37+
ssh-add ~/.ssh/id_rsa
38+
# Bypass ~/.ssh/known_host and fix "Host key verification failed.".
39+
touch ~/.ssh/config
40+
chmod 600 ~/.ssh/config
41+
echo "Host *" >> ~/.ssh/config
42+
echo " StrictHostKeyChecking no" >> ~/.ssh/config
43+
echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config
44+
echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config
45+
- name: Cache composer
46+
uses: actions/cache@v2
47+
with:
48+
path: |
49+
$HOME/.composer/cache
50+
vendor
51+
key: composer-${{ hashFiles('**/composer.lock') }}
52+
- name: Install dependencies
53+
run: |
54+
sudo composer self-update --1
55+
composer validate --no-check-all --ansi
56+
composer install --no-suggest
57+
echo ${COMPOSER_BIN} >> $GITHUB_PATH
58+
- name: Verify MySQL connection from host
59+
run: |
60+
sudo apt-get update
61+
sudo apt-get install -y mysql-client
62+
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot -proot -e "select @@hostname;show variables where Variable_name like '%host%';"
63+
mysql --port ${{ job.services.mysql.ports['3306'] }} -uroot -proot --protocol=tcp -e "CREATE DATABASE drupal; CREATE USER 'drupal'@'%' IDENTIFIED BY 'drupal'; GRANT ALL ON drupal.* TO 'drupal'@'%';"
64+
- name: Install chromedriver
65+
run: ${BLT_DIR}/scripts/linux/install-chrome.sh ${COMPOSER_BIN}
66+
- name: Configure git
67+
run: |
68+
git config --global user.name "CI"
69+
git config --global user.email "ci@drupal.cz"
70+
- name: Run tests
71+
run: |
72+
blt validate:all --no-interaction || exit 1
73+
blt setup --define drush.alias='${drush.aliases.ci}' --no-interaction --verbose || exit 1
74+
blt tests:all --define drush.alias='${drush.aliases.ci}' --define tests.run-server=true --no-interaction --verbose || exit 1
75+
- name: Simulate deploy
76+
run: |
77+
blt artifact:deploy --dry-run --commit-msg "Automated commit by CI for Build ${{ github.run_id}}" --no-interaction --verbose
78+
rm -rf deploy
79+
- name: Extract branch name
80+
run: echo "##[set-output name=branch;]$(git branch --show-current)"
81+
id: extract_branch
82+
- name: Run deploy on master and develop
83+
if: ${{ steps.extract_branch.outputs.branch == 'master' || steps.extract_branch.outputs.branch == 'develop' }}
84+
run: |
85+
blt artifact:deploy --commit-msg "Automated commit by CI for Build ${{ github.run_id}}" --branch "${{ steps.extract_branch.outputs.branch }}-build" --no-interaction --verbose

.travis.yml

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

.travis/dcz_travis_ssh_key.enc

-3.17 KB
Binary file not shown.

0 commit comments

Comments
 (0)