Enable logging for e2e tests #1485
This file contains 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: Test | |
on: | |
push: | |
branches: ["main"] | |
pull_request_target: | |
branches: ["main"] | |
jobs: | |
go_test: | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 # for sonarcloud | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- run: "make verify" | |
- run: "make test" | |
- uses: SonarSource/sonarqube-scan-action@v4.2.1 | |
if: ${{ github.event_name == 'push' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
ext_pr: | |
if: ${{ github.event_name == 'pull_request_target' }} | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 2 # for diff | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: generate comment message | |
run: | | |
printf '%s\n%s\n\n' '### External PR' 'Test runs on external PRs require manual approval.' >"${{ runner.temp }}/msg" | |
git diff --name-only -z HEAD^1 HEAD | grep -Evz '\.go$|^docs/' | tr '\0' '\n' >"${{ runner.temp }}/diff" | |
if [ -s '${{ runner.temp }}'/diff ]; then | |
echo '**Note:** This PR changes the following non-go, non-docs files:' >>"${{ runner.temp }}/msg" | |
cat "${{ runner.temp }}/diff" >>"${{ runner.temp }}/msg" | |
fi | |
- uses: thollander/actions-comment-pull-request@v3 | |
with: | |
comment_tag: test | |
mode: recreate | |
file-path: ${{ runner.temp }}/msg |