Skip to content

ytmapi-rs: Wrong value in album, duration if song has multiple artists (with my crappy solution) #110

ytmapi-rs: Wrong value in album, duration if song has multiple artists (with my crappy solution)

ytmapi-rs: Wrong value in album, duration if song has multiple artists (with my crappy solution) #110

Workflow file for this run

# Inspired by https://grem1.in/post/gha-comment-trigger/
name: Integration tests on comment
on:
issue_comment:
types:
- created
env:
CARGO_TERM_COLOR: always
jobs:
integration-tests:
name: Integration tests triggered from a specific PR comment
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/test' && (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER')}}
runs-on: ubuntu-latest
steps:
- name: Put a reaction to the comment
run: gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ID: ${{ github.event.comment.node_id }}
- name: Check if PR is open
run: |
STATE=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json state --jq .state)
if [ "$STATE" != "OPEN" ]; then
echo "Cannot build for closed PRs"
(
echo "**${{ github.workflow }}**"
echo "Cannot build for a closed PR. Use the `latest` version (built for the `master` branch) or create a new PR."
) | \
gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F -
gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_DOWN}){reaction{content}subject{id}}}"
gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
NODE_ID: ${{ github.event.comment.node_id }}
- name: Get PR HEAD Ref
id: getRef
run: echo "pr_ref=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json headRefOid | jq -r '.headRefOid')" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
- name: Checkout source code from Github
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.getRef.outputs.pr_ref }}
- name: Update rust
run: rustup update
- name: Install linux deps
run: |
sudo apt update
sudo apt install -y --no-install-recommends libasound2-dev pkg-config
- name: Build
run: cargo build --verbose
- name: Run integration tests
env:
youtui_test_cookie: ${{ secrets.COOKIE_SECRET }}
youtui_test_oauth: ${{ secrets.EXPIRED_OAUTH_SECRET }}
run: |
# NOTE: Future refactor target here with scheduled.yml workflow.
# live_integration_tests are API tests for ytmapi_rs
cargo test --verbose --test live_integration_tests
# ignored tests are other tests live tests that shouldn't be run on every push - e.g downloading.
cargo test --verbose -- --ignored
- name: Final Comment
run: |
gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_UP}){reaction{content}subject{id}}}"
gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}"
(
echo "**${{ github.workflow }}**"
echo "Integration tests run succesfully."
echo
echo "You can find the workflow here:"
echo "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
) | \
gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F -
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
NODE_ID: ${{ github.event.comment.node_id }}
notify-job:
needs: [integration-tests]
runs-on: ubuntu-latest
if: ${{ always() && contains(needs.integration-tests.result, 'failure') }}
steps:
- name: Notify on Failure
run: |
gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_DOWN}){reaction{content}subject{id}}}"
gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}"
(
echo "**${{ github.workflow }}**"
echo "**Something went wrong!**"
echo
echo "**Details:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
) | \
gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F -
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
NODE_ID: ${{ github.event.comment.node_id }}