This is an example program and CI pipeline showing how to run a Go project on Semaphore
Feel free to fork this repository and use it to create a Semaphore project.
The CI pipeline is defined in .semaphore/semaphore.yml
and when you run it it will look like this:
You can extend the pipeline with deployment by implementing a promotion. Refer to Semaphore documentation for additional deployment examples.
The project has been tested with Go 1.21. After cloning the repository:
$ go get
$ go build -o ./bin/main
To run the tests on you machine:
- Install
gotestsum
:go install gotest.tools/gotestsum@latest
- Start a test PostgreSQL instance. The easiest way is with Docker:
docker run --rm -d --name test-instance -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgres
- Create a test table:
psql -p 5432 -h localhost -U postgres -c "CREATE DATABASE s2"
- Run the tests with:
gotestsum
- Stop the test database:
docker stop test-instance
Copyright (c) 2024 Semaphore Technologies
Distributed under the MIT License. See the file LICENSE.