From c82872bbc9c1067c033c37c32c275bf0258de141 Mon Sep 17 00:00:00 2001 From: dvoraen <42825596+dvoraen@users.noreply.github.com> Date: Thu, 1 Dec 2022 14:28:45 -0800 Subject: [PATCH 1/4] moving file to new place --- .github/actions/setup-database.yml | 86 ------------------------------ 1 file changed, 86 deletions(-) delete mode 100644 .github/actions/setup-database.yml diff --git a/.github/actions/setup-database.yml b/.github/actions/setup-database.yml deleted file mode 100644 index bd646a0a87..0000000000 --- a/.github/actions/setup-database.yml +++ /dev/null @@ -1,86 +0,0 @@ -# evennia/setup-database - -# Use this action in a workflow for when you need to do initialization of database services -# (such as with PostgreSQL and MySQL) before you initiate unit tests that will employ that -# database service. - -# NOTE: This action was intended for use with the core Evennia workflows ONLY. - -name: Set up Evennia database service -author: dvoraen -description: "Activates the database server for the passed in service and ensures it's ready for use." - -inputs: - database: - description: "Database service being initialized." - type: string - required: true - -runs: - using: "composite" - - steps: - - name: Set up PostgreSQL server - if: ${{ inputs.database == 'postgresql' }} - uses: harmon758/postgresql-action@v1 - with: - postgresql version: "11" - postgresql db: "evennia" - postgresql user: "evennia" - postgresql password: "password" - - - name: Wait for PostgreSQL to activate - if: ${{ inputs.database == 'postgresql' }} - run: | - while ! pg_isready -h 127.0.0.1 -q >/dev/null 2>&1 - do - sleep 1 - echo -n . - done - echo - shell: bash - - - name: Set up MySQL server - if: ${{ inputs.database == 'mysql' }} - uses: mirromutth/mysql-action@v1.1 - with: - host port: 3306 - # character set server: "utf8mb4" - # collation server: "utf8mb4_unicode_ci" - character set server: "utf8" - collation server: "utf8_general_ci" - mysql database: "evennia" - mysql user: "evennia" - mysql password: "password" - mysql root password: root_password - - - name: Wait for MySQL to activate - if: ${{ inputs.database == 'mysql' }} - run: | - while ! mysqladmin ping -h 127.0.0.1 -u root -proot_password -s >/dev/null 2>&1 - do - sleep 1 - echo -n . - done - echo - shell: bash - - - name: Set up MySQL Privileges - if: ${{ inputs.database == 'mysql' }} - run: | - cat < Date: Thu, 1 Dec 2022 14:28:57 -0800 Subject: [PATCH 2/4] create action directory and yml --- .github/actions/setup-database/action.yml | 85 +++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/actions/setup-database/action.yml diff --git a/.github/actions/setup-database/action.yml b/.github/actions/setup-database/action.yml new file mode 100644 index 0000000000..b580d65e03 --- /dev/null +++ b/.github/actions/setup-database/action.yml @@ -0,0 +1,85 @@ +# evennia/setup-database + +# Use this action in a workflow for when you need to do initialization of database services +# (such as with PostgreSQL and MySQL) before you initiate unit tests that will employ that +# database service. + +# NOTE: This action was intended for use with the core Evennia workflows ONLY. + +name: Set up Evennia database service +author: dvoraen +description: "Activates the database server for the passed in service and ensures it's ready for use." + +inputs: + database: + description: "Database service being initialized." + required: true + +runs: + using: "composite" + + steps: + - name: Set up PostgreSQL server + if: ${{ inputs.database == 'postgresql' }} + uses: harmon758/postgresql-action@v1 + with: + postgresql version: "11" + postgresql db: "evennia" + postgresql user: "evennia" + postgresql password: "password" + + - name: Wait for PostgreSQL to activate + if: ${{ inputs.database == 'postgresql' }} + run: | + while ! pg_isready -h 127.0.0.1 -q >/dev/null 2>&1 + do + sleep 1 + echo -n . + done + echo + shell: bash + + - name: Set up MySQL server + if: ${{ inputs.database == 'mysql' }} + uses: mirromutth/mysql-action@v1.1 + with: + host port: 3306 + # character set server: "utf8mb4" + # collation server: "utf8mb4_unicode_ci" + character set server: "utf8" + collation server: "utf8_general_ci" + mysql database: "evennia" + mysql user: "evennia" + mysql password: "password" + mysql root password: root_password + + - name: Wait for MySQL to activate + if: ${{ inputs.database == 'mysql' }} + run: | + while ! mysqladmin ping -h 127.0.0.1 -u root -proot_password -s >/dev/null 2>&1 + do + sleep 1 + echo -n . + done + echo + shell: bash + + - name: Set up MySQL Privileges + if: ${{ inputs.database == 'mysql' }} + run: | + cat < Date: Thu, 1 Dec 2022 14:33:23 -0800 Subject: [PATCH 3/4] fix missing shell property --- .github/actions/setup-database/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-database/action.yml b/.github/actions/setup-database/action.yml index b580d65e03..2950019a78 100644 --- a/.github/actions/setup-database/action.yml +++ b/.github/actions/setup-database/action.yml @@ -83,3 +83,4 @@ runs: - name: Check running containers if: ${{ inputs.database == 'postgresql' || inputs.database == 'mysql' }} run: docker ps -a + shell: bash From e173b6ef6f7fcb934ff3a46317f24b6828461150 Mon Sep 17 00:00:00 2001 From: dvoraen <42825596+dvoraen@users.noreply.github.com> Date: Thu, 1 Dec 2022 14:57:06 -0800 Subject: [PATCH 4/4] deploy job only runs if relevant branches --- .github/workflows/github_action_test_suite.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/github_action_test_suite.yml b/.github/workflows/github_action_test_suite.yml index b46808cb65..7a3adcaee8 100644 --- a/.github/workflows/github_action_test_suite.yml +++ b/.github/workflows/github_action_test_suite.yml @@ -107,7 +107,7 @@ jobs: name: Deploy Docker Image needs: test runs-on: ubuntu-latest - if: ${{ github.repository == 'evennia/evennia' }} + if: ${{ github.repository == 'evennia/evennia' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') }} steps: - uses: actions/checkout@v3 @@ -118,7 +118,6 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Login to DockerHub - if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' }} uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }}