mirror of https://github.com/statping/statping
add a data job to fetch the version in one central place
the only downside to this is that every job now has a dependency on data, but I think that's acceptablepull/1118/head
parent
a2ebef4da6
commit
5655592864
|
@ -22,8 +22,21 @@ env:
|
||||||
|| github.ref == 'refs/heads/unstable')
|
|| github.ref == 'refs/heads/unstable')
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
data:
|
||||||
|
# this job collects general variables and inputs for later use.
|
||||||
|
# not all of them might be needed but having them in a central place is more helpful than 100% efficiency.
|
||||||
|
# also, the name is intentionally short to make later references shorter.
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: get version
|
||||||
|
id: version
|
||||||
|
run: echo "::set-output name=version::$(cat version.txt)"
|
||||||
frontend:
|
frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: data
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
|
@ -33,10 +46,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: 12.18.2
|
node-version: 12.18.2
|
||||||
|
|
||||||
- name: Set Version
|
- name: Add go/bin to path
|
||||||
run: |
|
run: |
|
||||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||||
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Install Global Dependencies
|
- name: Install Global Dependencies
|
||||||
|
@ -54,7 +66,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build Frontend Statping
|
- name: Build Frontend Statping
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ needs.data.outputs.version }}
|
||||||
COMMIT: ${{ github.sha }}
|
COMMIT: ${{ github.sha }}
|
||||||
MJML_APP: ${{ secrets.MJML_APP }}
|
MJML_APP: ${{ secrets.MJML_APP }}
|
||||||
MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }}
|
MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }}
|
||||||
|
@ -86,7 +98,7 @@ jobs:
|
||||||
rm -rf source.tar.gz
|
rm -rf source.tar.gz
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: frontend
|
needs: [ data, frontend ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -121,11 +133,6 @@ jobs:
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
aws-region: us-west-2
|
aws-region: us-west-2
|
||||||
|
|
||||||
- name: Add GOBIN to PATH
|
|
||||||
run: |
|
|
||||||
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Set Linux Build Flags
|
- name: Set Linux Build Flags
|
||||||
if: matrix.platform == 'linux'
|
if: matrix.platform == 'linux'
|
||||||
run: |
|
run: |
|
||||||
|
@ -149,7 +156,7 @@ jobs:
|
||||||
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
|
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
|
||||||
uses: crazy-max/ghaction-xgo@v1
|
uses: crazy-max/ghaction-xgo@v1
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ needs.data.outputs.version }}
|
||||||
COMMIT: ${{ github.sha }}
|
COMMIT: ${{ github.sha }}
|
||||||
with:
|
with:
|
||||||
xgo_version: latest
|
xgo_version: latest
|
||||||
|
@ -163,7 +170,7 @@ jobs:
|
||||||
pkg: cmd
|
pkg: cmd
|
||||||
buildmode: pie
|
buildmode: pie
|
||||||
tags: ${{ env.XGO_TAGS }}
|
tags: ${{ env.XGO_TAGS }}
|
||||||
ldflags: -s -w -X main.VERSION=${{ env.VERSION }} -X main.COMMIT=${{ env.COMMIT }} ${{ env.BUILD_FLAGS }}
|
ldflags: -s -w -X main.VERSION=${{ needs.data.outputs.version }} -X main.COMMIT=${{ env.COMMIT }} ${{ env.BUILD_FLAGS }}
|
||||||
|
|
||||||
- name: Compress Linux Builds
|
- name: Compress Linux Builds
|
||||||
if: matrix.platform == 'linux'
|
if: matrix.platform == 'linux'
|
||||||
|
@ -208,7 +215,7 @@ jobs:
|
||||||
aws s3 cp build/${{ env.compressed }} s3://assets.statping.com/commit/${{ github.sha }}/
|
aws s3 cp build/${{ env.compressed }} s3://assets.statping.com/commit/${{ github.sha }}/
|
||||||
|
|
||||||
test:
|
test:
|
||||||
needs: frontend
|
needs: [ data, frontend ]
|
||||||
# temporarily disabled
|
# temporarily disabled
|
||||||
if: "false"
|
if: "false"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -248,7 +255,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||||
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
|
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
|
||||||
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
|
@ -259,7 +265,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install Statping
|
- name: Install Statping
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ needs.data.outputs.version }}
|
||||||
COMMIT: ${{ github.sha }}
|
COMMIT: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
make build certs
|
make build certs
|
||||||
|
@ -271,7 +277,7 @@ jobs:
|
||||||
go get gotest.tools/gotestsum
|
go get gotest.tools/gotestsum
|
||||||
gotestsum --no-summary=skipped --format testname -- -covermode=count -coverprofile=coverage.out -p=1 ./...
|
gotestsum --no-summary=skipped --format testname -- -covermode=count -coverprofile=coverage.out -p=1 ./...
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ needs.data.outputs.version }}
|
||||||
COMMIT: ${{ github.sha }}
|
COMMIT: ${{ github.sha }}
|
||||||
DB_CONN: sqlite3
|
DB_CONN: sqlite3
|
||||||
STATPING_DIR: ${{ github.workspace }}
|
STATPING_DIR: ${{ github.workspace }}
|
||||||
|
@ -314,7 +320,7 @@ jobs:
|
||||||
COVERALLS: ${{ secrets.COVERALLS }}
|
COVERALLS: ${{ secrets.COVERALLS }}
|
||||||
|
|
||||||
test-postman-sqlite:
|
test-postman-sqlite:
|
||||||
needs: frontend
|
needs: [ data, frontend ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -326,7 +332,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||||
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
|
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
|
||||||
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
|
@ -337,7 +342,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install Statping
|
- name: Install Statping
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ needs.data.outputs.version }}
|
||||||
COMMIT: ${{ github.sha }}
|
COMMIT: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
make build
|
make build
|
||||||
|
@ -357,7 +362,7 @@ jobs:
|
||||||
delayRequest: 600
|
delayRequest: 600
|
||||||
|
|
||||||
test-postman-mysql:
|
test-postman-mysql:
|
||||||
needs: frontend
|
needs: [ data, frontend ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
@ -380,7 +385,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||||
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
|
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
|
||||||
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
|
@ -391,7 +395,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install Statping
|
- name: Install Statping
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ needs.data.outputs.version }}
|
||||||
COMMIT: ${{ github.sha }}
|
COMMIT: ${{ github.sha }}
|
||||||
MJML_APP: ${{ secrets.MJML_APP }}
|
MJML_APP: ${{ secrets.MJML_APP }}
|
||||||
MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }}
|
MJML_PRIVATE: ${{ secrets.MJML_PRIVATE }}
|
||||||
|
@ -413,7 +417,7 @@ jobs:
|
||||||
delayRequest: 600
|
delayRequest: 600
|
||||||
|
|
||||||
test-postman-postgres:
|
test-postman-postgres:
|
||||||
needs: frontend
|
needs: [ data, frontend ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
@ -437,7 +441,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||||
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
|
echo "/opt/hostedtoolcache/node/12.18.2/x64/bin" >> $GITHUB_PATH
|
||||||
echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
|
@ -448,7 +451,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install Statping
|
- name: Install Statping
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ needs.data.outputs.version }}
|
||||||
COMMIT: ${{ github.sha }}
|
COMMIT: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
make build
|
make build
|
||||||
|
@ -479,7 +482,7 @@ jobs:
|
||||||
&& (github.ref == 'refs/heads/stable'
|
&& (github.ref == 'refs/heads/stable'
|
||||||
|| github.ref == 'refs/heads/unstable')
|
|| github.ref == 'refs/heads/unstable')
|
||||||
)
|
)
|
||||||
needs: [ build, test-postman-sqlite, test-postman-mysql, test-postman-postgres ]
|
needs: [ data, build, test-postman-sqlite, test-postman-mysql, test-postman-postgres ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: dummy operation
|
- name: dummy operation
|
||||||
|
@ -488,13 +491,9 @@ jobs:
|
||||||
|
|
||||||
github-release:
|
github-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: release-precondition-check
|
needs: [ data, release-precondition-check ]
|
||||||
steps:
|
steps:
|
||||||
# TODO read version somewhere *once* and use output globally
|
# TODO read version somewhere *once* and use output globally
|
||||||
- name: Checkout Statping Repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setting ENV's
|
|
||||||
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
|
||||||
- name: Download job artifacts
|
- name: Download job artifacts
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
@ -508,26 +507,22 @@ jobs:
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
VERSION: ${{ env.VERSION }}
|
VERSION: ${{ needs.data.outputs.version }}
|
||||||
with:
|
with:
|
||||||
# add "dev-" prefix for unstable releases
|
# add "dev-" prefix for unstable releases
|
||||||
tag_name: ${{ env.is_unstable && 'dev-' || '' }}v${{ env.VERSION }}
|
tag_name: ${{ env.is_unstable && 'dev-' || '' }}v${{ needs.data.outputs.version }}
|
||||||
draft: true
|
draft: true
|
||||||
prerelease: true
|
prerelease: true
|
||||||
files: files/statping-*
|
files: files/statping-*
|
||||||
|
|
||||||
docker-release:
|
docker-release:
|
||||||
needs: release-precondition-check
|
needs: [ data, release-precondition-check ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Statping Repo
|
- name: Checkout Statping Repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setting ENV's
|
|
||||||
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue