From 69a7186364884792557d4c24438ecd4dfeb3c4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Joaqu=C3=ADn=20Atria?= Date: Mon, 23 Oct 2023 19:15:48 +0100 Subject: [PATCH] Add CI setup --- .github/workflows/test.yml | 81 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..29102cc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,81 @@ +name: Test + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + + # All supported Perl versions except latest. + perl: [ + '5.32', '5.34', '5.36', + ] + + # Variants of the latest Perl. + include: + # FIXME: What packages are required on Mac OS? + # - os: macos-latest + # perl: '5.38' + + # FIXME: Windows tests started failing around the time we + # moved to lvalue setters. Why? + # - os: windows-latest + # perl: '5.38' + + # This is effectively our normal one: all features and cover. + - name: ' (all)' + os: ubuntu-latest + perl: '5.38' + cover: true + + runs-on: ${{ matrix.os }} + + name: v${{ matrix.perl }} on ${{ matrix.os }}${{ matrix.name }} + + steps: + - uses: actions/checkout@v2 + + - uses: shogo82148/actions-setup-perl@v1 + with: + perl-version: ${{ matrix.perl }} + + - uses: ConorMacBride/install-package@v1 + with: + apt: g++ cmake libprotobuf-dev libprotoc-dev + + - name: Show diagnostics + run: | + perl -v + cpanm --showdeps . + + # FIXME: Install the API and SDK from the repository for now, + # until it is on CPAN + - name: Install dependencies + run: | + cpanm -n https://github.com/jjatria/perl-opentelemetry.git + cpanm -n https://github.com/jjatria/perl-opentelemetry-sdk.git + cpanm --installdeps -n . + + - if: ${{ matrix.cover }} + run: cpanm -n Devel::Cover::Report::Coveralls + + - name: Build + run: | + perl Makefile.PL + + - if: ${{ matrix.cover }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: cover -report Coveralls -test + + - if: ${{ !matrix.cover }} + run: make test