fix: hard-coded yesterday/ereyesterday filter values #1083
Workflow file for this run
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, 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: Check migrations collect idempotence | |
run: | | |
make migrate collect | |
git status --porcelain migrations/ | |
if [ -n "$(git status --porcelain migrations/)" ]; then | |
echo "Error: make migrate collect produced changes, please run 'make migrate collect' and commit the changes" | |
git status --porcelain migrations/ | |
exit 1 | |
fi | |
- name: Test Makefile targets | |
# running migrations and seeds twice to verify that they are idempotent | |
run: | | |
make migrate up | |
make migrate up | |
make seed | |
make seed | |
make css | |
- name: Check SQL files are properly formatted | |
# Install pg_formatter and verify all SQL files are properly formatted | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pgformatter | |
# Create a temporary directory for formatted files | |
mkdir -p /tmp/formatted | |
# Format each SQL file and check for differences | |
find modules -name "*.sql" -type f | while read -r sqlfile; do | |
pg_format "$sqlfile" > "/tmp/formatted/$(basename "$sqlfile")" | |
if ! diff -q "$sqlfile" "/tmp/formatted/$(basename "$sqlfile")" > /dev/null; then | |
echo "Error: $sqlfile is not properly formatted" | |
diff "$sqlfile" "/tmp/formatted/$(basename "$sqlfile")" | |
exit 1 | |
fi | |
done | |
echo "All SQL files are properly formatted" | |
- 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 | |