From f86582e393763fabd04361bea19783cc73decbd9 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 16 Oct 2021 22:09:29 -0400 Subject: [PATCH] Use actions-setup-mysql for MySQL --- .github/workflows/ci.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfff0063..358598be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ name: Continuous Integration jobs: test: name: Build & Test + if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ${{matrix.os.fullName}} strategy: fail-fast: false @@ -21,6 +22,11 @@ jobs: DB_USER: lighthouse DB_PASSWORD: lighthouse steps: + - name: Cancel previous runs of this workflow + uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + - name: Checkout uses: actions/checkout@v2 @@ -40,14 +46,17 @@ jobs: run: dotnet build -c Debug - name: Start MySQL - if: ${{ matrix.os.database }} - run: | - sudo service mysql start - mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} - + uses: shogo82148/actions-setup-mysql@v1 + with: + user: ${{ env.DB_USER }} + password: ${{ env.DB_PASSWORD }} + mysql-version: '8.0' + - name: Run database migrations if: ${{ matrix.os.database }} - run: mysql --batch -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < <(cat DatabaseMigrations/*.sql) + run: | + mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} + mysql --batch -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} ${{ env.DB_DATABASE }} < <(cat DatabaseMigrations/*.sql) - name: Test continue-on-error: true