Add unit tests via tested in CI #80
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Tests and Code Coverage | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # TODO: re-add lua=5.5 once argparse has been updated | |
| lua: [lua=5.1, lua=5.2, lua=5.3, lua=5.4, luajit=@v2.0, luajit=@v2.1] | |
| steps: | |
| # Checks-out the repository under $GITHUB_WORKSPACE. | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '>=1.19' | |
| - name: Install libreadline | |
| run: sudo apt-get install -y libreadline-dev | |
| - name: Install Lua (${{ matrix.lua }}) | |
| run: | | |
| pip install git+https://github.com/luarocks/hererocks | |
| hererocks -r^ --${{ matrix.lua }} lua_install | |
| echo lua_install/bin >> $GITHUB_PATH | |
| - name: Install toml-test | |
| run: go install github.com/toml-lang/toml-test/v2/cmd/toml-test@latest | |
| - name: install depedencies | |
| run: | | |
| luarocks install lua-cjson | |
| luarocks install luacov | |
| luarocks install tested | |
| luarocks install luacov-coveralls | |
| - name: run toml-test with coverage | |
| continue-on-error: true | |
| run: | | |
| toml-test test -parallel 1 -toml=1.1 -decoder="lua_install/bin/lua -lluacov spec/decoder.lua" -encoder="lua_install/bin/lua -lluacov spec/encoder.lua" | |
| - name: Run unit tests | |
| run: | | |
| tested -c | |
| - name: Report test coverage | |
| if: success() | |
| continue-on-error: true | |
| run: luacov-coveralls -e .luarocks | |
| env: | |
| COVERALLS_REPO_TOKEN: ${{ github.token }} | |