mirror of
https://github.com/prymitive/karma
synced 2026-08-23 11:56:20 +00:00
chore(ci): migrate to GitHub actions
This commit is contained in:
committed by
Łukasz Mierzwa
parent
668aa3d97b
commit
64d332aec2
@@ -1,29 +0,0 @@
|
||||
# This workflow checks out code, performs an Anchore container image
|
||||
# vulnerability and compliance scan, and integrates the results with
|
||||
# GitHub Advanced Security code scanning feature. For more information on
|
||||
# the Anchore scan action usage and parameters, see
|
||||
# https://github.com/anchore/scan-action. For more information on
|
||||
# Anchore container image scanning in general, see
|
||||
# https://docs.anchore.com.
|
||||
|
||||
name: Anchore Container Scan
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
Anchore-Build-Scan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag localbuild/testimage:latest
|
||||
- name: Run the local Anchore scan action itself with GitHub Advanced Security code scanning integration enabled
|
||||
uses: anchore/scan-action@v2
|
||||
with:
|
||||
image: "localbuild/testimage:latest"
|
||||
acs-report-enable: true
|
||||
- name: Upload Anchore Scan Report
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -1,38 +0,0 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
schedule:
|
||||
- cron: "0 6 * * 4"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
@@ -0,0 +1,796 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
test-go:
|
||||
name: Test Go code
|
||||
if: github.event_name != 'release'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.5
|
||||
|
||||
- name: Cache Go modules
|
||||
id: cache-go-modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-go-modules-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-go-modules-
|
||||
|
||||
- name: Fetch all Go modules
|
||||
if: steps.cache-go-modules.outputs.cache-hit != 'true'
|
||||
run: make download-deps-go
|
||||
|
||||
- name: Mock web assets
|
||||
run: make mock-assets
|
||||
|
||||
- name: Test Go code
|
||||
run: make test-go
|
||||
|
||||
- name: Report code coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
flags: backend
|
||||
|
||||
lint-go:
|
||||
name: Lint Go code
|
||||
needs: test-go
|
||||
if: github.event_name != 'release'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.5
|
||||
|
||||
- name: Cache Go modules
|
||||
id: cache-go-modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-go-modules-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-go-modules-
|
||||
|
||||
- name: Fetch all Go modules
|
||||
if: steps.cache-go-modules.outputs.cache-hit != 'true'
|
||||
run: make download-deps-go
|
||||
|
||||
- name: Mock web assets
|
||||
run: make mock-assets
|
||||
|
||||
- name: Lint Go code
|
||||
run: make make lint-go
|
||||
|
||||
format-go:
|
||||
name: Check Go code formatting
|
||||
needs: lint-go
|
||||
if: github.event_name != 'release'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.5
|
||||
|
||||
- name: Format Go code
|
||||
run: make format-go
|
||||
|
||||
- name: Check for local changes
|
||||
run: git diff --exit-code
|
||||
|
||||
go-mod-tidy:
|
||||
name: Verify go.sum
|
||||
if: github.event_name != 'release'
|
||||
needs: lint-go
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.5
|
||||
|
||||
- name: Mock web assets
|
||||
run: make mock-assets
|
||||
|
||||
- name: Fetch code
|
||||
run: go get -d -v ./cmd/karma
|
||||
|
||||
- name: Run go mod tidy
|
||||
run: go mod tidy
|
||||
|
||||
- name: Tidy tools
|
||||
run: make tools-go-mod-tidy
|
||||
|
||||
- name: Check for local changes
|
||||
run: git diff --exit-code
|
||||
|
||||
openapi:
|
||||
name: Verify OpenAPI client code
|
||||
if: github.event_name != 'release'
|
||||
needs:
|
||||
- lint-go
|
||||
- go-mod-tidy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.5
|
||||
|
||||
- name: Generate OpenAPI code
|
||||
run: make openapi-client
|
||||
|
||||
- name: Check for local changes
|
||||
run: git diff --exit-code
|
||||
|
||||
test-js:
|
||||
name: Test JS code
|
||||
if: github.event_name != 'release'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
env:
|
||||
- ""
|
||||
- "env TZ=Pacific/Easter"
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Node JS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.15.1
|
||||
|
||||
- name: Cache NPM modules
|
||||
id: cache-npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-npm-
|
||||
|
||||
- name: Fetch all NPM dependencies
|
||||
if: steps.cache-npm.outputs.cache-hit != 'true'
|
||||
run: make -C ui npm-fetch
|
||||
|
||||
- name: Test Node JS code
|
||||
run: ${{ matrix.env }} make -C ui test-js
|
||||
env:
|
||||
NODE_ENV: test
|
||||
|
||||
- name: Report code coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
flags: ui
|
||||
|
||||
lint-js:
|
||||
name: Lint JS code
|
||||
if: github.event_name != 'release'
|
||||
needs: test-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Node JS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.15.1
|
||||
|
||||
- name: Cache NPM modules
|
||||
id: cache-npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-npm-
|
||||
|
||||
- name: Fetch all NPM dependencies
|
||||
if: steps.cache-npm.outputs.cache-hit != 'true'
|
||||
run: make -C ui npm-fetch
|
||||
|
||||
- name: Lint Node JS code
|
||||
run: make -C ui lint-js
|
||||
|
||||
format-js:
|
||||
name: Check JS code formatting
|
||||
if: github.event_name != 'release'
|
||||
needs: lint-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Node JS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.15.1
|
||||
|
||||
- name: Cache NPM modules
|
||||
id: cache-npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-npm-
|
||||
|
||||
- name: Fetch all NPM dependencies
|
||||
if: steps.cache-npm.outputs.cache-hit != 'true'
|
||||
run: make -C ui npm-fetch
|
||||
|
||||
- name: Lint Node JS code
|
||||
run: make -C ui format
|
||||
|
||||
- name: Check for local changes
|
||||
run: git diff --exit-code
|
||||
|
||||
deps-js:
|
||||
name: Check JS dependencies
|
||||
if: github.event_name != 'release'
|
||||
needs: lint-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Node JS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.15.1
|
||||
|
||||
- name: Cache NPM modules
|
||||
id: cache-npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-npm-
|
||||
|
||||
- name: Fetch all NPM dependencies
|
||||
if: steps.cache-npm.outputs.cache-hit != 'true'
|
||||
run: make -C ui npm-fetch
|
||||
|
||||
- name: Lint Node JS dependencies
|
||||
run: make -C ui lint-deps
|
||||
|
||||
lint-versions:
|
||||
name: Lint Versions
|
||||
if: github.event_name != 'release'
|
||||
needs: lint-go
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Lint Go Versions
|
||||
run: make lint-golang-version
|
||||
|
||||
- name: Lint Node JS Versions
|
||||
run: make lint-nodejs-version
|
||||
|
||||
- name: Lint Bootstrap Version
|
||||
run: make lint-bootstrap-version
|
||||
|
||||
typescript:
|
||||
name: Check for non-typescript components
|
||||
if: github.event_name != 'release'
|
||||
needs: lint-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check for non-typescript UI components
|
||||
run: make -C ui lint-typescript
|
||||
|
||||
changelog:
|
||||
name: Generate Changelog
|
||||
if: github.event_name != 'release'
|
||||
needs:
|
||||
- lint-go
|
||||
- lint-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.5
|
||||
|
||||
- name: Cache Go modules
|
||||
id: cache-go-modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-go-modules-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-go-modules-
|
||||
|
||||
- name: Fetch all Go modules
|
||||
if: steps.cache-go-modules.outputs.cache-hit != 'true'
|
||||
run: make download-deps-go
|
||||
|
||||
- name: Generate Changelog
|
||||
run: make changelog
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
git-commit:
|
||||
name: Lint git commit
|
||||
if: github.event_name != 'release'
|
||||
needs:
|
||||
- lint-go
|
||||
- lint-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 100
|
||||
|
||||
- name: Lint git commit
|
||||
uses: wagoid/commitlint-github-action@v2.0.3
|
||||
with:
|
||||
configFile: .commitlintrc.js
|
||||
|
||||
docs:
|
||||
name: Lint documentation
|
||||
if: github.event_name != 'release'
|
||||
needs:
|
||||
- lint-go
|
||||
- lint-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run markdown-lint
|
||||
uses: avto-dev/markdown-lint@v1.4.0
|
||||
with:
|
||||
args: "*.md docs"
|
||||
|
||||
benchmark-go:
|
||||
name: Benchmark Go code compare
|
||||
if: github.event_name == 'pull_request'
|
||||
needs:
|
||||
- lint-go
|
||||
- lint-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 200
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.5
|
||||
|
||||
- name: Cache Go modules
|
||||
id: cache-go-modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-go-modules-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-go-modules-
|
||||
|
||||
- name: Fetch all Go modules
|
||||
if: steps.cache-go-modules.outputs.cache-hit != 'true'
|
||||
run: make download-deps-go
|
||||
|
||||
- name: Mock web assets
|
||||
run: make mock-assets
|
||||
|
||||
- name: Run benchmark
|
||||
run: ./scripts/have-backend-changes.sh || ./scripts/ci-diff-benchmark-go.sh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PULL_REQUEST_NUMBER: ${{ github.event.number }}
|
||||
|
||||
webpack-bundle-size:
|
||||
name: Webpack bundle size compare
|
||||
if: github.event_name == 'pull_request'
|
||||
needs:
|
||||
- lint-go
|
||||
- lint-js
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 200
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Node JS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.15.1
|
||||
|
||||
- name: Cache NPM modules
|
||||
id: cache-npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-npm-
|
||||
|
||||
- name: Fetch all NPM dependencies
|
||||
if: steps.cache-npm.outputs.cache-hit != 'true'
|
||||
run: make -C ui npm-fetch
|
||||
|
||||
- name: Diff bundle size
|
||||
run: ./scripts/have-ui-changes.sh || ./scripts/ci-diff-webpack.sh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PULL_REQUEST_NUMBER: ${{ github.event.number }}
|
||||
|
||||
percy:
|
||||
name: Percy UI snapshots
|
||||
if: github.event_name != 'release'
|
||||
needs:
|
||||
- test-go
|
||||
- test-js
|
||||
- format-go
|
||||
- format-js
|
||||
- lint-go
|
||||
- lint-js
|
||||
- go-mod-tidy
|
||||
- openapi
|
||||
- git-commit
|
||||
- lint-versions
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 200
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Node JS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.15.1
|
||||
|
||||
- name: Cache NPM modules
|
||||
id: cache-npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-npm-
|
||||
|
||||
- name: Fetch all NPM dependencies
|
||||
if: steps.cache-npm.outputs.cache-hit != 'true'
|
||||
run: make -C ui npm-fetch
|
||||
|
||||
- name: Run Percy
|
||||
shell: bash
|
||||
run: ./scripts/percy-skip-deps.sh || make -C ui test-percy
|
||||
env:
|
||||
NODE_ENV: test
|
||||
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
|
||||
|
||||
cross-compile:
|
||||
name: Cross compile binaries
|
||||
needs:
|
||||
- test-go
|
||||
- test-js
|
||||
- format-go
|
||||
- format-js
|
||||
- lint-go
|
||||
- lint-js
|
||||
- go-mod-tidy
|
||||
- openapi
|
||||
- git-commit
|
||||
- lint-versions
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 200
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.5
|
||||
|
||||
- name: Set up Node JS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.15.1
|
||||
|
||||
- name: Cache Go modules and build cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
~/.npm
|
||||
key: ${{ runner.os }}-${{ env.GITHUB_REF_SLUG }}-go-cc-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-master-go-cc-
|
||||
|
||||
- name: Cross compile binaries
|
||||
run: make crosscompile -j 2
|
||||
env:
|
||||
NODE_ENV: production
|
||||
|
||||
- name: Compress binaries
|
||||
run: |
|
||||
mkdir -p artifacts
|
||||
export SOURCE_DATE_EPOCH=$(git show -s --format=%ci ${GITHUB_SHA})
|
||||
for i in karma-*; do tar --mtime="${SOURCE_DATE_EPOCH}" --owner=0 --group=0 --numeric-owner -c $i | gzip -n - > artifacts/$i.tar.gz; done
|
||||
shasum -a 512 artifacts/karma-*.tar.gz | tee artifacts/sha512sum.txt
|
||||
- name: Get release
|
||||
if: github.event_name == 'release'
|
||||
id: get_release
|
||||
uses: bruceadams/get-release@v1.2.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Upload binaries to GitHub release
|
||||
if: github.event_name == 'release'
|
||||
uses: AButler/upload-release-assets@v2.0
|
||||
with:
|
||||
files: "artifacts/*"
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
docker:
|
||||
name: Build docker image
|
||||
needs:
|
||||
- test-go
|
||||
- test-js
|
||||
- format-go
|
||||
- format-js
|
||||
- lint-go
|
||||
- lint-js
|
||||
- go-mod-tidy
|
||||
- openapi
|
||||
- git-commit
|
||||
- lint-versions
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 200
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Build Docker image
|
||||
run: make docker-image
|
||||
|
||||
- name: "Tag :latest for Docker Hub"
|
||||
run: docker tag karma:latest lmierzwa/karma:latest
|
||||
|
||||
- name: "Tag :vX.Y for Docker Hub"
|
||||
if: github.event_name == 'release'
|
||||
run: docker tag karma:latest lmierzwa/karma:${{ env.GITHUB_REF_SLUG }}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
shell: bash
|
||||
run: echo "${DOCKER_HUB_PASSWORD}" | docker login -u lmierzwa --password-stdin
|
||||
env:
|
||||
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
|
||||
- name: Push Docker image to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
run: docker push lmierzwa/karma
|
||||
|
||||
- name: "Tag :latest for GitHub Container Registry"
|
||||
run: docker tag karma:latest ghcr.io/prymitive/karma:latest
|
||||
|
||||
- name: "Tag :vX.Y for GitHub Container Registry"
|
||||
if: github.event_name == 'release'
|
||||
run: docker tag karma:latest ghcr.io/prymitive/karma:${{ env.GITHUB_REF_SLUG }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
shell: bash
|
||||
run: echo "${GITHUB_PKG_TOKEN}" | docker login ghcr.io -u prymitive --password-stdin
|
||||
env:
|
||||
GITHUB_PKG_TOKEN: ${{ secrets.GITHUB_PKG_TOKEN }}
|
||||
|
||||
- name: Push Docker image to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
run: docker push ghcr.io/prymitive/karma
|
||||
|
||||
demo-deploy:
|
||||
name: Deploy demo app to Heroku
|
||||
needs:
|
||||
- test-go
|
||||
- test-js
|
||||
- format-go
|
||||
- format-js
|
||||
- lint-go
|
||||
- lint-js
|
||||
- go-mod-tidy
|
||||
- openapi
|
||||
- git-commit
|
||||
- lint-versions
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 200
|
||||
|
||||
- name: Set git slug envs
|
||||
uses: rlespinasse/github-slug-action@3.1.0
|
||||
|
||||
- name: Get version
|
||||
run: |
|
||||
echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`"
|
||||
VERSION=$(make show-version)
|
||||
echo "::set-env name=VERSION::${VERSION}"
|
||||
echo "::`echo -n ${{ github.token }} | sha256sum | head -c 64`::"
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build --build-arg VERSION=${VERSION} -t registry.heroku.com/karma-demo/web -f demo/Dockerfile .
|
||||
|
||||
- name: Write .netrc
|
||||
run: |
|
||||
echo "machine api.heroku.com" >> $HOME/.netrc
|
||||
echo " login l.mierzwa@gmail.com" >> $HOME/.netrc
|
||||
echo " password ${HEROKU_API_KEY}" >> $HOME/.netrc
|
||||
env:
|
||||
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
|
||||
|
||||
- name: Login to Heroku
|
||||
run: echo "${HEROKU_API_KEY}" | docker login registry.heroku.com -u _ --password-stdin
|
||||
env:
|
||||
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
|
||||
|
||||
- name: Push docker image to Heroku
|
||||
run: docker push registry.heroku.com/karma-demo/web
|
||||
|
||||
- name: Install Heroku CLI
|
||||
run: curl -s --connect-timeout 30 --fail https://cli-assets.heroku.com/install.sh | sh
|
||||
|
||||
- name: Trigger Heroku release
|
||||
run: /usr/local/bin/heroku container:release web --app karma-demo
|
||||
|
||||
demo-e2e:
|
||||
name: Test demo app
|
||||
needs: demo-deploy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node JS
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.15.1
|
||||
|
||||
- name: Run e2e test
|
||||
run: make -C ui test-demo
|
||||
|
||||
codeql:
|
||||
name: CodeQL
|
||||
if: github.event_name != 'release'
|
||||
needs:
|
||||
- cross-compile
|
||||
- docker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
|
||||
anchore:
|
||||
name: Anchore Container Scan
|
||||
if: github.event_name != 'release'
|
||||
needs:
|
||||
- cross-compile
|
||||
- docker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag localbuild/testimage:latest
|
||||
|
||||
- name: Run the local Anchore scan action itself with GitHub Advanced Security code scanning integration enabled
|
||||
uses: anchore/scan-action@v2
|
||||
with:
|
||||
image: "localbuild/testimage:latest"
|
||||
acs-report-enable: true
|
||||
|
||||
- name: Upload Anchore Scan Report
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
-322
@@ -1,322 +0,0 @@
|
||||
__defaults_go: &DEFAULTS_GO
|
||||
language: go
|
||||
go: "1.15.5"
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.npm"
|
||||
# https://restic.net/blog/2018-09-02/travis-build-cache
|
||||
- $HOME/.cache/go-build
|
||||
- $HOME/gopath/pkg/mod
|
||||
before_cache:
|
||||
# this log file is updated on every get/set operation
|
||||
# so it forces new cache archive on every build
|
||||
# remove it before creating cache archive
|
||||
- rm -vf $HOME/.cache/go-build/log.txt
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
|
||||
__defaults_js: &DEFAULTS_JS
|
||||
language: node_js
|
||||
# we run make to install everything
|
||||
install: []
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.npm"
|
||||
env:
|
||||
- NODE_ENV=test
|
||||
|
||||
git:
|
||||
depth: 100
|
||||
|
||||
os: linux
|
||||
language: shell
|
||||
|
||||
jobs:
|
||||
allow_failures:
|
||||
- name: Percy UI snapshots
|
||||
- name: Webpack bundle size compare
|
||||
- name: Benchmark Go code compare
|
||||
include:
|
||||
- stage: Stats
|
||||
name: Webpack bundle size compare
|
||||
if: (repo = prymitive/karma AND type = pull_request AND fork = false)
|
||||
<<: *DEFAULTS_JS
|
||||
env:
|
||||
# GITHUB_TOKEN for CI Bundle size diff comments and gist uploads
|
||||
- secure: "Or5fiXZfgIsXvzoOdEprRwJ0uwUjMvxGHE3LG+h3OsIBO6WA8vgOqVOjqVHV2dgC9cSjm5A7MX52S7cDqfkQDkgnVHpVxRwDC9n9O4vnaFdCZ4nC+d18z8dikbiwgdeWQ+Wi6RhZENye1Lu5sBaAJ09wYgx9lNdEVpRaTUvUw6grSlESJZSXoxfxWWpmTyx+yPH4sxuWjZ7gCspDX9s9k4fjpY4LkhQQwLlk8wPc2hfDg48e+K1OR6sYB8uRS33Xc4fQtzElzazmaZ0fn77h5ysDgC1g/ko+E2j8HHMbZvFpzYpm1bCpIv1G/0A2ItH7gT3HsuwkDvfH/it56JTCbBWJJ+hTDeswCQNu0h797QM6jv0o5wgKpHR1t+AeM9vDe4Ds0pAXouJz0LJewNOdNvi5O1BZA9OooKc34hwTJs/zj5NwiZuOyPSMhDBGa++Vhsr9K3rPD9+97M2hac6NO6TBVWZjvqJilmkjJs+bKrl//ClBvdhDGkJNDbB+2emdD1/wzpPVJPp3IRhzeEF89IVE58qE+OQnIwtbEZ2W1ct6Ep7ZJdrXWc/VBdJB1ELfUtNmkvWFZD5IJfnb/Z5MS6iespXlV5alPQ7eZ2jNl3tn7uDaCStuQN1tO2wthNnsSU/OkfFRch/Ks3gYC5+v7n8aJMkTYFmHr4Y/xlXBsrA="
|
||||
script:
|
||||
- ./scripts/have-ui-changes.sh || ./scripts/ci-diff-webpack.sh
|
||||
|
||||
- stage: Stats
|
||||
name: Benchmark Go code compare
|
||||
if: (repo = prymitive/karma AND type = pull_request AND fork = false)
|
||||
<<: *DEFAULTS_GO
|
||||
env:
|
||||
# GITHUB_TOKEN for CI Bundle size diff comments and gist uploads
|
||||
- secure: "Or5fiXZfgIsXvzoOdEprRwJ0uwUjMvxGHE3LG+h3OsIBO6WA8vgOqVOjqVHV2dgC9cSjm5A7MX52S7cDqfkQDkgnVHpVxRwDC9n9O4vnaFdCZ4nC+d18z8dikbiwgdeWQ+Wi6RhZENye1Lu5sBaAJ09wYgx9lNdEVpRaTUvUw6grSlESJZSXoxfxWWpmTyx+yPH4sxuWjZ7gCspDX9s9k4fjpY4LkhQQwLlk8wPc2hfDg48e+K1OR6sYB8uRS33Xc4fQtzElzazmaZ0fn77h5ysDgC1g/ko+E2j8HHMbZvFpzYpm1bCpIv1G/0A2ItH7gT3HsuwkDvfH/it56JTCbBWJJ+hTDeswCQNu0h797QM6jv0o5wgKpHR1t+AeM9vDe4Ds0pAXouJz0LJewNOdNvi5O1BZA9OooKc34hwTJs/zj5NwiZuOyPSMhDBGa++Vhsr9K3rPD9+97M2hac6NO6TBVWZjvqJilmkjJs+bKrl//ClBvdhDGkJNDbB+2emdD1/wzpPVJPp3IRhzeEF89IVE58qE+OQnIwtbEZ2W1ct6Ep7ZJdrXWc/VBdJB1ELfUtNmkvWFZD5IJfnb/Z5MS6iespXlV5alPQ7eZ2jNl3tn7uDaCStuQN1tO2wthNnsSU/OkfFRch/Ks3gYC5+v7n8aJMkTYFmHr4Y/xlXBsrA="
|
||||
before_script:
|
||||
- travis_retry make mock-assets
|
||||
script:
|
||||
- ./scripts/have-backend-changes.sh || ./scripts/ci-diff-benchmark-go.sh
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Test Go code
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_GO
|
||||
before_script:
|
||||
- travis_retry make mock-assets
|
||||
script: make test-go
|
||||
after_success:
|
||||
- travis_retry curl -s --connect-timeout 30 --fail https://codecov.io/bash | bash -s -- -F backend
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Test JavaScript code
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_JS
|
||||
script: make -C ui test-js
|
||||
after_success:
|
||||
- travis_retry curl -s --connect-timeout 30 --fail https://codecov.io/bash | bash -s -- -F ui
|
||||
|
||||
# duplicate js test but with a different time zone, to ensure that tests/code work with non-UTC time zone
|
||||
- stage: Test and Lint
|
||||
name: Test JavaScript code with Pacific/Easter time zone
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_JS
|
||||
script: env TZ=Pacific/Easter make -C ui test-js
|
||||
after_success:
|
||||
- travis_retry curl -s --connect-timeout 30 --fail https://codecov.io/bash | bash -s -- -F ui
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Check for non-typescript UI components
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
script: make -C ui lint-typescript
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Lint git commit
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_JS
|
||||
script: make -C ui lint-git-ci
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Lint Go code
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_GO
|
||||
before_script:
|
||||
- travis_retry make mock-assets
|
||||
script: travis_retry make lint-go
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Check Go code formatting
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_GO
|
||||
before_script:
|
||||
- travis_retry make mock-assets
|
||||
script:
|
||||
- make format-go
|
||||
- git diff --exit-code
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Verify go.sum
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_GO
|
||||
script:
|
||||
- travis_retry make mock-assets
|
||||
- travis_retry go get -d -v ./cmd/karma
|
||||
- travis_retry go mod tidy
|
||||
- make tools-go-mod-tidy
|
||||
- git diff --exit-code
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Lint JavaScript code
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_JS
|
||||
script: make -C ui lint-js
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Check JavaScript code formatting
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_JS
|
||||
script:
|
||||
- make -C ui format
|
||||
- git diff --exit-code
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Check JavaScript dependencies
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_JS
|
||||
script:
|
||||
- make -C ui lint-deps
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Lint documentation
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_JS
|
||||
script: make -C ui lint-docs
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Verify OpenAPI client code
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
language: shell
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- docker-ce
|
||||
script:
|
||||
- travis_retry make openapi-client
|
||||
- git diff --exit-code
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Lint Golang Version
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
language: shell
|
||||
script: make lint-golang-version
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Lint Node Version
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
language: shell
|
||||
script: make lint-nodejs-version
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Lint Bootstrap Version
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
language: shell
|
||||
script: make lint-bootstrap-version
|
||||
|
||||
- stage: Test and Lint
|
||||
name: Generate Changelog
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_GO
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
# GITHUB_TOKEN
|
||||
- secure: "QsPAMhX52+jx8OZXmeZ0eDekHGdRmDbrWp48L4CbaTjgyZX+TSYIqsg6gTVDaHXW6b/AOFFdr8xvInelO2I0M1LV6mmbnzLslxfOxGo87qf9gVZk3VJry+qp2yJAd6s8CiO2GOUYzjOxk8Vd5R76ZpL1or10++tFojvCgYBzmIBFWpeVLyz6iJEgcqPowI/7cicITkEh67vx2DrVjiYptq42+f4fI2oeOf1U7nxd3YQFDtl00VyzacQJ7rVqONPWlagZPdn0w/qWTRkw4ynglVF4FufzCE5L6Bbe7xqbp9wxWhssmNCgC2xwIOu23ODLxSpYFqrYkdu6nLzBsPMxEBcc4O4oqx6IzUc1NMDhXwRmoFY4PQjmC8Rf0Q7oK0HIq+ZsYL0GxztOy0dWSXwoGwQvDLJyuoBtaN2lOKSGhAEeJqqpQaVIPbn3/cORAWXVJjuaFrIsU1Z2lSb60ENIcEHxTpBkbjAfPkk5u5jN4fck8tJMga4argi00fV14gHp4VGpq6o5UvoB+YdEJnPlypUW/8VY+EQhSoW98+b9QXBksL8g8/iezHAjIpwDfMTimSzTy7wd8wV/HR7pqpd9pNlKAhbCWNRa0YGrIoPff1YETRAZsI39lDMvrWjoMJWEDxoR/JAeYXX8V1JyCeX0uiLNisehfCfybc0kDM6Yv6Y="
|
||||
script:
|
||||
- travis_retry make changelog
|
||||
|
||||
- stage: Build and Deploy
|
||||
name: Cross compile binaries
|
||||
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
|
||||
<<: *DEFAULTS_GO
|
||||
env:
|
||||
# add an extra env so we don't push cross compilation cache into the main archive
|
||||
# as it slows down other jobs
|
||||
- JOB=cc
|
||||
- GO111MODULE=on
|
||||
- NODE_ENV=production
|
||||
before_script:
|
||||
# this stage needs to build everything including assets file and that
|
||||
# requires running webpack, so we need nodejs here
|
||||
- travis_retry nvm install $(< .nvmrc)
|
||||
script:
|
||||
# prune GOCACHE if it gets too big
|
||||
- ./scripts/prune-go-cache.sh
|
||||
- export SOURCE_DATE_EPOCH=$(git show -s --format=%ci ${TRAVIS_TAG:-${TRAVIS_COMMIT}}^{commit})
|
||||
- make crosscompile -j 2
|
||||
- for i in karma-*; do tar --mtime="${SOURCE_DATE_EPOCH}" --owner=0 --group=0 --numeric-owner -c $i | gzip -n - > $i.tar.gz; done
|
||||
- shasum -a 512 karma-*.tar.gz | tee sha512sum.txt
|
||||
# verify that there are no uncommited changes
|
||||
- git diff --exit-code
|
||||
# print GOCACHE size
|
||||
- ./scripts/prune-go-cache.sh --dry-run
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: "J0TR1UEjE/6dK/qRGhti/IYqrAI9cMYDt+UKhU7zcZgmurIRzOL1KXzMMQ30ZZJe++zY9m2zwyX/1hanHKXI97QNR94QaPmvVRHnBp8fZMKooKMh2vPSbU5LrkTxa4XDETsj+iH9o7UrVY2paaQFjNdJXfYoMSAP1TNpWNvZvS2Mq4jEopnr/5hZicXfkxkZq6K5/MoqkfjPj5bt8ULj2okk+9H+x0a3AMGsyp9YQ/QLL3v9wNSTOU33cQPmDGS84E5R+NX6/5ty4HJoFDwYudYYIyx9wun7rulxjxD6OB1htplqvpvP0SgCd1ah6ikTHI05Mil3QbkVjTnaQ48F2Y4R0H1qQ9jhIGRciqTuebS1WWm6t6XKAthwXm5/MO6YMNAWeLQ/eK6wIdPYfamWkkxOKsHJ8nI8YszMruW6b53DmNc7yh25fjJR7BL4p1zOXLUWJTOZVRoMjf4v9rW2A5hhPPPcDmVK59BQTPlqgP5Kh8lCLA5Hgm577oMfVt4gKPAlyni3iCkxW+pSn3bOVDafFk+3sTMmqGgcwcVBSWG5hMjGx0y2lTO5ElSwmloGoWUmJgco5+eoVp6yFYBdoY4ogrT8mhadovGBORavUQDxAhN9QJT6NqAJUzBOGf3iVyyCsKvERavOn2zo8yC1pTEwzjSekDB1NLRJ+pHF50k="
|
||||
skip_cleanup: true
|
||||
file_glob: true
|
||||
file:
|
||||
- karma-*.tar.gz
|
||||
- sha512sum.txt
|
||||
on:
|
||||
repo: prymitive/karma
|
||||
tags: true
|
||||
|
||||
- stage: Build and Deploy
|
||||
name: Build docker image
|
||||
# we build and push docker image on merge and tag, so this should only
|
||||
# run for new branches, to test that they don't break docker builds
|
||||
if: (repo = prymitive/karma AND type != pull_request AND branch != master AND tag IS NOT present) OR (fork = true AND type = pull_request)
|
||||
language: shell
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- docker-ce
|
||||
script: travis_retry make docker-image
|
||||
|
||||
- stage: Build and Deploy
|
||||
name: Build and push docker image
|
||||
if: repo = prymitive/karma AND ((type = push AND branch = master) OR tag IS present)
|
||||
language: shell
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- docker-ce
|
||||
env:
|
||||
# DOCKER_PASSWORD
|
||||
- secure: "iCMjE3Andg+pDnEUXqrlN+6pQ6RNxXARnovrwYb26Fz57tz/sJQGGmcRv4Ac3As/by+f7HEFsMb81CzGq2SCcDJ99jqROo4WzCCcjiI7q5E/0ltsBT1ElL4z3GLG5iaofPnJK7tW8Cq7HO30ZoSB57hS1BwaXfbIicw4XyZSG5TYHZgH6iO+LM2HAuxqthyZlK5O+CmTslamSDw/wiuBzilKNaX+mzdPuVfNd8m91MX/Fq+L3Oj9e7yH42In/PYUdN6S9bFgJQewG/CRRP+MBDK45ET63aQxqvgJchs45rTIdvcXjPMzb5xF8oHdjB3z7GdALbKDxa05sBu+SD8ElyerVFF3G+uFicDsdXoIR+NeTVzwwqrk2YmqOVz6jHaTw5WApttPayMbq3zzyH5zezbMROF0/rogaAHsW38xHktwMmEJ+eR1kdWSEYVDrRrTYPNPZJAcBsF4di+PIfjZ/6Ih5k4n4bFEQsvdXp0hRbx3DLHHusKihKvONW6ckp8tvyT+72aWvCehB5XuasgOzMXxHtBG4XPcPt8EoHOs/0bszTWpP5Nt98OvOSZaX7oZuvhVS0s9JfgVUFhqj1I/uO8KQxOpKsQBTCV0pBW8T6CGeJFXQHgMfFe8auIzzmFQzgHpIrcr6tjrgsadAl0wG4EmheNI2PJMs09+rZxDgX4="
|
||||
# GITHUB_PACKAGES_TOKEN / personal token for uploading to github docker repo
|
||||
- secure: "khmlnFdDKac2rAqnRgvTvxQh7KTcneB547AU3SmPmdSe4SdA9fqfi9Gd+gqe3jC+gqnuPC3Gmkr16B6m3/+aC0Hw4yPnKfQ+jePTNvcxkqDzjTAVg4+qa6k5qGnMMDRyY/1UKvTOA040BVfjtXbq7qCQAaFrgbZ5qmAOBML/CS11UBpZ2UblXREp73owidLD9A7x5FVqJ/l1x3CLV0ymoeatcZ3c3S34gzQ2BmdG5wAR2TpzR4rPGjDNEt94VQ1ZAxWOP0CDra83ymytFZvDxpRrfmbZGea0RkiJjyjC9boWxUiRB3CoXHku9eyOU5PJas0MOMZXEnhxVF9Zlxtj9rfYX+TEdhtXkRgtLiiGy5+QitbxLOia0G4AetvlulGTQV33Mn9FND9FTXb/AnRxX0R4lZ2pdejPnzQIH7XQBdJvliL1ywuletsuraFWFz0p1VQIkkEaiwpaWYMYORnYOq+eQ/Yd43hPQwDRLCHMYAjDOtAbDT9p1XC7yIDdtyE2FOeE6pnEQQbYgFL2GPSXXIhYrjMVfirKjiQ5NjEPiGHuuydzBpZ89VoFAQcwO4zw0pNvAseZjgNr0Iq7MqSBQbto1beglZptfsyLNJ5w1/es8wy3hirNLYP8PosaWccoWNQdzdbvkWrS9ipgJ/h6OskS3ehR7RXZvyD8yhTw3wM="
|
||||
script:
|
||||
- export VERSION=$(make show-version)
|
||||
- export LOCAL_IMAGE="karma:${VERSION}"
|
||||
- export DOCKER_USERNAME=lmierzwa
|
||||
- export DOCKER_IMAGE=karma
|
||||
- export IMAGE_NAME="${DOCKER_USERNAME}/${DOCKER_IMAGE}"
|
||||
- travis_retry make docker-image
|
||||
### Docker Hub
|
||||
- travis_retry docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
|
||||
- docker tag "${LOCAL_IMAGE}" "${IMAGE_NAME}:latest"
|
||||
# tag with the version only if we have a git tag (new release was pushed)
|
||||
- if [ -n "$TRAVIS_TAG" ]; then docker tag "${LOCAL_IMAGE}" "${IMAGE_NAME}:${VERSION}" ; fi
|
||||
- travis_retry docker push "${IMAGE_NAME}"
|
||||
### GitHub
|
||||
- travis_retry docker login ghcr.io -u prymitive -p "${GITHUB_PACKAGES_TOKEN}"
|
||||
- docker tag "${LOCAL_IMAGE}" "ghcr.io/prymitive/karma:latest"
|
||||
# tag with the version only if we have a git tag (new release was pushed)
|
||||
- if [ -n "$TRAVIS_TAG" ]; then docker tag "${LOCAL_IMAGE}" "ghcr.io/prymitive/karma:${VERSION}" ; fi
|
||||
- travis_retry docker push "ghcr.io/prymitive/karma"
|
||||
|
||||
- stage: Build and Deploy
|
||||
name: Deploy demo app to Heroku
|
||||
# deploy on every job that isn't a PR, this way we:
|
||||
# * don't deploy on PRs send from forks, only internal
|
||||
# * deploy only once per PR - since we will deploy on branch job
|
||||
if: repo = prymitive/karma AND type != pull_request
|
||||
env:
|
||||
# HEROKU_TOKEN, valid forever, needed to push docker image and release
|
||||
# it on heroku app
|
||||
- secure: "EJnXjoZ0K9JxZWk16kpmxYk/fez7OP9VlUUZfXctSK5TIov9VE/tMLsM/azZETZXE+bANgwsFtBAm+Jd45XffSYNy5shli5G7r/BR0ZhTQAPKVwUMpkroFvN4NbGvw/XGE51CPaQjqTKxrsf8JCrXgqVg6bPRt/wt0K0yP16ffPidQnpyBsZJtRX7ccUS/bEs7PxpMo8zCzFuhvC4SqQud7TDPBC+3S09jt1M92AsDTV1hUnuVSgW9/BLBTXL1GlHuVWIrE6A6Wbw5k89KZXTt+GUNNomZ4IfB70wHuuWF67vMCuBM8kC2ZzAlyDmCLevSPzsk8KTOu1lZL7UOqf2W0Oqk/lSaehT2rVX7ffJFOKKb8t62+pAI9V8excLlfYCJElb+ADKfH3L4CSODohVEnQex6Sz6cFwsSGrvGTt0Hq+U2CX3Tu0u3SauWHqdu1zqysfJLHBGiDyrqQ39JoAJQQTJ2adUiFj54GA9Ob8MDJglv7qPJcaZpkikiNLb80Wm2nbN/TBe0x4tsV1ntSouHpuYA7KZeKat11ZslO7vu1Z5fPy3FpMwYFkAlN2PCnsynCdxiJQwVf/fKguu6MZ2FUEWpSOspLWwooBrIH1N43n6eKs/dyk4yNmpQlGXe/cOY0mVfXwzZNi40k7CDkEj5plxyft25lBaKzEwibC30="
|
||||
language: shell
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- docker-ce
|
||||
before_script:
|
||||
# a safe and boring version of cat > .netrc < EOF
|
||||
- echo "machine api.heroku.com" >> $HOME/.netrc
|
||||
- echo " login l.mierzwa@gmail.com" >> $HOME/.netrc
|
||||
- echo " password $HEROKU_TOKEN" >> $HOME/.netrc
|
||||
script:
|
||||
- travis_retry docker build --build-arg VERSION=$(make show-version) -t registry.heroku.com/karma-demo/web -f demo/Dockerfile .
|
||||
- travis_retry docker login -u _ -p "$HEROKU_TOKEN" registry.heroku.com
|
||||
- travis_retry docker push registry.heroku.com/karma-demo/web
|
||||
# bundled heroku cli doesn't know anything about containers, update it
|
||||
- travis_retry curl -s --connect-timeout 30 --fail https://cli-assets.heroku.com/install.sh | sh
|
||||
- travis_retry /usr/local/bin/heroku container:release web --app karma-demo
|
||||
|
||||
- stage: Build and Deploy
|
||||
name: Percy UI snapshots
|
||||
if: (repo = prymitive/karma AND type != pull_request AND type != cron AND fork = false)
|
||||
<<: *DEFAULTS_JS
|
||||
env:
|
||||
- NODE_ENV=test
|
||||
- secure: "Fx290FkiIG0iVV+gXG22g5kEQs+bM7RkPZvM7q3nUp+8CNW0H627YVX/9WmthFRMmR2gWOltjZLYBGFL1lUaF/Qbvs+xjWibyNGuBJN3ODDTs56ywYg5Ege4ewQFH1XToV1WEwJ6ET0mREo5LSW4o1TBmZtGNzNldeM+aRScOMW6T8sUh2cYY+nHF5sQXN2UM3BtXZVY2kRQbRy5CxLql7l4keGO6anmD+AI3jn8Wj9bbY/CJxSLnXvWbw66Uj37lv7wlEzO4GKqtBYMMbmGBwjgrwSfVH42tq6PxabzFzZLUmnIr62EyBwfTQG2JoPXLC6AIouH2erM2fd2Qg4WF8yIOqPAJki0vw6VQS0VRHGvwrq/OXmiTWgpqTCXrIvrs45b2FsXGec10G/rFrS3ayoutXMNOwjBGYIkyxPP8ngfa2jinOWG05OMuOHPRDqCsAYL5jTIqUwp0VkoDNvp8aibQeKTKl7y5xkJtOstWaa1uMirRVFpi4SUCWvylt1sTR2VF2bzmuRFkQQ1xX2LvMtPKk86CriLSch2jeke90f4Ygl4fJV5+H3CsMION5WiTWFvPf0ncxzZKPCQ/SFnNQUjoo87YHg0aI9UgvOfd3Ca1k9Fxw5qC919eHFPF4Qz8z85WN58VXJVCEb1w2opPWoeiqMtabq9fCusxR8Y43Q="
|
||||
script: ./scripts/percy-skip-deps.sh || make -C ui test-percy
|
||||
|
||||
- stage: E2E
|
||||
name: Test demo site
|
||||
if: (repo = prymitive/karma AND type != pull_request AND fork = false)
|
||||
<<: *DEFAULTS_JS
|
||||
script:
|
||||
- travis_retry make -C ui test-demo
|
||||
@@ -1,7 +1,5 @@
|
||||
package main
|
||||
|
||||
// stripped down version of https://github.com/chenjiandongx/ginprom
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ include make/vars.mk
|
||||
|
||||
.PHONY: docker-image
|
||||
docker-image:
|
||||
docker build --build-arg VERSION=$(VERSION) -t $(NAME):$(VERSION) .
|
||||
docker build --build-arg VERSION=$(VERSION) -t $(NAME):latest .
|
||||
|
||||
.PHONY: run-demo
|
||||
run-demo:
|
||||
|
||||
@@ -62,6 +62,7 @@ format-go:
|
||||
|
||||
.PHONY: download-deps-go
|
||||
download-deps-go:
|
||||
@for f in $(wildcard tools/*/go.mod) ; do echo ">>> $$f" && cd $(CURDIR)/`dirname "$$f"` && $(GO) mod download && cd $(CURDIR) ; done
|
||||
$(GO) mod download
|
||||
|
||||
.PHONY: install-deps-build-go
|
||||
|
||||
+16
-14
@@ -1,22 +1,24 @@
|
||||
.PHONY: find-golang-versions
|
||||
find-golang-versions:
|
||||
@find $(CURDIR) -name Dockerfile -exec grep 'FROM golang' {} \; | cut -d: -f2 | cut -d'-' -f1
|
||||
@grep go-version $(CURDIR)/.github/workflows/* | awk '{print $$3}'
|
||||
|
||||
.PHONY: lint-golang-version
|
||||
lint-golang-version:
|
||||
$(eval CI_VERSION := $(shell grep -E '^(\ +)go:' .travis.yml | awk '{print $$2}' | tr -d "'\"" | sed -E s_'^([0-9]+\.[0-9]+)$$'_'\1.0'_g))
|
||||
$(eval BUILD_VERSION := $(shell grep -E '^FROM golang:' Dockerfile | cut -d : -f 2 | awk '{print $1}' | cut -d '-' -f 1))
|
||||
$(eval DEMO_VERSION := $(shell grep -E '^FROM golang:' demo/Dockerfile | cut -d : -f 2 | awk '{print $1}' | cut -d '-' -f 1))
|
||||
@if [ "$(CI_VERSION)" != "$(BUILD_VERSION)" ] || [ "$(CI_VERSION)" != "$(DEMO_VERSION)" ] || [ "$(BUILD_VERSION)" != "$(DEMO_VERSION)" ]; then \
|
||||
echo "Golang version mismatch: CI_VERSION=$(CI_VERSION) BUILD_VERSION=$(BUILD_VERSION) DEMO_VERSION=$(DEMO_VERSION)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(eval VERSIONS := $(shell make find-golang-versions | sort | uniq))
|
||||
$(eval COUNT := $(shell echo "$(VERSIONS)" | wc -w))
|
||||
@if [ $(COUNT) -gt 1 ]; then echo "Multiple Go versions: $(VERSIONS)" ; exit 1 ; fi
|
||||
|
||||
.PHONY: find-nodejs-versions
|
||||
find-nodejs-versions:
|
||||
@find $(CURDIR) -name Dockerfile -exec grep 'FROM node' {} \; | cut -d: -f2 | cut -d'-' -f1
|
||||
@grep node-version $(CURDIR)/.github/workflows/* | awk '{print $$3}'
|
||||
|
||||
.PHONY: lint-nodejs-version
|
||||
lint-nodejs-version:
|
||||
$(eval CI_VERSION := $(shell cat .nvmrc))
|
||||
$(eval BUILD_VERSION := $(shell grep -E '^FROM node:' Dockerfile | cut -d : -f 2 | awk '{print $1}' | cut -d '-' -f 1))
|
||||
$(eval DEMO_VERSION := $(shell grep -E '^FROM node:' demo/Dockerfile | cut -d : -f 2 | awk '{print $1}' | cut -d '-' -f 1))
|
||||
@if [ "$(CI_VERSION)" != "$(BUILD_VERSION)" ] || [ "$(CI_VERSION)" != "$(DEMO_VERSION)" ] || [ "$(BUILD_VERSION)" != "$(DEMO_VERSION)" ]; then \
|
||||
echo "Node version mismatch: CI_VERSION=$(CI_VERSION) BUILD_VERSION=$(BUILD_VERSION) DEMO_VERSION=$(DEMO_VERSION)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(eval VERSIONS := $(shell make find-nodejs-versions | sort | uniq))
|
||||
$(eval COUNT := $(shell echo "$(VERSIONS)" | wc -w))
|
||||
@if [ $(COUNT) -gt 1 ]; then echo "Multiple NodeJS versions: $(VERSIONS)" ; exit 1 ; fi
|
||||
|
||||
.PHONY: lint-bootstrap-version
|
||||
lint-bootstrap-version:
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"extends": ["config:base"],
|
||||
"prHourlyLimit": 1,
|
||||
"rebaseStalePrs": false,
|
||||
"travis": { "enabled": true },
|
||||
"masterIssue": true,
|
||||
"postUpdateOptions": ["gomodTidy"],
|
||||
"packageRules": [
|
||||
|
||||
@@ -8,7 +8,7 @@ git reset --hard FETCH_HEAD
|
||||
|
||||
make benchmark-go | tee master.txt
|
||||
|
||||
git reset --hard ${TRAVIS_PULL_REQUEST_SHA}
|
||||
git reset --hard ${GITHUB_SHA}
|
||||
make benchmark-go | tee new.txt
|
||||
|
||||
make benchmark-compare-go | tee benchstat.txt
|
||||
|
||||
@@ -10,7 +10,7 @@ make -C ui build/stats.json
|
||||
mv ui/build/stats.json master.json
|
||||
|
||||
make clean
|
||||
git reset --hard ${TRAVIS_PULL_REQUEST_SHA}
|
||||
git reset --hard ${GITHUB_SHA}
|
||||
make -C ui build/stats.json
|
||||
|
||||
./scripts/cra-bundle-stats-diff.py master.json ui/build/stats.json | tee diff.html
|
||||
|
||||
@@ -4,11 +4,11 @@ set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
|
||||
if [ "${TRAVIS_BRANCH}" == "master" ] && [ -n ${TRAVIS_COMMIT_RANGE} ]; then
|
||||
RANGE="${TRAVIS_COMMIT_RANGE}"
|
||||
if [ "${GITHUB_HEAD_REF_SLUG}" == "master" ]; then
|
||||
RANGE="HEAD~.."
|
||||
else
|
||||
git fetch origin master
|
||||
RANGE="FETCH_HEAD...${TRAVIS_COMMIT}"
|
||||
RANGE="FETCH_HEAD...${GITHUB_SHA}"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
|
||||
if [ "${TRAVIS_BRANCH}" == "master" ] && [ -n ${TRAVIS_COMMIT_RANGE} ]; then
|
||||
RANGE="${TRAVIS_COMMIT_RANGE}"
|
||||
if [ "${GITHUB_HEAD_REF_SLUG}" == "master" ]; then
|
||||
RANGE="HEAD~.."
|
||||
else
|
||||
git fetch origin master
|
||||
RANGE="FETCH_HEAD...${TRAVIS_COMMIT}"
|
||||
RANGE="FETCH_HEAD...${GITHUB_SHA}"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
|
||||
if [ "${TRAVIS_BRANCH}" == "master" ] && [ -n ${TRAVIS_COMMIT_RANGE} ]; then
|
||||
RANGE="${TRAVIS_COMMIT_RANGE}"
|
||||
if [ "${GITHUB_HEAD_REF_SLUG}" == "master" ]; then
|
||||
RANGE="HEAD~.."
|
||||
else
|
||||
git fetch origin master
|
||||
RANGE="FETCH_HEAD...${TRAVIS_COMMIT}"
|
||||
RANGE="FETCH_HEAD...${GITHUB_SHA}"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ if __name__ == '__main__':
|
||||
sys.exit(1)
|
||||
|
||||
token = os.getenv('GITHUB_TOKEN')
|
||||
pr = os.getenv('TRAVIS_PULL_REQUEST')
|
||||
pr = os.getenv('PULL_REQUEST_NUMBER')
|
||||
commentName = sys.argv[1]
|
||||
commentFile = sys.argv[2]
|
||||
format = sys.argv[3]
|
||||
@@ -87,7 +87,7 @@ if __name__ == '__main__':
|
||||
print('GITHUB_TOKEN env variable is missing')
|
||||
sys.exit(1)
|
||||
if not pr:
|
||||
print('TRAVIS_PULL_REQUEST env variable is missing')
|
||||
print('PULL_REQUEST_NUMBER env variable is missing')
|
||||
sys.exit(1)
|
||||
if not commentName or not commentFile or not format:
|
||||
print('Usage: NAME PATH FORMAT')
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
|
||||
DRY_RUN="$1"
|
||||
|
||||
GOCACHE=$(go env GOCACHE)
|
||||
SIZE=`du -sxm ${GOCACHE} | awk '{print $1}'`
|
||||
echo "GOCACHE size: ${SIZE}MB"
|
||||
|
||||
if [ "${DRY_RUN}" == "" ] && [ "${TRAVIS_BRANCH}" == "master" ] && [ $SIZE -gt 4200 ]; then
|
||||
echo "Pruning GOCACHE at ${GOCACHE}"
|
||||
find "${GOCACHE}" -type f -delete
|
||||
fi
|
||||
@@ -8,7 +8,5 @@ ignores:
|
||||
# devDeps
|
||||
- "@types/jest"
|
||||
- "@types/node"
|
||||
- "@commitlint/travis-cli"
|
||||
- "@storybook/preset-create-react-app"
|
||||
- depcheck
|
||||
- markdownlint-cli
|
||||
|
||||
+3
-8
@@ -16,6 +16,9 @@ $(NODE_INSTALL): package.json package-lock.json
|
||||
@if [ -e $(NODE_INSTALL) ]; then npm install ; else npm ci; fi
|
||||
touch $@
|
||||
|
||||
.PHONY: npm-fetch
|
||||
npm-fetch: $(NODE_INSTALL)
|
||||
|
||||
$(NODE_PATH)/%: $(NODE_INSTALL)
|
||||
@if [ ! -x $@ ]; then echo "missing script: $@" ; exit 1; fi
|
||||
|
||||
@@ -43,14 +46,6 @@ lint-js: $(NODE_PATH)/eslint
|
||||
@rm -fr node_modules/.cache/eslint-loader
|
||||
eslint --ext .js,.jsx,.ts,.tsx src
|
||||
|
||||
.PHONY: lint-git-ci
|
||||
lint-git-ci: $(NODE_PATH)/commitlint-travis
|
||||
commitlint-travis
|
||||
|
||||
.PHONY: lint-docs
|
||||
lint-docs: $(NODE_PATH)/markdownlint
|
||||
markdownlint ../*.md ../docs
|
||||
|
||||
.PHONY: lint-deps
|
||||
lint-deps: $(NODE_PATH)/depcheck
|
||||
depcheck $(CURDIR)
|
||||
|
||||
Generated
-1187
File diff suppressed because it is too large
Load Diff
@@ -79,7 +79,6 @@
|
||||
"typescript": "4.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/travis-cli": "11.0.0",
|
||||
"@percy-io/percy-storybook": "2.1.0",
|
||||
"@storybook/preset-create-react-app": "3.1.5",
|
||||
"@testing-library/react-hooks": "3.4.2",
|
||||
@@ -89,7 +88,6 @@
|
||||
"enzyme": "3.11.0",
|
||||
"jest-canvas-mock": "2.3.0",
|
||||
"jest-date-mock": "1.0.8",
|
||||
"markdownlint-cli": "0.25.0",
|
||||
"puppeteer": "5.5.0",
|
||||
"react-test-renderer": "17.0.1",
|
||||
"source-map-explorer": "2.5.0"
|
||||
|
||||
Reference in New Issue
Block a user