Skip to content

Commit 275702e

Browse files
ethomsonjekyllbot
authored andcommitted
Ci/GitHub actions (jekyll#7822)
Merge pull request 7822
1 parent f00a642 commit 275702e

File tree

5 files changed

+57
-6
lines changed

5 files changed

+57
-6
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- /.*-stable/
8+
pull_request:
9+
branches:
10+
- master
11+
- /.*-stable/
12+
13+
jobs:
14+
ci:
15+
name: 'SUITE: ${{ matrix.test_suite }} / OS: ${{ matrix.os }}'
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
test_suite:
21+
- test
22+
- default-site
23+
os:
24+
- ubuntu-latest
25+
- windows-latest
26+
steps:
27+
- uses: actions/checkout@v1
28+
with:
29+
fetch-depth: 1
30+
- name: Set up Ruby 2.6
31+
uses: actions/setup-ruby@v1
32+
with:
33+
ruby-version: 2.6.x
34+
- name: 'Update Rubygems & Bundler'
35+
run: 'gem update --system --no-document && gem update bundler --no-document'
36+
- name: Set up bundle
37+
run: bundle install --jobs 4 --retry 3
38+
- name: Run Test Suite
39+
run: bash script/cibuild
40+
env:
41+
CI: true
42+
TEST_SUITE: ${{ matrix.test_suite }}

test/helper.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ def theme_dir(*subdirs)
8080
def test_dir(*subdirs)
8181
root_dir("test", *subdirs)
8282
end
83+
84+
def temp_dir(*subdirs)
85+
if Utils::Platforms.windows?
86+
drive = Dir.pwd.sub(%r!^([^\/]+).*!, '\1')
87+
temp_root = File.join(drive, "tmp")
88+
else
89+
temp_root = "/tmp"
90+
end
91+
92+
File.join(temp_root, *subdirs)
93+
end
8394
end
8495

8596
class JekyllUnitTest < Minitest::Test

test/source/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* -text

test/test_site.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,15 @@ def read_posts
3232

3333
should "have an array for plugins if passed as a string" do
3434
site = Site.new(site_configuration("plugins_dir" => "/tmp/plugins"))
35-
array = Utils::Platforms.windows? ? ["C:/tmp/plugins"] : ["/tmp/plugins"]
35+
array = [temp_dir("plugins")]
3636
assert_equal array, site.plugins
3737
end
3838

3939
should "have an array for plugins if passed as an array" do
4040
site = Site.new(site_configuration(
4141
"plugins_dir" => ["/tmp/plugins", "/tmp/otherplugins"]
4242
))
43-
array = if Utils::Platforms.windows?
44-
["C:/tmp/plugins", "C:/tmp/otherplugins"]
45-
else
46-
["/tmp/plugins", "/tmp/otherplugins"]
47-
end
43+
array = [temp_dir("plugins"), temp_dir("otherplugins")]
4844
assert_equal array, site.plugins
4945
end
5046

0 commit comments

Comments
 (0)