Skip to content

Merge pull request #124 from nyaruka/latest_goflow #839

Merge pull request #124 from nyaruka/latest_goflow

Merge pull request #124 from nyaruka/latest_goflow #839

Workflow file for this run

name: CI
on: [push, pull_request]
env:
go-version: "1.20.x"
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
redis:
image: redis:6.2-alpine
ports:
- 6379:6379
postgres:
image: postgis/postgis:15-3.3-alpine
env:
POSTGRES_PASSWORD: temba
ports:
- 5432:5432
options: --name textit-postgres-1 --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
elastic:
image: elasticsearch:7.17.9
ports:
- 9200:9200
- 9300:9300
env:
discovery.type: single-node
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Linux packages
run: |
sudo apt-get update
sudo apt install -y --no-install-recommends postgresql-client
- name: Initialize database
# we create our test database with a different user so that we can drop everything owned by this user between tests
run: |
export PGPASSWORD=temba
psql -h localhost -U postgres --no-password -c "CREATE USER mailroom_test PASSWORD 'temba';"
psql -h localhost -U postgres --no-password -c "ALTER ROLE mailroom_test WITH SUPERUSER;"
psql -h localhost -U postgres --no-password -c "CREATE DATABASE mailroom_test;"
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
- name: Run tests
run: |
export PGPASSWORD=temba
go test -p=1 -coverprofile=coverage.text -covermode=atomic ./...
- name: Upload coverage
if: success()
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
release:
name: Release
needs: [test]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch GoFlow docs
# for backward compatibility, English docs are copied to root of docs directory
run: |
GOFLOW_VERSION=$(grep goflow go.mod | cut -d" " -f2 | cut -c2-)
curl -L https://github.com/nyaruka/goflow/releases/download/v${GOFLOW_VERSION}/docs.tar.gz | tar zxv
cp ./docs/en-us/*.* docs/
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
- name: Publish release
uses: goreleaser/goreleaser-action@v4
if: ${{ !contains(github.ref, '-') }}
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish non-master release
uses: goreleaser/goreleaser-action@v4
if: contains(github.ref, '-')
with:
args: release --clean --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}