Semaphore/.github/workflows/dev.yml

643 lines
14 KiB
YAML
Raw Normal View History

2022-06-20 18:30:33 +02:00
name: Dev
'on':
2022-06-20 18:30:33 +02:00
push:
branches:
- develop
pull_request:
branches:
- develop
2022-06-20 18:30:33 +02:00
jobs:
2023-09-13 12:43:11 +02:00
build-local:
runs-on: ubuntu-latest
2023-09-13 12:43:11 +02:00
steps:
- name: Checkout source
uses: actions/checkout@v4
2023-09-13 12:43:11 +02:00
- name: Setup golang
uses: actions/setup-go@v5
with:
go-version: '^1.21.0'
2023-09-13 12:43:11 +02:00
- name: Setup nodejs
2024-05-02 22:55:27 +02:00
uses: actions/setup-node@v4
with:
node-version: '16'
2024-04-28 15:06:19 +02:00
cache: 'npm'
cache-dependency-path: web/package-lock.json
2023-09-13 12:43:11 +02:00
- name: Install go-task
run: |
go install github.com/go-task/task/v3/cmd/task@latest
2023-09-13 12:43:11 +02:00
- name: Install deps
run: |
task deps
2023-09-13 12:43:11 +02:00
- name: Run build
run: task build
2023-09-13 12:43:11 +02:00
- name: Check modification
run: |
git diff --exit-code --stat -- . ':(exclude)web/package.json' ':(exclude)web/package-lock.json' ':(exclude)go.mod' ':(exclude)go.sum'
2023-09-13 12:43:11 +02:00
- name: Run tests
run: task test
2023-09-13 12:43:11 +02:00
- name: Upload artifacts
uses: actions/upload-artifact@v4
2023-09-13 12:43:11 +02:00
with:
name: semaphore
path: bin/semaphore
retention-days: 1
2024-05-03 22:23:28 +02:00
migrate-boltdb:
runs-on: ubuntu-latest
needs:
- build-local
2023-09-13 12:43:11 +02:00
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
2023-09-13 12:43:11 +02:00
with:
name: semaphore
2023-09-13 12:43:11 +02:00
- name: Write config
run: |
cat > config.json <<EOF
{
"bolt": {
"host": "/tmp/database.bolt"
},
"dialect": "bolt",
"email_alert": false
}
EOF
- name: Migrate database
run: |
chmod +x ./semaphore && ./semaphore migrate --config config.json
2024-05-03 22:23:28 +02:00
migrate-mysql:
runs-on: ubuntu-latest
needs:
- build-local
services:
2024-05-04 00:06:34 +02:00
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: p455w0rd
MYSQL_USER: semaphore
MYSQL_PASSWORD: p455w0rd
MYSQL_DATABASE: semaphore
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
2023-09-13 12:43:11 +02:00
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
2023-09-13 12:43:11 +02:00
with:
name: semaphore
- name: Write config
run: |
cat > config.json <<EOF
{
"mysql": {
"host": "localhost:3306",
"user": "semaphore",
"pass": "p455w0rd",
"name": "semaphore"
},
"dialect": "mysql",
"email_alert": false
}
EOF
- name: Migrate database
run: |
chmod +x ./semaphore && ./semaphore migrate --config config.json
2024-05-03 22:23:28 +02:00
migrate-mariadb:
runs-on: ubuntu-latest
needs:
- build-local
services:
2024-05-04 00:06:34 +02:00
mariadb:
image: mariadb:10.4
env:
MARIADB_ROOT_PASSWORD: p455w0rd
MARIADB_USER: semaphore
MARIADB_PASSWORD: p455w0rd
MARIADB_DATABASE: semaphore
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
2024-03-03 19:08:26 +01:00
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: semaphore
2023-09-13 12:43:11 +02:00
- name: Write config
run: |
cat > config.json <<EOF
{
"mysql": {
"host": "localhost:3306",
"user": "semaphore",
"pass": "p455w0rd",
"name": "semaphore"
},
"dialect": "mysql",
"email_alert": false
}
EOF
- name: Migrate database
run: |
chmod +x ./semaphore && ./semaphore migrate --config config.json
2024-05-03 22:23:28 +02:00
migrate-postgres:
runs-on: ubuntu-latest
needs:
- build-local
services:
postgres:
image: postgres:12.18
env:
POSTGRES_USER: semaphore
POSTGRES_PASSWORD: p455w0rd
POSTGRES_DB: semaphore
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
2023-09-13 12:43:11 +02:00
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: semaphore
2023-09-13 12:43:11 +02:00
- name: Write config
run: |
cat > config.json <<EOF
{
"postgres": {
"host": "localhost:5432",
"user": "semaphore",
"pass": "p455w0rd",
"name": "semaphore",
"options": {
"sslmode": "disable"
}
},
"dialect": "postgres",
"email_alert": false
}
EOF
- name: Migrate database
run: |
chmod +x ./semaphore && ./semaphore migrate --config config.json
2024-05-03 22:23:28 +02:00
integrate-boltdb:
runs-on: ubuntu-latest
needs:
2024-05-03 22:23:28 +02:00
- migrate-boltdb
2023-09-13 12:43:11 +02:00
env:
SEMAPHORE_DB_OPTIONS: '{"sessionConnection": "true"}'
steps:
- name: Checkout source
uses: actions/checkout@v4
2023-09-13 12:43:11 +02:00
2024-05-04 00:06:34 +02:00
- name: Setup golang
uses: actions/setup-go@v5
with:
go-version: '^1.21.0'
- name: Setup nodejs
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install go-task
run: |
go install github.com/go-task/task/v3/cmd/task@latest
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: semaphore
- name: Write config
run: |
cat > config.stdin <<EOF
2
/tmp/database.bolt
/tmp/semaphore
http://localhost:3000
no
no
no
no
no
no
$(pwd)/.dredd
admin
admin@localhost
Developer
password
EOF
- name: Execute setup
run: |
chmod +x ./semaphore && ./semaphore setup - < config.stdin
- name: Launch dredd
run: |
2024-05-04 00:06:34 +02:00
task e2e:goodman
task e2e:deps
task e2e:hooks
task e2e:test
2024-05-03 22:23:28 +02:00
integrate-mysql:
runs-on: ubuntu-latest
needs:
- migrate-mysql
2024-05-04 00:06:34 +02:00
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: p455w0rd
MYSQL_USER: semaphore
MYSQL_PASSWORD: p455w0rd
MYSQL_DATABASE: semaphore
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
2024-05-03 22:23:28 +02:00
steps:
- name: Checkout source
uses: actions/checkout@v4
2024-05-04 00:06:34 +02:00
- name: Setup golang
uses: actions/setup-go@v5
with:
go-version: '^1.21.0'
- name: Setup nodejs
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install go-task
run: |
go install github.com/go-task/task/v3/cmd/task@latest
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: semaphore
- name: Write config
run: |
2024-05-04 00:06:34 +02:00
cat > config.stdin <<EOF
1
localhost:3306
semaphore
p455w0rd
semaphore
/tmp/semaphore
http://localhost:3000
no
no
no
no
no
no
$(pwd)/.dredd
admin
admin@localhost
Developer
password
EOF
- name: Execute setup
run: |
chmod +x ./semaphore && ./semaphore setup - < config.stdin
- name: Launch dredd
run: |
task e2e:goodman
task e2e:deps
task e2e:hooks
task e2e:test
2024-05-03 22:23:28 +02:00
integrate-mariadb:
runs-on: ubuntu-latest
needs:
- migrate-mariadb
2024-05-04 00:06:34 +02:00
services:
mariadb:
image: mariadb:10.4
env:
MARIADB_ROOT_PASSWORD: p455w0rd
MARIADB_USER: semaphore
MARIADB_PASSWORD: p455w0rd
MARIADB_DATABASE: semaphore
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
2024-05-03 22:23:28 +02:00
steps:
- name: Checkout source
uses: actions/checkout@v4
2024-05-04 00:06:34 +02:00
- name: Setup golang
uses: actions/setup-go@v5
with:
go-version: '^1.21.0'
- name: Setup nodejs
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install go-task
run: |
2024-05-04 00:06:34 +02:00
go install github.com/go-task/task/v3/cmd/task@latest
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: semaphore
- name: Write config
run: |
cat > config.stdin <<EOF
1
localhost:3306
semaphore
p455w0rd
semaphore
/tmp/semaphore
http://localhost:3000
no
no
no
no
no
no
$(pwd)/.dredd
admin
admin@localhost
Developer
password
EOF
- name: Execute setup
run: |
chmod +x ./semaphore && ./semaphore setup - < config.stdin
- name: Launch dredd
run: |
task e2e:goodman
task e2e:deps
task e2e:hooks
task e2e:test
2024-05-03 22:23:28 +02:00
integrate-postgres:
runs-on: ubuntu-latest
needs:
- migrate-postgres
2024-05-04 00:06:34 +02:00
services:
postgres:
image: postgres:12.18
env:
POSTGRES_USER: semaphore
POSTGRES_PASSWORD: p455w0rd
POSTGRES_DB: semaphore
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
2024-05-03 22:23:28 +02:00
steps:
- name: Checkout source
uses: actions/checkout@v4
2024-05-04 00:06:34 +02:00
- name: Setup golang
uses: actions/setup-go@v5
with:
go-version: '^1.21.0'
- name: Setup nodejs
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Install go-task
run: |
go install github.com/go-task/task/v3/cmd/task@latest
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: semaphore
- name: Write config
run: |
cat > config.stdin <<EOF
3
localhost:5432
semaphore
p455w0rd
semaphore
/tmp/semaphore
http://localhost:3000
no
no
no
no
no
no
$(pwd)/.dredd
admin
admin@localhost
Developer
password
EOF
- name: Execute setup
run: |
chmod +x ./semaphore && ./semaphore setup - < config.stdin
- name: Launch dredd
run: |
2024-05-04 00:06:34 +02:00
task e2e:goodman
task e2e:deps
task e2e:hooks
task e2e:test
2022-06-20 18:30:33 +02:00
deploy-server:
runs-on: ubuntu-latest
2024-05-04 01:34:42 +02:00
if: github.repository_owner == 'semaphoreui'
2022-06-29 18:28:08 +02:00
needs:
2024-05-03 22:23:28 +02:00
- integrate-boltdb
- integrate-mysql
- integrate-mariadb
- integrate-postgres
2022-06-29 18:28:08 +02:00
steps:
- name: Checkout source
uses: actions/checkout@v4
2022-06-29 18:28:08 +02:00
- name: Setup qemu
id: qemu
uses: docker/setup-qemu-action@v3
2022-06-29 18:28:08 +02:00
- name: Setup buildx
id: buildx
uses: docker/setup-buildx-action@v3
2022-10-23 11:48:52 +02:00
- name: Hub login
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
2022-10-23 11:48:52 +02:00
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Server meta
id: server
uses: docker/metadata-action@v5
2023-09-13 12:43:11 +02:00
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: |
semaphoreui/semaphore
labels: |
org.opencontainers.image.vendor=SemaphoreUI
maintainer=Semaphore UI <support@semui.co>
tags: |
type=raw,value=develop
flavor: |
latest=false
- name: Server build
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
2023-09-13 12:43:11 +02:00
context: .
file: deployment/docker/server/Dockerfile
2024-05-20 17:06:06 +02:00
platforms: linux/amd64,linux/arm64 #,linux/arm/v6
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.server.outputs.labels }}
tags: ${{ steps.server.outputs.tags }}
2022-06-29 18:28:08 +02:00
deploy-runner:
runs-on: ubuntu-latest
if: github.repository_owner == 'semaphoreui'
needs:
- integrate-boltdb
- integrate-mysql
- integrate-mariadb
- integrate-postgres
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup qemu
id: qemu
uses: docker/setup-qemu-action@v3
- name: Setup buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Hub login
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Runner meta
id: runner
uses: docker/metadata-action@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: |
semaphoreui/runner
labels: |
org.opencontainers.image.vendor=SemaphoreUI
maintainer=Semaphore UI <support@semui.co>
tags: |
type=raw,value=develop
flavor: |
latest=false
- name: Runner build
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: deployment/docker/runner/Dockerfile
platforms: linux/amd64,linux/arm64 #,linux/arm/v6
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.runner.outputs.labels }}
tags: ${{ steps.runner.outputs.tags }}