feat: add project id #15
This file contains hidden or 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: | ||
push: | ||
branches: [main, develop] | ||
pull_request: | ||
branches: [main, develop] | ||
# Cancel previous runs for the same workflow on the same branch/PR | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
GO_VERSION: "1.24" | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
cache: true | ||
- name: Install dependencies | ||
run: make ci-deps | ||
- name: Run linter | ||
run: make lint | ||
# test: | ||
# name: Test | ||
# runs-on: ubuntu-latest | ||
# services: | ||
# neo4j: | ||
# image: neo4j:5-community | ||
# env: | ||
# NEO4J_AUTH: neo4j/password | ||
# NEO4J_PLUGINS: '["apoc","graph-data-science"]' | ||
# ports: | ||
# - 7474:7474 | ||
# - 7687:7687 | ||
# options: >- | ||
# --health-cmd "cypher-shell -u neo4j -p password 'RETURN 1'" | ||
# --health-interval 10s | ||
# --health-timeout 5s | ||
# --health-retries 10 | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - name: Set up Go | ||
# uses: actions/setup-go@v5 | ||
# with: | ||
# go-version: ${{ env.GO_VERSION }} | ||
# cache: true | ||
# - name: Install dependencies | ||
# run: make ci-deps | ||
# - name: Run tests | ||
# run: make ci-test | ||
# env: | ||
# CI: true | ||
# NEO4J_TEST_URI: bolt://localhost:7687 | ||
# NEO4J_TEST_USERNAME: neo4j | ||
# NEO4J_TEST_PASSWORD: password | ||
# test-coverage: | ||
# name: Test Coverage | ||
# runs-on: ubuntu-latest | ||
# services: | ||
# neo4j: | ||
# image: neo4j:5-community | ||
# env: | ||
# NEO4J_AUTH: neo4j/password | ||
# NEO4J_PLUGINS: '["apoc","graph-data-science"]' | ||
# ports: | ||
# - 7474:7474 | ||
# - 7687:7687 | ||
# options: >- | ||
# --health-cmd "cypher-shell -u neo4j -p password 'RETURN 1'" | ||
# --health-interval 10s | ||
# --health-timeout 5s | ||
# --health-retries 10 | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - name: Set up Go | ||
# uses: actions/setup-go@v5 | ||
# with: | ||
# go-version: ${{ env.GO_VERSION }} | ||
# cache: true | ||
# - name: Install dependencies | ||
# run: make ci-deps | ||
# - name: Run tests with coverage | ||
# run: make test-coverage | ||
# env: | ||
# CI: true | ||
# NEO4J_TEST_URI: bolt://localhost:7687 | ||
# NEO4J_TEST_USERNAME: neo4j | ||
# NEO4J_TEST_PASSWORD: password | ||
# - name: Upload coverage to Codecov | ||
# uses: codecov/codecov-action@v4 | ||
# with: | ||
# file: ./coverage.out | ||
# flags: unittests | ||
# name: codecov-umbrella | ||
# token: ${{ secrets.CODECOV_TOKEN }} | ||
security: | ||
name: Security Scan | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
cache: true | ||
- name: Install dependencies | ||
run: make ci-deps | ||
- name: Run security scan | ||
run: make security-scan | ||
- name: Run vulnerability check | ||
run: make vulnerability-check | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: [lint, test] | ||
Check failure on line 144 in .github/workflows/ci.yml
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
cache: true | ||
- name: Build binary | ||
run: make build | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: gograph-${{ github.sha }} | ||
path: bin/gograph | ||
retention-days: 30 | ||
docker: | ||
name: Docker Build | ||
runs-on: ubuntu-latest | ||
needs: [lint, test] | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch | ||
type=sha,prefix={{branch}}- | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |