Bump find-my-way from 8.1.0 to 8.2.2 #3895
Workflow file for this run
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: gci-e2e | |
on: | |
schedule: | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
push: | |
branches: [master] | |
pull_request: | |
paths-ignore: | |
- "images/**" | |
- "sql/analytics/**" | |
- "**.md" | |
- "docs/**" | |
- "i18n/**" | |
pull_request_target: | |
types: [labeled] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
if: ${{!github.event.issue.pull_request_target || contains(github.event.pull_request.labels.*.name, 'safe to test')}} | |
env: | |
DB_PASS_CI: kmq_ci_password | |
DB_USER_CI: root | |
DB_PORT: 3306 | |
steps: | |
- name: Checkout KMQ_Discord | |
uses: actions/checkout@v4 | |
- name: Copy .env for CI | |
env: | |
BOT_TOKEN: ${{ secrets.KMQ_CI_BOT_TOKEN }} | |
BOT_CLIENT: ${{ secrets.BOT_CLIENT }} | |
END_TO_END_TEST_BOT_TOKEN: ${{ secrets.END_TO_END_TEST_BOT_TOKEN }} | |
END_TO_END_TEST_BOT_CLIENT: ${{ secrets.END_TO_END_TEST_BOT_CLIENT }} | |
END_TO_END_TEST_BOT_CHANNEL: ${{ secrets.END_TO_END_TEST_BOT_CHANNEL }} | |
END_TO_END_TEST_BOT_VOICE_CHANNEL: ${{ secrets.END_TO_END_TEST_BOT_VOICE_CHANNEL }} | |
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }} | |
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }} | |
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} | |
run: | | |
echo "DB_USER=$DB_USER_CI" >> .env | |
echo "DB_PASS=$DB_PASS_CI" >> .env | |
echo "DB_PORT=$DB_PORT" >> .env | |
echo "DB_HOST=127.0.0.1" >> .env | |
echo "BOT_TOKEN=$BOT_TOKEN" >> .env | |
echo "WEB_SERVER_PORT=5858" >> .env | |
echo "SONG_DOWNLOAD_DIR=/songs" >> .env | |
echo "BOT_CLIENT_ID=$BOT_CLIENT" >> .env | |
echo "BOT_PREFIX=." >> .env | |
echo "APP_NAME=kmq-gci" >> .env | |
echo "DAISUKI_DB_PASSWORD=unusedpw" >> .env | |
echo "END_TO_END_TEST_BOT_TOKEN=$END_TO_END_TEST_BOT_TOKEN" >> .env | |
echo "END_TO_END_TEST_BOT_CLIENT=$END_TO_END_TEST_BOT_CLIENT" >> .env | |
echo "END_TO_END_TEST_BOT_CHANNEL=$END_TO_END_TEST_BOT_CHANNEL" >> .env | |
echo "END_TO_END_TEST_BOT_VOICE_CHANNEL=$END_TO_END_TEST_BOT_VOICE_CHANNEL" >> .env | |
echo "SPOTIFY_CLIENT_ID=$SPOTIFY_CLIENT_ID" >> .env | |
echo "SPOTIFY_CLIENT_SECRET=$SPOTIFY_CLIENT_SECRET" >> .env | |
echo "YOUTUBE_API_KEY=$YOUTUBE_API_KEY" >> .env | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Setup MariaDB | |
uses: getong/[email protected] | |
with: | |
mariadb version: "10.6.17" | |
mysql root password: "$DB_PASS_CI" | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: docker/kmq/Dockerfile | |
push: false | |
tags: ghcr.io/brainicism/kmq_discord:gci | |
- name: Determine if MOCK_AUDIO should be set | |
id: check_labels | |
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | |
run: | | |
# Extract the labels from the PR | |
LABELS="$(gh api repos/$OWNER/$REPO_NAME/pulls/$PULL_REQUEST_NUMBER --jq '.labels.[].name')" | |
# Check if "mock audio" is among the labels | |
if echo "$LABELS" | grep -q "mock audio"; then | |
echo "MOCK_AUDIO=true" >> $GITHUB_ENV | |
else | |
echo "MOCK_AUDIO=false" >> $GITHUB_ENV | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO_NAME: ${{ github.event.repository.name }} | |
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Acquire youtube session tokens | |
if: ${{ env.MOCK_AUDIO != 'true' }} | |
run: mkdir data && bash src/scripts/session-generator.sh data/ bgutil | |
- name: Dry-run bootstrap | |
run: | | |
. ./.env | |
docker run \ | |
-v ${SONG_DOWNLOAD_DIR}:${SONG_DOWNLOAD_DIR} \ | |
-v ${PWD}/data:/app/data \ | |
-v ${PWD}/.env:/app/.env \ | |
-v ${PWD}/logs:/app/logs \ | |
--env NODE_ENV=dry-run \ | |
${MOCK_AUDIO:+--env MOCK_AUDIO=$MOCK_AUDIO} \ | |
--network=host \ | |
--name kmq-gci \ | |
ghcr.io/brainicism/kmq_discord:gci && docker rm -f kmq-gci | |
- name: Validate available_songs | |
run: | | |
[[ $(mysql kmq -s -N -h 127.0.0.1 -u $DB_USER_CI -p$DB_PASS_CI -e 'select count(1) from available_songs') -eq 6 ]] | |
- name: Pre-upgrade run | |
run: . ./.env && docker run -v ${SONG_DOWNLOAD_DIR}:${SONG_DOWNLOAD_DIR} -v ${PWD}/data:/app/data -v ${PWD}/.env:/app/.env -v ${PWD}/logs:/app/logs --env NODE_ENV=production --network=host --name kmq-gci ghcr.io/brainicism/kmq_discord:gci & | |
- name: Check pre-upgrade KMQ healthiness | |
run: while [[ "$(docker inspect --format='{{json .State.Health.Status}}' kmq-gci)" != "\"healthy\"" ]]; do sleep 1; done | |
- name: Run test runner on live instance (game options test) | |
run: docker exec --env-file ./.env kmq-gci sh -c 'npx ts-node --swc src/test/end-to-end-tests/test-runner-bot.ts --test-suite=BASIC_OPTIONS --debug; exit $?' | |
- name: Run test runner on live instance (gameplay test) | |
run: docker exec --env-file ./.env kmq-gci sh -c 'npx ts-node --swc src/test/end-to-end-tests/test-runner-bot.ts --test-suite=PLAY --debug; exit $?' | |
- name: Check for errors | |
if: always() | |
run: docker logs kmq-gci 2>&1 | grep -i "\[Error\]" && echo "Errors found in container logs." && exit 1 || echo "No errors found in container logs." && exit 0 | |
- name: Print logs | |
if: always() | |
run: | | |
docker logs kmq-gci 2>&1 | |
docker inspect kmq-gci | jq '.[].State' | |
docker --version | |
- name: Parse pre-upgrade container ID | |
id: old-container-id | |
run: | | |
docker ps | |
echo OLD_CONTAINER_ID=$(sudo docker ps -aqf "name=kmq-gci") > $GITHUB_OUTPUT | |
- name: Begin upgrade | |
run: bash src/scripts/announce-restart.sh --docker-image ghcr.io/brainicism/kmq_discord:gci --timer 0 --provisioning-timeout 15 | |
- name: Check post-upgrade KMQ healthiness | |
run: while [[ "$(docker inspect --format='{{json .State.Health.Status}}' kmq-gci)" != "\"healthy\"" ]]; do sleep 1; done | |
- name: Check old primary no longer exists | |
run: | | |
docker ps | |
[ $(docker ps -aq | grep -c ${{ steps.old-container-id.outputs.OLD_CONTAINER_ID }}) -eq 0 ] |