Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Replace Travis CI with GitHub Actions #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ Use `ddt -u deps`

The documentation site describes the current practices pretty well at [https://docs.raku.org/language/modules#Distributing_modules](https://docs.raku.org/language/modules#Distributing_modules). The original design document of META6.json is available at [http://design.perl6.org/S22.html](http://design.perl6.org/S22.html).

* How do I remove the travis badge?

Remove .travis.yml

SEE ALSO
========

Expand Down
5 changes: 0 additions & 5 deletions lib/Ddt.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,6 @@ L<https://docs.raku.org/language/modules#Distributing_modules>. The original
design document of META6.json is available at
L<http://design.perl6.org/S22.html>.

=item How do I remove the travis badge?

Remove .travis.yml


=head1 SEE ALSO

=item L<https://github.com/skaji/mi6>
Expand Down
27 changes: 3 additions & 24 deletions lib/Ddt/Distribution.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ has $.ignore-rules = do {
File::Ignore.parse: $rules;
};
has IO::Path $.bin-dir = enhance-io-path-class $!main-dir.child(<bin>), $!ignore-rules;
has IO::Path $.github-workflows = $!main-dir.child(<.github>).child(<workflows>);
has IO::Path $.hooks-dir = $!main-dir.child(<hooks>);
has IO::Path $.lib-dir = enhance-io-path-class $!main-dir.child(<lib>), $!ignore-rules;
has IO::Path $.test-dir = enhance-io-path-class $!main-dir.child(<t>), $!ignore-rules;
Expand Down Expand Up @@ -102,6 +103,7 @@ sub in-git-repo returns Bool:D {

method !make-directories {
$.main-dir.mkdir;
$.github-workflows.mkdir;
$.bin-dir.mkdir;
$.hooks-dir.mkdir;
$.lib-dir.mkdir;
Expand Down Expand Up @@ -140,15 +142,6 @@ method generate-README {
{
if my $markdown = self.render-markdown( $file )
{
my ($user, $repo) = self.guess-user-and-repo();
my $header = do if $user and ".travis.yml".IO.e {
"[![Build Status](https://travis-ci.org/$user/$repo.svg?branch=master)]"
~ "(https://travis-ci.org/$user/$repo)"
~ "\n\n";
} else {
"";
}

return $.main-dir.child("README.md").spurt: $header ~ $markdown;
}
}
Expand Down Expand Up @@ -197,7 +190,7 @@ method !make-content {
$.test-dir.child(<00-meta.t>) test-meta
$.test-dir.child(<01-basic.t>) test
$.main-dir.child(<.gitignore>) gitignore
$.main-dir.child(<.travis.yml>) travis
$.github-workflows.child(<test.yaml>) github-action
>>;
for %map.kv -> $f, $c {
spurt($f, %content{$c});
Expand Down Expand Up @@ -281,20 +274,6 @@ method !name-to-file(Str $module is copy) {
self!to-file: $module;
}

submethod guess-user-and-repo() {
my $url = self.find-source-url();
return if $url eq "";
if $url ~~ m{ (git|https?) '://'
[<-[/]>+] '/'
$<user>=[<-[/]>+] '/'
$<repo>=[.+?] [\.git]?
$} {
return $/<user>, $/<repo>;
} else {
return;
}
}

# A hack for getting identical json on each run
sub meta-to-json(META6 $meta --> Str:D) {
my %h = from-json($meta.to-json: :skip-null).pairs.grep: *.value !~~ Empty;
Expand Down
44 changes: 31 additions & 13 deletions lib/Ddt/Template.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,37 @@ Session.vim
tags
EOF

travis => qq:to/EOF/,
os:
- linux
- osx
language: raku
raku:
- latest
install:
- rakubrew build-zef
- zef --/test --deps-only install .
script:
- zef test .
sudo: false
github-action => q:to/EOF/,
---
name: Tests
on:
pull_request:
push:
schedule:
- cron: 1 1 * * 5
workflow_dispatch:
jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: Raku/setup-raku@v1

- name: Raku version
run: raku -v

- name: Install dependencies
run: zef install --deps-only --/test --test-depends .

- name: Run tests
run: zef test -v --debug .
EOF

test => qq:to/END_OF_TEST/,
Expand Down
2 changes: 1 addition & 1 deletion xt/01-actual.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ subtest "ddt new command", {
ok "Foo-Bar".IO.d, "Distribution directory is created";
chdir "Foo-Bar";
subtest "All expected files exist", {
my @expected = <.git .gitignore .travis.yml LICENSE META6.json README.md bin lib t>;
my @expected = <.git .gitignore .github/workflows/test.yaml LICENSE META6.json README.md bin lib t>;
plan @expected.elems;
for @expected {
ok $*CWD.child($_).e, "$_ exists"
Expand Down