Skip to content

Merge pull request #154 from iota-uz/diyor28-patch-1 #1015

Merge pull request #154 from iota-uz/diyor28-patch-1

Merge pull request #154 from iota-uz/diyor28-patch-1 #1015

Workflow file for this run

name: Test, lint & build
on:
- push
jobs:
test:
runs-on: blacksmith-2vcpu-ubuntu-2204
services:
postgres:
image: postgres:15.1
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: iota_erp
ports:
- 5432:5432
options: >-
--hostname=erp_db
--health-cmd="pg_isready -U postgres -d iota_erp"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23.2"
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
golangci-lint version
- name: Install templ
run: |
go install github.com/a-h/templ/cmd/[email protected]
templ --help
- name: Install TailwindCSS
run: |
echo "Installing TailwindCSS for x64 architecture..."
mkdir -p downloaded
curl -sL -o downloaded/tailwindcss https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.15/tailwindcss-linux-x64
chmod +x downloaded/tailwindcss
echo "$PWD/downloaded" >> $GITHUB_PATH
- name: Verify TailwindCSS installation
run: |
tailwindcss -h
- name: Install PNPM
uses: pnpm/action-setup@v4
with:
version: 9
- name: Download Go dependencies
run: |
go mod download
- name: Wait for PostgreSQL to be ready
run: |
until pg_isready -h localhost -p 5432 -U postgres -d iota_erp; do
echo "Waiting for postgres..."
sleep 1
done
- name: Test generated files are up to date
run: |
go generate ./...
make generate
git diff --exit-code
- name: Run custom linter
run: |
make build-iota-linter
make run-iota-linter
- name: Test Makefile targets
# running seeds twice to verify that they are idempotent
run: |
make migrate-up
make seed
make seed
make css
- name: Run go vet && tests
run: |
make generate
git diff --exit-code
go vet ./...
go test -v ./...
- name: Cypress run
uses: cypress-io/github-action@v6
env:
SESSION_DURATION: 720h
DOMAIN: localhost
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: iota_erp
DB_USER: postgres
DB_PASSWORD: postgres
SID_COOKIE_KEY: sid
GO_APP_ENV: production
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
with:
record: true
working-directory: e2e
install-command: pnpm install
start: go run ../cmd/server/main.go
wait-on: 'http://localhost:3200'
browser: chrome
- name: Test database migrate down
# e2e tests require database to have the seed data. We can only down the migrations after cypress.
run: |
make migrate-down