2022-06-20 18:30:33 +02:00
|
|
|
name: Dev
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- develop
|
2023-08-27 00:31:16 +02:00
|
|
|
pull_request:
|
|
|
|
branches: [develop]
|
2022-06-20 18:30:33 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-local:
|
|
|
|
runs-on: [ubuntu-latest]
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v3
|
2023-07-08 20:24:35 +02:00
|
|
|
with: { go-version: 1.19 }
|
2022-06-20 18:30:33 +02:00
|
|
|
|
|
|
|
- uses: actions/setup-node@v3
|
2022-06-21 12:38:10 +02:00
|
|
|
with: { node-version: '16' }
|
2022-06-20 18:30:33 +02:00
|
|
|
|
2022-06-21 15:36:59 +02:00
|
|
|
- run: go install github.com/go-task/task/v3/cmd/task@latest
|
2022-06-20 18:30:33 +02:00
|
|
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- run: task deps
|
|
|
|
|
|
|
|
- run: task compile
|
|
|
|
|
|
|
|
- name: Test that compile did not create/modify untracked files
|
2022-10-29 15:37:20 +02:00
|
|
|
run: git diff --exit-code --stat -- . ':(exclude)web/package.json' ':(exclude)web/package-lock.json' ':(exclude)go.mod' ':(exclude)go.sum'
|
2022-06-20 18:30:33 +02:00
|
|
|
|
2022-10-26 21:40:55 +02:00
|
|
|
- run: task build:local GOOS= GOARCH=
|
2022-06-20 18:30:33 +02:00
|
|
|
|
2022-10-29 12:24:52 +02:00
|
|
|
- run: task test
|
|
|
|
|
2022-06-20 18:30:33 +02:00
|
|
|
- uses: actions/upload-artifact@master
|
|
|
|
with:
|
|
|
|
name: semaphore
|
|
|
|
path: bin/semaphore
|
2022-10-29 12:24:52 +02:00
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
|
2022-06-20 18:30:33 +02:00
|
|
|
test-db-migration:
|
|
|
|
runs-on: [ubuntu-latest]
|
2022-10-29 12:35:42 +02:00
|
|
|
needs: [build-local]
|
2022-06-20 18:30:33 +02:00
|
|
|
steps:
|
|
|
|
- uses: shogo82148/actions-setup-mysql@v1
|
|
|
|
with:
|
|
|
|
mysql-version: '5.6'
|
|
|
|
|
2022-11-19 20:36:57 +01:00
|
|
|
- uses: Harmon758/postgresql-action@v1
|
|
|
|
with:
|
|
|
|
postgresql version: '11'
|
|
|
|
postgresql db: 'circle_test'
|
|
|
|
postgresql user: 'root'
|
|
|
|
postgresql password: 'pwd'
|
|
|
|
|
2022-06-20 18:30:33 +02:00
|
|
|
- uses: actions/download-artifact@master
|
|
|
|
with:
|
|
|
|
name: semaphore
|
|
|
|
|
2022-11-19 21:01:20 +01:00
|
|
|
- run: "cat > config.json <<EOF\n{\n\t\"postgres\": {\n\t\t\"host\": \"127.0.0.1:5432\"\
|
|
|
|
,\n\t\t\"options\":{\"sslmode\":\"disable\"}\
|
2022-11-19 20:36:57 +01:00
|
|
|
,\n\t\t\"user\": \"root\",\n\t\t\"pass\": \"pwd\",\n\t\t\"name\": \"circle_test\"\
|
|
|
|
\n\t},\n\t\"dialect\": \"postgres\",\n\t\"email_alert\": false\n}\nEOF\n"
|
|
|
|
|
|
|
|
- run: chmod +x ./semaphore && ./semaphore migrate --config config.json
|
|
|
|
|
2022-06-20 18:30:33 +02:00
|
|
|
- run: "cat > config.json <<EOF\n{\n\t\"mysql\": {\n\t\t\"host\": \"127.0.0.1:3306\"\
|
|
|
|
,\n\t\t\"user\": \"root\",\n\t\t\"pass\": \"\",\n\t\t\"name\": \"circle_test\"\
|
2022-11-19 20:36:57 +01:00
|
|
|
\n\t},\n\t\"dialect\": \"mysql\",\n\t\"email_alert\": false\n}\nEOF\n"
|
2022-06-20 18:30:33 +02:00
|
|
|
|
|
|
|
- run: chmod +x ./semaphore && ./semaphore migrate --config config.json
|
|
|
|
|
2022-11-19 20:22:17 +01:00
|
|
|
- run: "cat > config.json <<EOF\n{\n\t\"bolt\": {\n\t\t\"host\": \"/tmp/database.bolt\"\
|
2022-11-19 20:36:57 +01:00
|
|
|
\n\t},\n\t\"dialect\": \"bolt\",\n\t\"email_alert\": false\n}\nEOF\n"
|
2022-11-19 20:22:17 +01:00
|
|
|
|
|
|
|
- run: chmod +x ./semaphore && ./semaphore migrate --config config.json
|
|
|
|
|
2022-06-29 18:50:54 +02:00
|
|
|
|
2022-06-20 18:30:33 +02:00
|
|
|
test-integration:
|
|
|
|
runs-on: [ubuntu-latest]
|
|
|
|
needs: [test-db-migration]
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v3
|
2023-07-08 20:24:35 +02:00
|
|
|
with: { go-version: 1.19 }
|
2022-06-20 18:30:33 +02:00
|
|
|
|
2022-06-21 15:36:59 +02:00
|
|
|
- run: go install github.com/go-task/task/v3/cmd/task@latest
|
2022-06-20 18:30:33 +02:00
|
|
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
2022-11-19 18:24:25 +01:00
|
|
|
- run: context=ci prefix=.postgres task dc:up
|
2022-11-19 00:04:43 +01:00
|
|
|
- run: context=ci prefix=.bolt task dc:up
|
2022-11-19 13:46:32 +01:00
|
|
|
- run: context=ci prefix=.mysql task dc:up
|
2022-06-20 18:30:33 +02:00
|
|
|
|
2022-06-29 18:28:08 +02:00
|
|
|
deploy-dev:
|
|
|
|
runs-on: [ubuntu-latest]
|
2022-06-29 18:50:54 +02:00
|
|
|
needs: [test-integration]
|
2023-08-27 00:31:16 +02:00
|
|
|
if: github.ref == 'refs/heads/develop'
|
2022-06-29 18:28:08 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v3
|
2023-07-08 20:24:35 +02:00
|
|
|
with: { go-version: 1.19 }
|
2022-06-29 18:28:08 +02:00
|
|
|
|
|
|
|
- run: go install github.com/go-task/task/v3/cmd/task@latest
|
|
|
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
2022-10-23 11:48:52 +02:00
|
|
|
- uses: docker/setup-qemu-action@v2
|
2022-06-29 18:28:08 +02:00
|
|
|
|
2022-10-23 11:48:52 +02:00
|
|
|
- uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
|
|
password: ${{ secrets.DOCKER_PASS }}
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64,linux/arm64
|
2022-10-24 07:10:11 +02:00
|
|
|
file: ./deployment/docker/prod/buildx.Dockerfile
|
2022-10-23 11:48:52 +02:00
|
|
|
push: true
|
|
|
|
tags: semaphoreui/semaphore:develop
|
2022-06-29 18:28:08 +02:00
|
|
|
|
|
|
|
|
2022-06-20 18:30:33 +02:00
|
|
|
# test-docker:
|
|
|
|
# runs-on: [ubuntu-latest]
|
|
|
|
# steps:
|
|
|
|
# - uses: actions/setup-go@v3
|
2023-07-08 20:24:35 +02:00
|
|
|
# with: { go-version: 1.19 }
|
2022-06-20 18:30:33 +02:00
|
|
|
|
2022-06-21 15:36:59 +02:00
|
|
|
# - run: go install github.com/go-task/task/v3/cmd/task@latest
|
2022-06-20 18:30:33 +02:00
|
|
|
|
|
|
|
# - uses: actions/checkout@v3
|
|
|
|
|
|
|
|
# - run: context=prod task docker:test
|