Skip to content

Commit

Permalink
Add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
ugexe committed Aug 22, 2023
1 parent b0b9fdc commit b45b7d0
Showing 1 changed file with 127 additions and 0 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: test

on: [ push, pull_request ]

jobs:
raku:
strategy:
fail-fast: false
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
raku-version: [ latest ]
runs-on: ${{ matrix.os }}
env:
# Workaround for path length errors during precompilation of longer repo names
TMPDIR: /tmp

steps:
- uses: actions/checkout@v3
- uses: Raku/setup-raku@v1
with:
raku-version: ${{ matrix.raku-version }}

- name: Sanity
run: |
raku -I. -MZef::Utils::FileSystem -e 'delete-paths($_) for <site home vendor>.map({ CompUnit::RepositoryRegistry.repository-for-name($_) }).map(*.prefix.absolute)'
raku -e 'use NativeCall; use Test;'
raku -I. 'use NativeCall; use Test;'
raku -I. -e 'use Zef::CLI'
# Disable precompilation on windows as there are a couple of issues:
# 1) Windows doesn't allow you to delete files that are open. This can naturally
# occur when zef tries to delete itself, such as in one of the next steps where
# we want to delete the existing zef install on the GH image (so we only have the
# zef from whatever branch triggered this) or where we do a --force-install test
# that tries to overwrite a precomp file in use.
# 2) Rakudo does not yet work around Windows path length limitations. This is a problem
# due to the precompilation folder structure being fairly long as well as repos that
# get cloned/extracted potentially having longer-ish names.
# Note RAKUDO_NO_PRECOMPILATION was added to rakudo as of 2023.08, so we can't test
# older versions of rakudo on windows.
- name: Disable precompilation on Windows to avoid long path issues
if: runner.os == 'Windows'
run: echo "RAKUDO_NO_PRECOMPILATION=1" >> $env:GITHUB_ENV

- name: Ensure TMPDIR exists
run: mkdir -p ${{ env.TMPDIR }}

# Note that we use `raku -I. bin/zef nuke ...` instead of `zef nuke ...` because deleting
# the module installation directories on windows can cause an error due to one of those files
# being the currently-loaded zef itself.
# This used to be the very last CI test, but because we need to delete the already-installed
# verison of zef that comes with this github action it has been moved to be one of the first.
- name: Remove non-core modules included in this github action + Test 'nuke' on repo names
run: raku -I. bin/zef nuke site home --/confirm

# test explicitly via `prove t/*` and `raku t/foo.rakutest && raku t/bar.rakutest`
# both should work, since all our CI envs have prove
- name: Run unit tests with '--prove'
run: raku -I. bin/zef --debug --/tap-harness --prove --/raku-test test .
- name: Run unit tests with '--raku-test'
run: raku -I. bin/zef --debug --/tap-harness --/prove --raku-test test .

# run xt/ tests
- name: Run xt/ tests - repository.rakutest
run: raku --ll-exception -I. xt/repository.rakutest
- name: Run xt/ tests - install.rakutest
run: raku --ll-exception -I. xt/install.rakutest

# run integration tests pre-install
- name: Test (and show for debugging purposes) --version
run: raku -I. bin/zef --version
- name: Run relative local path test + install
run: raku -I. bin/zef --debug install .
- name: Test uninstall
run: raku -I. bin/zef uninstall zef
- name: Run absolute local path test + install
run: raku -I. bin/zef install ${{ github.workspace }}

# run integration tests post-install
- name: Test 'update'
run: zef update --debug
- name: Test --version
run: zef --version
- name: Test --help
run: zef --help
- name: Test 'locate' with short-name
run: zef locate Zef::CLI
- name: Test 'locate' with path name
run: zef locate lib/Zef/CLI.rakumod
- name: Test 'browse'
run: zef browse zef bugtracker --/open
- name: Test 'info'
run: zef info zef
- name: Test 'search'
run: zef --debug search Base64
- name: Test 'rdepends'
run: zef --debug rdepends Base64
- name: Test 'depends'
run: zef --debug depends Cro::SSL
- name: Test 'fetch'
run: zef --debug fetch Base64
- name: Test installing from what 'fetch' put in ::LocalCache
run: zef --debug --/fez --/cpan --/p6c --/rea install Base64
- name: Test 'list'
run: zef --debug --max=10 list
- name: Test 'list --installed'
run: zef --debug --installed list
- name: Test reinstallation via 'install --force-install'
run: zef --debug --force-install install Base64
- name: Test installing .tar.gz
run: zef --debug install https://github.com/ugexe/Raku-PathTools/archive/0434191c56e0f3254ab1d756d90f9191577de5a0.tar.gz
- name: Test 'upgrade' on previously installed PathTools .tar.gz
run: zef --debug upgrade PathTools
- name: Test installing .zip
run: zef --debug install https://github.com/ugexe/Raku-Text--Table--Simple/archive/v0.0.3.zip
- name: Test remote git repo + tag
run: zef --debug install https://github.com/ugexe/[email protected]
- name: Test self contained installation
run: |
zef install Distribution::Common --/test
zef install Distribution::Common::Remote -to=inst#foo --contained --/test
zef uninstall Distribution::Common
raku -I inst#foo -M Distribution::Common::Remote::Github -e ""
- name: Test 'nuke' on config paths
run: zef --/confirm nuke TempDir StoreDir
- name: Test single repository update ('cached' should be 0 after previous nuke)
run: zef update cached --debug

0 comments on commit b45b7d0

Please sign in to comment.