From ab04eb174e4f421bfdde389cbc85a1c695339ff5 Mon Sep 17 00:00:00 2001 From: Giovanni Baratta Date: Sat, 16 Mar 2024 09:23:46 +0000 Subject: [PATCH] chore: add workflow to run tests in pull requests --- .devcontainer/configure_docker.sh | 0 .github/workflows/run-tests.yml | 54 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) mode change 100644 => 100755 .devcontainer/configure_docker.sh create mode 100644 .github/workflows/run-tests.yml diff --git a/.devcontainer/configure_docker.sh b/.devcontainer/configure_docker.sh old mode 100644 new mode 100755 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..2da2333 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,54 @@ +name: Tests + +on: + pull_request: + paths: + - "service/**/*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Configure runner + run: | + ./devcontainer/configure_docker.sh + shell: bash + + - name: Set Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: Yarn install + uses: borales/actions-yarn@v4 + with: + cmd: install + dir: service + + - name: Start dependencies + uses: borales/actions-yarn@v4 + with: + cmd: deps:start + dir: service + + - name: Prepare database + uses: borales/actions-yarn@v4 + with: + cmd: db:migrate + dir: service + + - name: Run tests + uses: borales/actions-yarn@v4 + with: + cmd: test + dir: service + + - name: Clean dependencies + uses: borales/actions-yarn@v4 + with: + cmd: deps:down + dir: service