Skip to content

Commit 40f6fef

Browse files
Issue #37: Switch CI from Travis to Github actions.
1 parent 9eb8b81 commit 40f6fef

6 files changed

Lines changed: 71 additions & 80 deletions

File tree

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/tests export-ignore
33
/.editorconfig export-ignore
44
/.gitattributes export-ignore
5+
/.github export-ignore
56
/.gitignore export-ignore
6-
/.travis.yml export-ignore
77
/phpunit.xml.dist export-ignore
88

99
# Configure diff output for .php files.

.github/workflows/tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: ["2.0.x"]
6+
pull_request:
7+
branches: ["2.0.x"]
8+
9+
env:
10+
COMPOSER_MEMORY_LIMIT: -1
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
php-versions:
22+
- '8.1'
23+
drupal-release:
24+
- 'stable'
25+
composer-channel:
26+
- 'stable'
27+
steps:
28+
- uses: actions/checkout@v3
29+
30+
- name: Install dependencies
31+
run: composer install --prefer-dist --no-progress
32+
33+
- name: Configure Git
34+
run: |
35+
git config --global user.email "ci@example.com"
36+
git config --global user.name "CI Test"
37+
38+
- name: Run test suite
39+
run: vendor/bin/phpunit

.travis.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# drupal-l10n
22

