Skip to content

feat: add spacetastic endpoints DOC-1138 #58

feat: add spacetastic endpoints DOC-1138

feat: add spacetastic endpoints DOC-1138 #58

Workflow file for this run

name: Pull Request
on:
pull_request:
types: ["synchronize", "opened", "reopened", "ready_for_review"]
branches:
- main
env:
DB_VERSION: 1.1.0
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
run-ci:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
if: ${{ !github.event.pull_request.draft }}
steps:
# If the condition above is not met, aka, the PR is not in draft status, then this step is skipped.
# Because this step is part of the critical path, omission of this step will result in remaining CI steps not gettinge executed.
# As of 8/8/2022 there is now way to enforce this beahvior in GitHub Actions CI.
- run: exit 0
Docker:
needs: [run-ci]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
check-latest: true
- name: Build
run: |
docker system prune -a -f
docker build --no-cache -t api-server:test .
Linting:
needs: [run-ci]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
check-latest: true
- name: Lint Internal Package
uses: golangci/[email protected]
with:
args: --verbose --timeout 5m
Tests:
runs-on: ubuntu-latest
needs: [run-ci]
permissions:
contents: write
pull-requests: write
steps:
- name: Retrieve Credentials
id: import-secrets
uses: hashicorp/vault-action@v2
with:
url: https://vault.prism.spectrocloud.com
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
secrets: /providers/github/organizations/spectrocloud/token?org_name=spectrocloud token | VAULT_GITHUB_TOKEN
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ steps.import-secrets.outputs.VAULT_GITHUB_TOKEN }}
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Dependencies
run: make tests
- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v2
with:
filename: coverage.out
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v18
id: verify-changed-files
with:
files: README.md
- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: Updated coverage badge."
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ steps.import-secrets.outputs.VAULT_GITHUB_TOKEN }}
branch: ${{ github.GITHUB_REF }} # This also worked with GITHUB_BASE_REF
repository: ${{ github.repository }}
force_with_lease: true
API-Test:
runs-on: ubuntu-latest
needs: [run-ci]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
check-latest: true
- name: API Test
run: |
make ci-tests