CI #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
schedule: | |
- cron: '0 12 * * 0' | |
push: | |
branches: | |
- main | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
pull_request: | |
permissions: | |
contents: write | |
packages: write | |
checks: write | |
pull-requests: write | |
repository-projects: read | |
jobs: | |
lint: | |
name: ESLint & format | |
runs-on: ubuntu-20.04 | |
env: | |
BIT_TOKEN: ${{ secrets.BIT_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Use Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install Bit | |
run: make install-bit | |
- name: add bvm bin folder to path | |
run: echo "$HOME/bin" >> $GITHUB_PATH | |
- name: Set up bit config | |
run: bit config set user.token $BIT_TOKEN | |
- name: Install dependencies | |
run: make init | |
- name: Run linter | |
run: make lint | |
- name: Run formatter | |
run: make format | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: 'chore: format files' | |
file_pattern: ':(exclude)pnpm-lock.yaml' | |
tests: | |
name: Tests | |
runs-on: ubuntu-20.04 | |
env: | |
GOPRIVATE: github.com/percona,github.com/percona/percona-everest-backend,github.com/percona/percona-everest-cli,github.com/percona/everest-operator | |
BIT_TOKEN: ${{ secrets.BIT_TOKEN }} | |
strategy: | |
matrix: | |
node-version: [16.x] | |
go-version: [1.20.x] | |
steps: | |
- name: Checkout FE code | |
uses: actions/checkout@v3 | |
with: | |
path: ./percona-everest-frontend | |
- name: Checkout CLI repo | |
uses: percona-platform/checkout@v3 | |
with: | |
repository: percona/percona-everest-cli | |
ref: 'main' | |
path: percona-everest-cli | |
token: ${{ secrets.ROBOT_TOKEN }} | |
- name: Checkout backend repo | |
uses: percona-platform/checkout@v3 | |
with: | |
repository: percona/percona-everest-backend | |
ref: 'main' | |
path: percona-everest-backend | |
token: ${{ secrets.ROBOT_TOKEN }} | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Use Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
cache-dependency-path: '**/pnpm-lock.yaml' | |
- name: Configure git for private modules | |
env: | |
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }} | |
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com" | |
- name: Install Bit | |
run: | | |
cd ${GITHUB_WORKSPACE}/percona-everest-frontend | |
make install-bit | |
- name: add bvm bin folder to path | |
run: echo "$HOME/bin" >> $GITHUB_PATH | |
- name: Set up bit config | |
run: bit config set user.token $BIT_TOKEN | |
- name: Build Everest | |
run: | | |
cd ${GITHUB_WORKSPACE}/percona-everest-frontend | |
make init | |
cd apps/everest | |
make build | |
- name: Run Everest | |
run: | | |
cd ${GITHUB_WORKSPACE}/percona-everest-frontend/apps/everest | |
make run & | |
sleep 30s | |
- name: Set up Go release | |
uses: percona-platform/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set GO_VERSION environment variable | |
run: | | |
go version | |
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV | |
- name: Enable Go modules cache | |
uses: percona-platform/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ matrix.os }}-go-${{ matrix.go-version }}-modules- | |
- name: Enable Go build cache | |
uses: percona-platform/cache@v3 | |
with: | |
path: ~/.cache/go-build | |
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }} | |
restore-keys: | | |
${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}- | |
${{ matrix.os }}-go-${{ matrix.go-version }}-build- | |
- name: Run Everest backend | |
run: | | |
cd ${GITHUB_WORKSPACE}/percona-everest-backend | |
make init | |
make local-env-up | |
make build-debug | |
make run-debug &> everest-backend.log & | |
- name: Run debug commands on failure | |
if: ${{ failure() }} | |
run: | | |
cat everest-backend.log | |
- name: Create KIND cluster | |
uses: helm/[email protected] | |
- name: Run Provisioning | |
run: | | |
cd ${GITHUB_WORKSPACE}/percona-everest-cli | |
go run cmd/everest/main.go install operators --backup.enable=false --everest.endpoint=http://127.0.0.1:8080 --monitoring.enable=false --name=minikube --operator.mongodb=true --operator.postgresql=true --operator.xtradb-cluster=true --skip-wizard --namespace test-everest | |
- name: Run integration tests | |
run: | | |
cd ${GITHUB_WORKSPACE}/percona-everest-frontend/apps/everest | |
make test-ui |