3-
[![Build Status](https://travis-ci.com/drupal-composer/drupal-l10n.svg?branch=2.0.x)](https://travis-ci.com/drupal-composer/drupal-l10n)
3+
[![CI](https://github.com/drupal-composer/drupal-l10n/actions/workflows/tests.yml/badge.svg?branch=2.0.x)](https://github.com/drupal-composer/drupal-l10n/actions/workflows/tests.yml)
44

55
Composer plugin for automatically downloading Drupal translation files when
66
using Composer to manage Drupal projects.

src/FileFetcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ protected function getUrl($package_name, $drupal_project_name, $filename) {
189189
$core_folder = 'all';
190190
// Starting from 8.x, translations are in
191191
// https://ftp.drupal.org/files/translations/all/ even for Drupal 9.
192-
// Otherwise it is https://ftp.drupal.org/files/translations/7.x/.
192+
// Otherwise, it is https://ftp.drupal.org/files/translations/7.x/.
193193
if ($this->coreMajorVersion < 8) {
194194
$core_folder = $this->coreMajorVersion . '.x';
195195
}

tests/PluginTest.php

Lines changed: 29 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ public function tearDown() : void {
6767
* Tests a simple composer install and update.
6868
*/
6969
public function testComposerInstallAndUpdate() {
70-
$version = '8.9.0';
70+
$version = '9.5.0';
7171
$translations_directory = $this->tmpDir . DIRECTORY_SEPARATOR . 'translations' . DIRECTORY_SEPARATOR . 'contrib';
7272
$core_directory = $this->tmpDir . DIRECTORY_SEPARATOR . 'core';
7373
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.fr.po';
7474
$es_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.es.po';
7575

76-
$this->assertFileNotExists($fr_translation_file, 'French translations file should not exist.');
77-
$this->assertFileNotExists($es_translation_file, 'Spanish translations file should not exist.');
76+
$this->assertFileDoesNotExist($fr_translation_file, 'French translations file should not exist.');
77+
$this->assertFileDoesNotExist($es_translation_file, 'Spanish translations file should not exist.');
7878
$this->composer('install');
7979
$this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . 'core', 'Drupal core is installed.');
8080
$this->assertFileExists($fr_translation_file, 'French translations file should exist.');
@@ -94,24 +94,24 @@ public function testComposerInstallAndUpdate() {
9494
$this->assertFileExists($fr_translation_file, 'French translations file should exist.');
9595

9696
// Test downloading a new version of the translations.
97-
$version = '8.9.7';
97+
$version = '9.5.3';
9898
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.fr.po';
9999
$es_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.es.po';
100-
$this->assertFileNotExists($fr_translation_file, "French translations file for version: $version should not exist.");
101-
$this->assertFileNotExists($es_translation_file, "Spanish translations file for version: $version should not exist.");
100+
$this->assertFileDoesNotExist($fr_translation_file, "French translations file for version: $version should not exist.");
101+
$this->assertFileDoesNotExist($es_translation_file, "Spanish translations file for version: $version should not exist.");
102102
$this->composer('require --update-with-dependencies drupal/core:"' . $version . '"');
103103
$this->assertFileExists($fr_translation_file, "French translations file for version: $version should exist.");
104104
$this->assertFileExists($es_translation_file, "Spanish translations file for version: $version should exist.");
105105

106106
// Test that the translations for a dev version are not downloaded.
107-
$version = '8.9.x-dev';
107+
$version = '9.5.x-dev';
108108
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.fr.po';
109109
$es_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $version . '.es.po';
110-
$this->assertFileNotExists($fr_translation_file, "French translations file for version: $version should not exist.");
111-
$this->assertFileNotExists($es_translation_file, "Spanish translations file for version: $version should not exist.");
110+
$this->assertFileDoesNotExist($fr_translation_file, "French translations file for version: $version should not exist.");
111+
$this->assertFileDoesNotExist($es_translation_file, "Spanish translations file for version: $version should not exist.");
112112
$this->composer('require --update-with-dependencies drupal/core:"' . $version . '"');
113-
$this->assertFileNotExists($fr_translation_file, "French translations file for version: $version should not exist.");
114-
$this->assertFileNotExists($es_translation_file, "Spanish translations file for version: $version should not exist.");
113+
$this->assertFileDoesNotExist($fr_translation_file, "French translations file for version: $version should not exist.");
114+
$this->assertFileDoesNotExist($es_translation_file, "Spanish translations file for version: $version should not exist.");
115115
}
116116

117117
/**
@@ -120,50 +120,21 @@ public function testComposerInstallAndUpdate() {
120120
* Either if using semver or not.
121121
*/
122122
public function testContribmodules() {
123-
$core_version = '8.9.0';
124-
$contrib_module = 'search404';
125-
$contrib_composer_version = '1.0.0';
126-
$contrib_drupal_version = '8.x-1.0';
127-
$translations_directory = $this->tmpDir . DIRECTORY_SEPARATOR . 'translations' . DIRECTORY_SEPARATOR . 'contrib';
128-
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . $contrib_module . '-' . $contrib_drupal_version . '.fr.po';
129-
130-
$this->assertFileNotExists($fr_translation_file, 'French translations file should not exist.');
131-
$this->composer('install');
132-
$this->composer('require --update-with-dependencies drupal/core:"' . $core_version . '"');
133-
$this->composer('require drupal/' . $contrib_module . ':"' . $contrib_composer_version . '"');
134-
$this->assertFileExists($this->tmpDir . DIRECTORY_SEPARATOR . 'core', 'Drupal core is installed.');
135-
$this->assertFileExists($fr_translation_file, 'French translations file should exist.');
136-
137-
// Test downloading a semantic version of the module.
138-
$contrib_composer_version = '2.0.0';
139-
$contrib_drupal_version = '2.0.0';
140-
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . $contrib_module . '-' . $contrib_drupal_version . '.fr.po';
141-
$this->assertFileNotExists($fr_translation_file, "French translations file for version: $contrib_drupal_version should not exist.");
142-
$this->composer('require drupal/' . $contrib_module . ':"' . $contrib_composer_version . '"');
143-
$this->assertFileExists($fr_translation_file, "French translations file for version: $contrib_drupal_version should exist.");
144-
}
145-
146-
/**
147-
* Tests that on Drupal 9, core and contrib modules are handled.
148-
*
149-
* Either if using semver or not.
150-
*/
151-
public function testDrupal9() {
152-
$core_version = '9.1.3';
123+
$core_version = '9.5.3';
153124
$contrib_module = 'entity_share';
154-
$contrib_composer_version = '3.0.0-beta2';
155-
$contrib_drupal_version = '8.x-3.0-beta2';
125+
$contrib_composer_version = '3.0.0-rc4';
126+
$contrib_drupal_version = '8.x-3.0-rc4';
156127
$semver_contrib_module = 'entity_share_cron';
157-
$semver_contrib_composer_version = '3.0.0-beta1';
158-
$semver_contrib_drupal_version = '3.0.0-beta1';
128+
$semver_contrib_composer_version = '3.0.1';
129+
$semver_contrib_drupal_version = '3.0.1';
159130
$translations_directory = $this->tmpDir . DIRECTORY_SEPARATOR . 'translations' . DIRECTORY_SEPARATOR . 'contrib';
160131
$core_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $core_version . '.fr.po';
161132
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . $contrib_module . '-' . $contrib_drupal_version . '.fr.po';
162133
$semver_fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . $semver_contrib_module . '-' . $semver_contrib_drupal_version . '.fr.po';
163134

164-
$this->assertFileNotExists($core_translation_file, 'French translations file should not exist.');
165-
$this->assertFileNotExists($fr_translation_file, 'French translations file should not exist.');
166-
$this->assertFileNotExists($semver_fr_translation_file, 'French translations file should not exist.');
135+
$this->assertFileDoesNotExist($core_translation_file, 'French translations file should not exist.');
136+
$this->assertFileDoesNotExist($fr_translation_file, 'French translations file should not exist.');
137+
$this->assertFileDoesNotExist($semver_fr_translation_file, 'French translations file should not exist.');
167138
$this->composer('install');
168139
$this->composer('require --update-with-dependencies drupal/core:"' . $core_version . '"');
169140
$this->composer('require drupal/' . $contrib_module . ':"' . $contrib_composer_version . '" drupal/' . $semver_contrib_module . ':"' . $semver_contrib_composer_version . '"');
@@ -184,8 +155,8 @@ public function testDrupal7() {
184155
$core_translation_file = $translations_directory . DIRECTORY_SEPARATOR . 'drupal-' . $core_version . '.fr.po';
185156
$fr_translation_file = $translations_directory . DIRECTORY_SEPARATOR . $contrib_module . '-' . $contrib_drupal_version . '.fr.po';
186157

187-
$this->assertFileNotExists($core_translation_file, 'French translations file should not exist.');
188-
$this->assertFileNotExists($fr_translation_file, 'French translations file should not exist.');
158+
$this->assertFileDoesNotExist($core_translation_file, 'French translations file should not exist.');
159+
$this->assertFileDoesNotExist($fr_translation_file, 'French translations file should not exist.');
189160
$this->composer('install');
190161
$this->composer('remove drupal/core');
191162
// Set Drupal repository to target Drupal 7.
@@ -236,8 +207,14 @@ protected function composerJsonDefaults() {
236207
],
237208
'require' => [
238209
'drupal-composer/drupal-l10n' => $this->tmpReleaseTag,
239-
'composer/installers' => '^1.2',
240-
'drupal/core' => '8.9.0',
210+
'composer/installers' => '2.*',
211+
'drupal/core' => '9.5.0',
212+
],
213+
'config'=> [
214+
'allow-plugins' => [
215+
'composer/installers' => TRUE,
216+
'drupal-composer/drupal-l10n' => TRUE,
217+
],
241218
],
242219
'extra' => [
243220
'drupal-l10n' => [

0 commit comments

Comments
 (0)