Merge pull request #1 from boogeroccam/feat/python-tests #15
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/CD Pipeline | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
types: [opened, synchronize] | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: "Branch to run tests on" | |
required: true | |
default: "main" | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set GO_VERSION | |
run: echo "GO_VERSION=$(cat go.mod | grep '^go ' | cut -f2 -d' ')" >> $GITHUB_ENV | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build binary | |
run: make build | |
- name: Upload binary artifact | |
# if: github.event_name == 'release' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: galacticad | |
path: build/galacticad | |
test: | |
runs-on: self-hosted | |
needs: | |
- build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download binary artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: galacticad | |
path: build | |
- uses: astral-sh/setup-uv@v3 | |
with: | |
version: "latest" | |
- name: Run tests | |
run: | | |
make test | |
if [ -f "tests/galacli/report.md" ]; then | |
echo "<details><summary>Test Report</summary>" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
cat tests/galacli/report.md >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "</details>" >> $GITHUB_STEP_SUMMARY | |
fi | |
- name: Render the report to the PR when tests fail | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: test-report | |
recreate: true | |
path: tests/galacli/report.md | |
permissions: | |
pull-requests: write |