mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 00:45:19 +00:00
Add Fleet server deployment in CI (#3530)
Still needs further testing as it must be merged to `main` to test it out on GitHub.
This commit is contained in:
parent
2f4ecb1b6b
commit
12df9fbfce
82
.github/workflows/build-binaries.yaml
vendored
Normal file
82
.github/workflows/build-binaries.yaml
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
name: Build binaries
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-binaries:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# # Pre-starting dependencies here means they are ready to go when we need them.
|
||||
# - name: Start Infra Dependencies
|
||||
# # Use & to background this
|
||||
# run: docker-compose up -d mysql redis &
|
||||
|
||||
- name: JS Dependency Cache
|
||||
id: js-cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
**/node_modules
|
||||
# Use a separate cache for this from other JS jobs since we run the
|
||||
# webpack steps and will have more to cache.
|
||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules-
|
||||
|
||||
- name: Go Cache
|
||||
id: go-cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# In order:
|
||||
# * Module download cache
|
||||
# * Build cache (Linux)
|
||||
# * Build cache (Mac)
|
||||
# * Build cache (Windows)
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
~/Library/Caches/go-build
|
||||
%LocalAppData%\go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Install JS Dependencies
|
||||
if: steps.js-cache.outputs.cache-hit != 'true'
|
||||
run: make deps-js
|
||||
|
||||
- name: Install Go Dependencies
|
||||
if: steps.go-cache.outputs.cache-hit != 'true'
|
||||
run: make deps-go
|
||||
|
||||
- name: Generate static files
|
||||
run: |
|
||||
export PATH=$PATH:~/go/bin
|
||||
make generate
|
||||
|
||||
- name: Build binaries
|
||||
run: make
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build
|
||||
path: build/
|
||||
|
||||
# - name: Start Fleet server
|
||||
# run: ./build/fleet prepare db --dev && ./build/fleet serve --dev --server_tls=false &
|
||||
|
||||
# - name: Tunnel Fleet server
|
||||
# run: npm install -g localtunnel && lt --port 8080
|
58
.github/workflows/deploy-staging.yml
vendored
Normal file
58
.github/workflows/deploy-staging.yml
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
name: Deploy staging
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- Build binaries
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
echo:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: echo event
|
||||
run: echo '${{ toJson(github.event) }}'
|
||||
|
||||
on-pr:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
# Pre-starting dependencies here means they are ready to go when we need them.
|
||||
- name: Start Infra Dependencies
|
||||
# Use & to background this
|
||||
run: docker-compose up -d mysql redis &
|
||||
- name: Download binaries
|
||||
uses: dawidd6/action-download-artifact@09385b76de790122f4da9c82b17bccf858b9557c #v2.16.0
|
||||
with:
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
name: build
|
||||
|
||||
- name: Start Fleet server
|
||||
run: |
|
||||
./build/fleet prepare db --dev && ./build/fleet serve --dev --server_tls=false &
|
||||
npm install -g localtunnel && lt --port 8080
|
||||
|
||||
on-main:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.branch == 'main' }}
|
||||
steps:
|
||||
# Pre-starting dependencies here means they are ready to go when we need them.
|
||||
- name: Start Infra Dependencies
|
||||
# Use & to background this
|
||||
run: docker-compose up -d mysql redis &
|
||||
- name: Download binaries
|
||||
uses: dawidd6/action-download-artifact@09385b76de790122f4da9c82b17bccf858b9557c #v2.16.0
|
||||
with:
|
||||
branch: main
|
||||
name: build
|
||||
|
||||
- name: Start Fleet server
|
||||
run: |
|
||||
./build/fleet prepare db --dev && ./build/fleet serve --dev --server_tls=false &
|
||||
npm install -g localtunnel && lt --port 8080
|
||||
|
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
@ -12,7 +12,8 @@
|
||||
"cwd": "${fileDirname}",
|
||||
"env": {
|
||||
"MYSQL_TEST": 1,
|
||||
"REDIS_TEST": 1
|
||||
"REDIS_TEST": 1,
|
||||
"NETWORK_TEST": 1
|
||||
},
|
||||
"buildFlags": "-tags='full,fts5'",
|
||||
"program": "${fileDirname}"
|
||||
@ -25,7 +26,8 @@
|
||||
"cwd": "${fileDirname}",
|
||||
"env": {
|
||||
"MYSQL_TEST": 1,
|
||||
"REDIS_TEST": 1
|
||||
"REDIS_TEST": 1,
|
||||
"NETWORK_TEST": 1
|
||||
},
|
||||
"buildFlags": "-tags='full,fts5'",
|
||||
"program": "${file}"
|
||||
|
Loading…
Reference in New Issue
Block a user