CI on 8th track

I’m creating a PR for Darts on 8th, but CI fails before the testing starts.

The “Checkout test runner” step fails with

Run actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
  with:
    repository: exercism/8th-test-runner
    path: 8th-test-runner
    ref: main
    ssh-strict: true
    persist-credentials: true
    clean: true
    fetch-depth: 1
    lfs: false
    submodules: false
    set-safe-directory: true
Error: Input required and not supplied: token

Attn: @ErikSchierboom @axtens

Thanks for adding the darts. I have code here for series and atbash-cipher. May I forward it to you? I’m struggling to find time to do anything Exercism-y.

Certainly.

series.8th

: series \ s n --
  >r "" s:/
  ( "" a:join ) r> 1 a:map+ ;

atbash-cipher.8th

"abcdefghijklmnopqrstuvwxyz" clone constant plain
s:rev constant cipher

: (atbash)
  (
    dup '0 '9 n:between
    !if
      'a n:-
      cipher swap s:@
    then
  ) s:map ;

\ Encode a string to atbash:
: >atbash \ s -- s
  (atbash) [5] s:/
  " " a:join ;

\ Decode a string from atbash:
: atbash> \ s -- s
  " " "" s:replace!
  (atbash) ;

With considerable gratitude.

Wow that series code is short!

I’ll take a look at the CI failure

1 Like

@glennj Update PAT by ErikSchierboom · Pull Request #79 · exercism/8th · GitHub has fixed the CI failure. If you rebase/merge main, it should work!

@ErikSchierboom still failing I’m afraid https://github.com/exercism/8th/actions/runs/6012129464/job/16306875740?pr=77

This might have to do with you running on a fork somehow. I’ve ran the tests locally on your PR and they pass:

erik@schierheim:~/exercism/8th$ ./bin/test 
Checking acronym exercise...
acronym: testing...
acronym: done
Checking affine-cipher exercise...
affine-cipher: testing...
affine-cipher: done
Checking armstrong-numbers exercise...
armstrong-numbers: testing...
armstrong-numbers: done
Checking bob exercise...
bob: testing...
bob: done
Checking collatz-conjecture exercise...
collatz-conjecture: testing...
collatz-conjecture: done
Checking darts exercise...
darts: testing...
darts: done
Checking gigasecond exercise...
gigasecond: testing...
gigasecond: done
Checking hamming exercise...
hamming: testing...
hamming: done
Checking hello-world exercise...
hello-world: testing...
hello-world: done
Checking isogram exercise...
isogram: testing...
isogram: done
Checking leap exercise...
leap: testing...
leap: done
Checking luhn exercise...
luhn: testing...
luhn: done
Checking pangram exercise...
pangram: testing...
pangram: done
Checking raindrops exercise...
raindrops: testing...
raindrops: done
Checking reverse-string exercise...
reverse-string: testing...
reverse-string: done
Checking roman-numerals exercise...
roman-numerals: testing...
roman-numerals: done
Checking triangle exercise...
triangle: testing...
triangle: done
Checking trinary exercise...
trinary: testing...
trinary: done
Checking two-fer exercise...
two-fer: testing...
two-fer: done
Checking word-count exercise...
word-count: testing...
word-count: done
Checking yacht exercise...
yacht: testing...
yacht: done

Yes, on main it works fine: Add Darts exercise (#77) · exercism/8th@7d211ad · GitHub

1 Like

There’s still something broken with this workflow:

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

I’ve created a pull request from glennj:exercism-series into exercism:main.

Is that branches: [main] line correct for key pull_request?

The atbash-cipher code needs to be modified a bit as it currently don’t lowercase the input string failing with some of the test cases.

Here is another lazy implementation:

: translate  \ s1 s2 s3 -- s
  3 a:close ( "" s:/ ) a:map a:open m:zip swap "" m:@? nip "" a:join ;

: (atbash)  \ s -- s
  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  "zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba"
  translate ;

: >atbash  \ s -- s
  (atbash) [5] s:/ " " a:join ;

: atbash>  \ s -- s
  (atbash) ;

I just submitted the PR. I tweaked Bruce’s code just a bit:

"abcdefghijklmnopqrstuvwxyz" s:rev constant cipher

: (atbash)
  /[^[:alnum:]]/ "" s:replace!
  (
    dup '0 '9 n:between
    !if
      'a n:-
      cipher swap s:@ nip
    then
  ) s:map ;


\ Encode a string to atbash:
: >atbash \ s -- s
  s:lc
  (atbash)
  [5] s:/
  " " a:join ;


\ Decode a string from atbash:
: atbash> \ s -- s
  (atbash) ;
1 Like

It should be clarified that I did not write the atbash-cipher code, nor the series code.
@jalih get’s credit for series and @ronaaron for atbash-cipher (his reworking of @jalih’s original)

1 Like

You want slimline? You get slimline!

@glennj I’ve found the issue:

Secrets are not passed to workflows that are triggered by a pull request from a fork. Learn more.

So this is a fundamental limitation of GitHub actions. The only way around this would be to allow you to push branches directly to the repo.

I’ve just checked both your PRs and they both pass CI locally.

@glennj Do you want to update the PRs to reflect this? I can then merge the PRs afterwards.

Contributors are updated.

Regarding merging from forks, that’s how I’ve done all my exercism development. won’t this github change make OSS development more difficult? I guess I’ll just have to get used to cloning not forking.

Well, the issue only manifests itself when working with workflows that use secrets, which we very rarely use. I think the 8th repo might be the only repo where we do, so don’t worry about it.

Perfect, I’ve merged the PRs.

And it is a great idea to reuse the test runner for CI.
And the 8th test runner is extremely fast.