Add readiness and liveness probes #4870
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: Code CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
lint: | |
# pull requests are a duplicate of a branch push if within the same repo. | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set node | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- name: Install yarn dependencies | |
uses: borales/[email protected] | |
with: | |
cmd: install --frozen-lockfile | |
dir: backstage | |
- name: Lint all | |
uses: borales/[email protected] | |
with: | |
cmd: lint:all | |
dir: backstage | |
- name: Check format | |
uses: borales/[email protected] | |
with: | |
cmd: prettier:check | |
dir: backstage | |
test: | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set node | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- name: Install yarn dependencies | |
uses: borales/[email protected] | |
with: | |
cmd: install --frozen-lockfile | |
dir: backstage | |
- name: Run all tests | |
uses: borales/[email protected] | |
with: | |
cmd: test:all | |
dir: backstage | |
containers: | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | |
needs: | |
- lint | |
- test | |
strategy: | |
fail-fast: true | |
matrix: | |
target: | |
- backend | |
- frontend | |
max-parallel: 1 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Generate Image Name | |
run: echo IMAGE_REPOSITORY=ghcr.io/$(tr '[:upper:]' '[:lower:]' <<< "${{ github.repository }}")-${{ matrix.target }} >> $GITHUB_ENV | |
- name: Log in to GitHub Docker Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.IMAGE_REPOSITORY }} | |
tags: | | |
type=ref,event=tag | |
type=raw,value=latest | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build Image | |
uses: docker/[email protected] | |
with: | |
context: "{{defaultContext}}:backstage" | |
target: ${{ matrix.target }} | |
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} | |
load: ${{ ! (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |