From 4ce79f4bcf97d43ae6f20908b674c38d7837d83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rold=C3=A1n?= <62166813+Odraxs@users.noreply.github.com> Date: Tue, 12 Mar 2024 14:23:55 -0500 Subject: [PATCH] Added ci pipelines (#15) * Added ci pipelines * Fix web test --- .github/workflows/ci.yml | 80 +++++++++++++++++++ .../{HelloWorld.spec.ts => Header.spec.ts} | 6 +- 2 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml rename web/src/components/__tests__/{HelloWorld.spec.ts => Header.spec.ts} (51%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..00f9af9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,80 @@ +name: Project CI + +on: + push: + branches: + - "main" + - "v*.[0-9]" + pull_request: + +jobs: + web-ci: + name: Project CI + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ["20.10.x"] + dir : ["web"] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup environment + run: mv .env.example .env + working-directory: ${{ matrix.dir }} + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + working-directory: ${{ matrix.dir }} + + - name: Install Yarn + run: | + npm install -g yarn + npm i + working-directory: ${{ matrix.dir }} + + - name: Run lint + run: yarn lint + working-directory: ${{ matrix.dir }} + + - name: Run tests + run: yarn test:unit + working-directory: ${{ matrix.dir }} + + server-ci: + name: Wev CI + runs-on: ubuntu-latest + strategy: + matrix: + go-version: ["1.22.x"] + dir: ["server", "data-embedding"] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - uses: WillAbides/setup-go-faster@v1.14.0 + with: + go-version: ${{ matrix.go-version }} + + - name: Run test + run: go test ./... + working-directory: ${{ matrix.dir }} + + - name: Run vet + run: go vet ./... + working-directory: ${{ matrix.dir }} + + # This action doesn't work with go-version > 1.19 😟 + # - uses: dominikh/staticcheck-action@v1.3.0 + # with: + # version: "2022.1.3" + # install-go: false + # cache-key: ${{ matrix.go-version }} + # working-directory: ${{ matrix.dir }} diff --git a/web/src/components/__tests__/HelloWorld.spec.ts b/web/src/components/__tests__/Header.spec.ts similarity index 51% rename from web/src/components/__tests__/HelloWorld.spec.ts rename to web/src/components/__tests__/Header.spec.ts index 083eff6..b752da2 100644 --- a/web/src/components/__tests__/HelloWorld.spec.ts +++ b/web/src/components/__tests__/Header.spec.ts @@ -1,11 +1,11 @@ import { describe, it, expect } from 'vitest' import { mount } from '@vue/test-utils' -import EmailsVisualizer from '../EmailsVisualizer.vue' +import Header from '../Header.vue' -describe('EmailsVisualizer', () => { +describe('Header', () => { it('renders properly', () => { - const wrapper = mount(EmailsVisualizer, { props: { msg: 'Hello Vitest' } }) + const wrapper = mount(Header, { props: { msg: 'Hello Vitest' } }) expect(wrapper.text()).toContain('Hello Vitest') }) })