changing redis from install to service; hoping it works #79
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
| # based on | |
| # https://github.com/ledgetech/lua-resty-http/blob/master/.github/workflows/test.yml | |
| name: Test | |
| on: | |
| push: | |
| paths-ignore: # Skip if only docs are updated | |
| - '*.md' | |
| jobs: | |
| luacheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: leafo/gh-actions-lua@v8 | |
| with: | |
| luaVersion: "luajit-openresty" | |
| - uses: leafo/gh-actions-luarocks@v4 | |
| - run: luarocks install luacheck | |
| - run: luacheck lib --no-unused | |
| run_tests: | |
| strategy: | |
| matrix: | |
| openresty_version: | |
| - 1.17.8.1 | |
| - 1.19.3.1 | |
| runs-on: ubuntu-latest | |
| container: | |
| image: openresty/openresty:${{ matrix.openresty_version }}-alpine-fat | |
| # --init runs tinit as PID 1 and prevents the 'WARNING: killing the child process' spam from the test suite | |
| options: --init | |
| # Service containers to run with `container-job` | |
| services: | |
| # Label used to access the service container | |
| redis: | |
| # Docker Hub image | |
| image: redis | |
| # Set health checks to wait until redis has started | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| # Maps port 6379 on service container to the host | |
| - 6379:6379 | |
| steps: | |
| # redis-server and the conf are installed by the package | |
| # see https://pkgs.alpinelinux.org/contents?branch=edge&name=redis&arch=x86_64&repo=main | |
| # this container doesn't seem to have the alpine linux start utilities, so daemonize it | |
| - name: Install deps | |
| run: | | |
| apk add --no-cache curl perl bash wget git perl-dev libarchive-tools | |
| ln -s /usr/bin/bsdtar /usr/bin/tar | |
| opm get ledgetech/lua-resty-http | |
| - name: Install CPAN | |
| run: curl -s -L http://xrl.us/cpanm > /bin/cpanm && chmod +x /bin/cpanm | |
| - name: Cache | |
| uses: actions/cache@v2 | |
| with: | |
| path: | | |
| ~/.cpan | |
| ~/.cache | |
| key: ${{ runner.os }}-${{ matrix.openresty_version }}-cache | |
| - name: Install Test::Nginx | |
| run: cpanm -q -n Test::Nginx | |
| - name: Install Luacov | |
| run: luarocks install luacov | |
| - uses: actions/checkout@v2 | |
| - name: Run tests | |
| env: | |
| TEST_COVERAGE: '1' | |
| run: | | |
| /usr/bin/prove -I../test-nginx/lib -r t/ | |
| - name: Coverage | |
| run: | | |
| luacov | |
| tail -n 8 luacov.report.out |