CI #2565
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: CI | |
on: [push, pull_request] | |
env: | |
go-version: "1.23.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:8.13.4 | |
ports: | |
- 9200:9200 | |
env: | |
discovery.type: single-node | |
xpack.security.enabled: false | |
options: --health-cmd "curl http://localhost:9200/_cluster/health" --health-interval 10s --health-timeout 5s --health-retries 5 | |
minio: | |
image: bitnami/minio:latest | |
env: | |
MINIO_ROOT_USER: root | |
MINIO_ROOT_PASSWORD: tembatemba | |
MINIO_DEFAULT_BUCKETS: test-attachments,test-sessions,test-logs | |
ports: | |
- 9000:9000 | |
options: --health-cmd "mc ready local" --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- 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 and start DynamoDB | |
uses: rrainn/[email protected] | |
with: | |
port: 6000 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
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@v4 | |
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@v4 | |
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@v5 | |
with: | |
go-version: ${{ env.go-version }} | |
- name: Publish release | |
uses: goreleaser/goreleaser-action@v6 | |
if: ${{ !contains(github.ref, '-') }} | |
with: | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish non-master release | |
uses: goreleaser/goreleaser-action@v6 | |
if: contains(github.ref, '-') | |
with: | |
args: release --clean --skip-validate | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |