Semaphore/.github/workflows/dev.yml

119 lines
2.8 KiB
YAML
Raw Normal View History

2022-06-20 18:30:33 +02:00
name: Dev
on:
push:
branches:
- develop
jobs:
build-local:
runs-on: [ubuntu-latest]
steps:
- uses: actions/setup-go@v3
2022-06-21 15:36:59 +02:00
with: { go-version: 1.18 }
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
run: git diff --exit-code --stat -- . ':(exclude)web2/package.json' ':(exclude)web2/package-lock.json' ':(exclude)go.mod' ':(exclude)go.sum'
- run: task build:local
- uses: actions/upload-artifact@master
with:
name: semaphore
path: bin/semaphore
test-golang:
runs-on: [ubuntu-latest]
needs: build-local
steps:
- uses: actions/setup-go@v3
2022-06-21 15:36:59 +02:00
with: { go-version: 1.18 }
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:tools
- run: task deps:be
- run: task compile:be
2022-06-21 15:51:44 +02:00
# - run: task lint:be
2022-06-20 18:30:33 +02:00
- run: task test
test-db-migration:
runs-on: [ubuntu-latest]
needs: [build-local, test-golang]
steps:
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '5.6'
- uses: actions/download-artifact@master
with:
name: semaphore
- 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\"\
\n\t},\n\t\"email_alert\": false\n}\nEOF\n"
- 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
2022-06-21 15:36:59 +02:00
with: { go-version: 1.18 }
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=ci task dc:up
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]
2022-06-29 18:28:08 +02:00
steps:
- uses: actions/setup-go@v3
with: { go-version: 1.18 }
- run: go install github.com/go-task/task/v3/cmd/task@latest
- uses: actions/checkout@v3
- run: context=prod task docker:test
- run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }}
- run: context=prod tag=develop task docker:build
- run: tag=develop task docker:push
2022-06-20 18:30:33 +02:00
# test-docker:
# runs-on: [ubuntu-latest]
# steps:
# - uses: actions/setup-go@v3
2022-06-21 15:36:59 +02:00
# with: { go-version: 1.18 }
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