From 69069fe3de82cce326e3ebe2b4a597d4d1045991 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:53:00 +0900 Subject: [PATCH] chore: improve CI --- .github/workflows/build-test.yaml | 27 ------------------- .github/workflows/create-sentry-release.yml | 11 ++++++++ .github/workflows/lint.yml | 13 +++------ ...r-publish.yml => publish-docker-image.yml} | 0 .github/workflows/sentry-release.yml | 22 --------------- .github/workflows/test.yml | 10 +++++++ 6 files changed, 24 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/build-test.yaml create mode 100644 .github/workflows/create-sentry-release.yml rename .github/workflows/{docker-publish.yml => publish-docker-image.yml} (100%) delete mode 100644 .github/workflows/sentry-release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml deleted file mode 100644 index 2b3a4dca..00000000 --- a/.github/workflows/build-test.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build and run tests -on: [push] -jobs: - build-test: - runs-on: ubuntu-20.04 - env: - DATABASE_URL: 'mysql://root:root@127.0.0.1:3306/hub_test' - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '16' - cache: 'yarn' - - name: Set up MySQL - run: | - sudo /etc/init.d/mysql start - mysql -e 'CREATE DATABASE hub_test;' -uroot -proot - mysql -uroot -proot hub_test < src/helpers/schema.sql - mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" - mysql -uroot -proot -e "FLUSH PRIVILEGES;" - - run: yarn - - run: yarn run tsc - - run: yarn test - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/create-sentry-release.yml b/.github/workflows/create-sentry-release.yml new file mode 100644 index 00000000..731dabb3 --- /dev/null +++ b/.github/workflows/create-sentry-release.yml @@ -0,0 +1,11 @@ +name: Create a Sentry release +on: + push: + branches: + - 'main' +jobs: + create-sentry-release: + uses: snapshot-labs/actions/.github/workflows/create-sentry-release.yml@main + with: + project: snapshot-hub + secrets: inherit diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b645875f..0ef1f53e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,15 +1,8 @@ name: Lint + on: [push] jobs: lint: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '16' - cache: 'yarn' - - run: yarn - - run: yarn lint:nofix - - run: yarn typecheck + uses: snapshot-labs/actions/.github/workflows/lint.yml@main + secrets: inherit diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/publish-docker-image.yml similarity index 100% rename from .github/workflows/docker-publish.yml rename to .github/workflows/publish-docker-image.yml diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml deleted file mode 100644 index 571c06f5..00000000 --- a/.github/workflows/sentry-release.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Create a Sentry release -on: - push: - branches: - - 'master' -jobs: - sentry-release: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '16' - cache: 'yarn' - - run: yarn install - - run: yarn build - - name: Sentry Release - uses: getsentry/action-release@v1.4.1 - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG }} - SENTRY_PROJECT: snapshot-hub diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..bf59b18d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,10 @@ +name: Test + +on: [push] + +jobs: + test: + uses: snapshot-labs/actions/.github/workflows/test.yml@main + secrets: inherit + with: + mysql_database_name: hub_test