Skip to content

Commit

Permalink
Run unit tests in CI
Browse files Browse the repository at this point in the history
Now that LibriVox/librivox-catalog#190 has
merged, we can actually run in CI. We also lay down some groundwork to
make the workflow reusable, and to make the catalog branch checkout
configurable, with the intention of running it against unmerged PRs.
This means we have to call our own reusable workflow with the correct
value of catalog_git_branch set, which is weird, but I couldn't find
a more sane way to handle variable with GitHub Actions.
  • Loading branch information
notartom committed Feb 10, 2024
1 parent 2847825 commit b766f60
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 237 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jobs:
deploy-localdev:
uses: LibriVox/librivox-ansible/.github/workflows/workflow-1.yml@master
with:
catalog_git_branch: master
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Deploy LibriVox local development environment
name: Deploy localdev
on:
pull_request:
workflow_dispatch:
workflow_call:
inputs:
catalog_git_branch:
required: true
type: string
jobs:
deploy-localdev:
deploy-localdev-reusable:
runs-on: 'ubuntu-22.04'
timeout-minutes: 15
steps:
Expand All @@ -25,7 +28,7 @@ jobs:
playbook: localdev.yaml
inventory: |
[localdev]
${{ steps.lxc.outputs.ip }} ansible_user=root ci_env=development ci_log_threshold=4
${{ steps.lxc.outputs.ip }} ansible_user=root ci_env=development ci_log_threshold=4 catalog_git_branch=${{ catalog_git_branch }}
options:
-l localdev

Expand All @@ -37,3 +40,7 @@ jobs:
web-url: "https://librivox.org/dust-of-the-desert-by-robert-welles-ritchie/"
scan-for-text: "BENICIA"
insecure: true

- name: Run unit tests
run: |
ssh librivox.org 'cd /librivox/www/librivox.org/catalog && XDEBUG_MODE=coverage vendor/bin/phpunit -c application/tests'
7 changes: 6 additions & 1 deletion roles/blog+catalog/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@
git:
repo: https://github.com/LibriVox/librivox-catalog.git
dest: /librivox/www/librivox.org/catalog
version: master
version: {{ catalog_git_branch }}
force: yes

- name: Catalog unit tests dependecies
command: php composer.phar require --dev kenjis/ci-phpunit-test:^3.0
args:
chdir: /librivox/www/librivox.org/catalog

- name: CodeIgniter sessions directory
file:
path: /tmp/php-sessions
Expand Down
6 changes: 3 additions & 3 deletions roles/common/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
name: ['git', 'apache2', 'mariadb-server', 'php8.1-fpm', 'php8.1-mysql',
'php8.1-curl', 'php8.1-memcache', 'php8.1-memcached', 'php8.1-intl',
'php8.1-mbstring', 'php8.1-xml', 'php8.1-zip', 'php8.1-apcu',
'php8.1-gd', 'php8.1-imagick', 'python3-certbot-apache',
'python3-mysqldb', 'sphinxsearch', 'mp3gain', 'unzip', 'memcached',
'imagemagick']
'php8.1-gd', 'php8.1-imagick', 'php8.1-xdebug',
'python3-certbot-apache', 'python3-mysqldb', 'sphinxsearch',
'mp3gain', 'unzip', 'memcached', 'imagemagick']
state: latest
update_cache: yes
become: true
Expand Down
1 change: 1 addition & 0 deletions vars/localdev.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
catalog_git_branch: master
iarchive_uploader_access_key: invalid
iarchive_uploader_secret_key: invalid
codeigniter_encryption_key: some_random_string
Expand Down
233 changes: 117 additions & 116 deletions vars/production.enc

Large diffs are not rendered by default.

225 changes: 113 additions & 112 deletions vars/staging.enc

Large diffs are not rendered by default.

0 comments on commit b766f60

Please sign in to comment.