From a0fe4c397f871173f5f48a2daa5036fe516f69c6 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Mon, 11 Dec 2023 23:46:10 -0500 Subject: [PATCH 1/6] Add GHA CI --- .github/workflows/ci.yml | 153 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1824925 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,153 @@ +name: Run Tests + +on: + workflow_dispatch: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + create: + +env: + PKG_NAME: Tarql + PKG_UBUNTU: ~ + PKG_HOMEBREW: ~ + PKG_MSYS2_MINGW64: ~ + PKG_MSYS2_MINGW64_DEPS: >- + base-devel + unzip + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-perl + +jobs: + notify: + runs-on: ubuntu-latest + continue-on-error: true + if: ${{ always() }} + steps: + - uses: perlrdf/devops/github-actions/irc-notifications@main + with: + target-notifications: false + dist: + if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} + name: Make distribution + runs-on: ubuntu-latest + outputs: + min-perl-version: ${{ steps.build-dist.outputs.min-perl-version }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + - id: build-dist + uses: perlrdf/devops/github-actions/build-dist@main + with: + dist-perl-deps-develop: strict # Add modules + test: + needs: [ 'dist', 'notify' ] + runs-on: ${{ matrix.os }} + defaults: + run: + # bash on macos and linux + # powershell on windows + strawberry perl + # msys2 {0} on windows + msys2 + shell: >- + ${{ fromJSON( '["", "bash {0}"]' )[ startsWith(matrix.os, 'ubuntu-' ) || startsWith(matrix.os, 'macos-') ] + }}${{ fromJSON( '["", "powershell {0}"]' )[ startsWith(matrix.os, 'windows-') && matrix.dist == 'strawberry' ] + }}${{ fromJSON( '["", "msys2 {0}"]' )[ startsWith(matrix.os, 'windows-') && matrix.dist == 'msys2' ] }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + perl-version: ['5.8', '5.20', '5.30', '5.34'] + alien-install-type: [ 'share' ] + include: + # Windows strawberry | share + - { perl-version: '5.34' , os: windows-latest , dist: strawberry , alien-install-type: 'share' } + # Windows msys2 | system, share + #- { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'system' } + - { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'share' } + # macOS | system, share + #- { perl-version: '5.34' , os: macos-11 , alien-install-type: 'system' } + - { perl-version: '5.34' , os: macos-11 , alien-install-type: 'share' } + name: Perl ${{ matrix.perl-version }} on ${{ matrix.os }} with install-type ${{ matrix.alien-install-type }}, dist ${{ matrix.dist }} + + steps: + - name: Get dist artifact + uses: actions/download-artifact@v3 + with: + name: dist + + # Setup system package + - name: Setup system ${{ env.PKG_NAME }} (apt) + if: runner.os == 'Linux' && matrix.alien-install-type == 'system' + run: | + sudo apt-get -y update && sudo apt-get install -y ${{ env.PKG_UBUNTU }} + - name: Setup system ${{ env.PKG_NAME }} (homebrew) + if: runner.os == 'macOS' && matrix.alien-install-type == 'system' + run: | + brew install ${{ env.PKG_HOMEBREW }} + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 + if: runner.os == 'Windows' && matrix.dist == 'msys2' + with: + update: true + install: ${{ env.PKG_MSYS2_MINGW64_DEPS }} + - name: Set up ${{ env.PKG_NAME }} (MSYS2/MinGW pacman) + if: runner.os == 'Windows' && matrix.dist == 'msys2' && matrix.alien-install-type == 'system' + shell: msys2 {0} + run: | + pacman -S --needed --noconfirm ${{ env.PKG_MSYS2_MINGW64 }} + + # Setup Perl + - name: Set up perl + uses: shogo82148/actions-setup-perl@v1 + if: runner.os != 'Windows' + with: + perl-version: ${{ matrix.perl-version }} + - name: Set up perl (Strawberry) + uses: shogo82148/actions-setup-perl@v1 + if: runner.os == 'Windows' && matrix.dist == 'strawberry' + with: + distribution: 'strawberry' + + - run: perl -V + - name: Install cpanm + if: runner.os == 'Windows' && matrix.dist == 'msys2' + run: + yes | cpan -T App::cpanminus || true + + - name: Install Perl deps + run: | + cpanm --notest --installdeps . + + - name: Install share install deps before setting ALIEN_INSTALL_TYPE + if: matrix.alien-install-type == 'share' + run: | + cpanm --notest Net::SSLeay IO::Socket::SSL + + - name: Set ALIEN_INSTALL_TYPE + shell: bash + run: | + echo "ALIEN_INSTALL_TYPE=${{ matrix.alien-install-type }}" >> $GITHUB_ENV + + - name: Set ALIEN_BUILD_PKG_CONFIG + if: runner.os == 'Windows' && matrix.dist == 'msys2' + run: | + echo "ALIEN_BUILD_PKG_CONFIG=PkgConfig::CommandLine" >> $GITHUB_ENV + + - name: Run tests + env: + ALIEN_BUILD_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cpanm --verbose --test-only . + build-status: + runs-on: ubuntu-latest + continue-on-error: true + if: ${{ always() }} + needs: test + steps: + - uses: perlrdf/devops/github-actions/irc-notifications@main + with: + target-build-status: false + needs: ${{ toJSON(needs) }} From d7a945c6755660f22448aa9c8d9a368c7f157cae Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Tue, 12 Dec 2023 01:02:41 -0500 Subject: [PATCH 2/6] MSWin32: use tarql.bat on Windows --- t/alien_tarql.t | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/alien_tarql.t b/t/alien_tarql.t index db5ea7d..6695c45 100644 --- a/t/alien_tarql.t +++ b/t/alien_tarql.t @@ -6,7 +6,8 @@ use Alien::Tarql; alien_diag 'Alien::Tarql'; alien_ok 'Alien::Tarql'; -run_ok([ 'tarql', '--version' ]) +my $tarql = $^O ne 'MSWin32' ? 'tarql' : 'tarql.bat'; +run_ok([ $tarql, '--version' ]) ->success ->out_like(qr/tarql:\s+VERSION:\s+([0-9\.]+)/); From 985fc68ede9fcef317713ad77432b14429ede05c Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Tue, 12 Dec 2023 01:09:16 -0500 Subject: [PATCH 3/6] GHA: disable MSYS2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1824925..05ca9e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: - { perl-version: '5.34' , os: windows-latest , dist: strawberry , alien-install-type: 'share' } # Windows msys2 | system, share #- { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'system' } - - { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'share' } + #- { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'share' } # macOS | system, share #- { perl-version: '5.34' , os: macos-11 , alien-install-type: 'system' } - { perl-version: '5.34' , os: macos-11 , alien-install-type: 'share' } From 4b5876d3af524ab10738140474e2feca317e2ee0 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Tue, 12 Dec 2023 01:41:39 -0500 Subject: [PATCH 4/6] GHA: use actions/setup-java --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05ca9e6..e8c2cb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,6 +99,12 @@ jobs: run: | pacman -S --needed --noconfirm ${{ env.PKG_MSYS2_MINGW64 }} + # Setup Java + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + # Setup Perl - name: Set up perl uses: shogo82148/actions-setup-perl@v1 From 27dd04658b00a34268e69f05026b1f549e493e87 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Tue, 12 Dec 2023 02:01:23 -0500 Subject: [PATCH 5/6] Add issue-notify.yml --- .github/workflows/issue-notify.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/issue-notify.yml diff --git a/.github/workflows/issue-notify.yml b/.github/workflows/issue-notify.yml new file mode 100644 index 0000000..1511a78 --- /dev/null +++ b/.github/workflows/issue-notify.yml @@ -0,0 +1,21 @@ +name: issue-notify + +on: + issues: + types: [opened,assigned,closed,reopened] + issue_comment: + types: [created] + pull_request: + types: [closed,assigned,converted_to_draft,ready_for_review,review_requested] + pull_request_review: + types: [submitted] + +jobs: + notify: + runs-on: ubuntu-latest + continue-on-error: true + if: ${{ always() }} + steps: + - uses: perlrdf/devops/github-actions/irc-notifications@main + with: + target-notifications: true From 5397258c503fe6b935194e3b298ff5927c5d3b4a Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Tue, 12 Dec 2023 02:03:27 -0500 Subject: [PATCH 6/6] GHA: enable notifications --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8c2cb6..46686e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: steps: - uses: perlrdf/devops/github-actions/irc-notifications@main with: - target-notifications: false + target-notifications: true dist: if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} name: Make distribution @@ -155,5 +155,5 @@ jobs: steps: - uses: perlrdf/devops/github-actions/irc-notifications@main with: - target-build-status: false + target-build-status: true needs: ${{ toJSON(needs) }}