This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
fix(deps): update minor and pin #6064
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: push | |
jobs: | |
rust-image: | |
uses: ./.github/workflows/docker-builder.yml | |
with: | |
file: "dockerfiles/rust.Dockerfile" | |
name: "api-rust" | |
go-builder-image: | |
uses: ./.github/workflows/docker-builder.yml | |
with: | |
file: "dockerfiles/go.Dockerfile" | |
name: "go-builder" | |
ui-builder-image: | |
needs: [wasm-builder-image] | |
uses: ./.github/workflows/docker-builder.yml | |
with: | |
file: "dockerfiles/ui.Dockerfile" | |
name: "ui-builder" | |
wasm-builder-image: | |
uses: ./.github/workflows/docker-builder.yml | |
with: | |
file: "dockerfiles/wasm.Dockerfile" | |
name: "wasm-builder" | |
build-main-docker: | |
needs: [go-builder-image, ui-builder-image] | |
name: main docker | |
uses: ./.github/workflows/docker-builder.yml | |
with: | |
file: "dockerfiles/main.Dockerfile" | |
name: "api-go" | |
golangci: | |
name: go lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6.1.1 | |
with: | |
version: latest | |
test-ui: | |
needs: [wasm-builder-image] | |
name: vitest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=$(echo sha-${GITHUB_SHA})" >>$GITHUB_OUTPUT | |
id: extract_branch | |
- name: extract wasm for UI | |
run: | | |
docker create --name=temp ghcr.io/nickysemenza/gourd-wasm-builder:${{steps.extract_branch.outputs.branch}} | |
docker cp temp:/wasm ui/src/wasm | |
- run: yarn install | |
working-directory: ui/ | |
- run: npx vitest --coverage | |
working-directory: ui/ | |
- name: "Report Coverage" | |
if: always() # Also generate the report if tests are failing | |
uses: davelosert/vitest-coverage-report-action@v2 | |
with: | |
working-directory: ui/ | |
- uses: codecov/codecov-action@v5 | |
with: | |
working-directory: ui/ | |
test-e2e: | |
needs: [build-main-docker] | |
name: cypress | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "stable" | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=$(echo sha-${GITHUB_SHA})" >>$GITHUB_OUTPUT | |
id: extract_branch | |
- name: extract wasm for UI | |
run: | | |
docker create --name=temp ghcr.io/nickysemenza/gourd-wasm-builder:${{steps.extract_branch.outputs.branch}} | |
docker cp temp:/wasm ui/src/wasm | |
- name: start postgres db | |
run: DOCKER_TAG=${{steps.extract_branch.outputs.branch}} docker compose -f dockerfiles/docker-compose-deps.yml -f dockerfiles/docker-compose-gourd.yml up -d db | |
- run: go mod vendor | |
- name: migrate db | |
run: make migrate | |
- name: start rust + go servers | |
run: DOCKER_TAG=${{steps.extract_branch.outputs.branch}} docker compose -f dockerfiles/docker-compose-deps.yml -f dockerfiles/docker-compose-gourd.yml up -d rs gourd | |
- name: smoke test rust server | |
run: | | |
curl -v http://localhost:8080/parse?text=1%20cup | |
curl -v http://localhost:8080/debug/scrape?url=https://thewoksoflife.com/ma-po-tofu-real-deal/ | |
- uses: codecov/codecov-action@v5 | |
- name: Cypress run | |
uses: cypress-io/github-action@v5 | |
with: | |
working-directory: ui/ | |
start: npx vite --host | |
wait-on: http://localhost:5173 | |
record: true | |
env: | |
CYPRESS_RECORD_KEY: 265312e3-7b8c-4031-ad0a-5f825b95cfce | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: codecov/codecov-action@v5 | |
- name: Archive cypress results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cypress-results | |
path: ui/cypress/ | |
if-no-files-found: error | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 | |
test-integration: | |
needs: [rust-image] | |
name: API integration | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "stable" | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=$(echo sha-${GITHUB_SHA})" >>$GITHUB_OUTPUT | |
id: extract_branch | |
- run: go mod vendor | |
- name: start postgres db + rust server | |
run: DOCKER_TAG=${{steps.extract_branch.outputs.branch}} docker compose -f dockerfiles/docker-compose-deps.yml -f dockerfiles/docker-compose-gourd.yml up -d db rs | |
- name: smoke test rust server | |
run: | | |
curl -v http://localhost:8080/parse?text=1%20cup | |
curl -v http://localhost:8080/debug/scrape?url=https://thewoksoflife.com/ma-po-tofu-real-deal/ | |
- name: go integration tests | |
run: make integration-test-go | |
env: | |
MIGRATIONS_DIR: file://../../internal/db/migrations | |
PDFLATEX_BINARY: /usr/bin/pdflatex | |
- uses: codecov/codecov-action@v5 | |
test-rust: | |
name: rust tests | |
runs-on: ubuntu-latest | |
# https://github.com/xd009642/tarpaulin#github-actions | |
container: | |
image: xd009642/tarpaulin:develop-nightly | |
options: --security-opt seccomp=unconfined | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out xml | |
working-directory: rust | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v5 | |
with: | |
working-directory: rust | |
deploy: | |
needs: ["test-e2e", "test-ui", "test-integration", "test-rust", "golangci"] | |
if: github.ref == 'refs/heads/main' | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: production | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: curl -L https://fly.io/install.sh | sh | |
- run: /home/runner/.fly/bin/flyctl deploy deploy/ --image ghcr.io/nickysemenza/gourd-api-go:main | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- run: /home/runner/.fly/bin/flyctl deploy rust/ --image ghcr.io/nickysemenza/gourd-api-rust:main | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |