From 4871e826eaca2bd8869775e8c548151c038a3254 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Fri, 6 Oct 2023 14:24:33 +0100 Subject: [PATCH] fix workflow --- .github/workflows/build-test.yaml | 54 ------------------------- .github/workflows/ci.yaml | 67 +++++++++++++++++++++++++++++++ .gitignore | 3 ++ 3 files changed, 70 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/build-test.yaml create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml deleted file mode 100644 index 5c38dfb..0000000 --- a/.github/workflows/build-test.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: Build and test -on: - pull_request: - workflow_dispatch: - push: - branches: - - main - -jobs: - build_and_test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8 - - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: "pnpm" - cache-dependency-path: "pnpm-lock.yaml" - - name: Install dependencies - run: pnpm install - - name: Set up config files - run: cp config/config.example.toml config/config.toml - - name: Build - run: pnpm build - continue-on-error: true - - name: Start and test - run: | - pnpm start & - sleep 5 - curl -sSf http://localhost:3000 - - name: Upload artefacts - uses: actions/upload-artifact@v3 - with: - name: build - path: | - dist - node_modules - cypress: - needs: build_and_test - runs-on: ubuntu-latest - steps: - - name: Download artefacts - uses: actions/download-artifact@v3 - with: - name: build - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - start: pnpm start - browser: chrome - diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..1e0be7a --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,67 @@ +name: CI / Build and test +on: + pull_request: + workflow_dispatch: + push: + branches: + - main + +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Set up config files + run: cp config/config.example.toml config/config.toml + + - name: Cypress install + uses: cypress-io/github-action@v6 + with: + # Disable running of tests within install job + runTests: false + build: pnpm run build + continue-on-error: true + + - name: Save build folder + uses: actions/upload-artifact@v3 + with: + name: dist + if-no-files-found: error + path: dist + + cypress-run: + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Set up config files + run: cp config/config.example.toml config/config.toml + + - name: Download the build folder + uses: actions/download-artifact@v3 + with: + name: dist + path: dist + + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.10.0 + + - name: Cypress run + uses: cypress-io/github-action@v6 + with: + start: pnpm start + browser: chrome \ No newline at end of file diff --git a/.gitignore b/.gitignore index 683b41a..e68efaa 100755 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ dist public/events/* !public/events/.gitkeep +# CI files +dist.zip + # Logs logs *.log