GitHub Actions
GitHub Actions
Section titled “GitHub Actions”Basic setup
Section titled “Basic setup”Create .github/workflows/architecture.yml:
name: Architecture Analysis
on: pull_request: branches: [main] push: branches: [main]
jobs: analyze: runs-on: ubuntu-latest
steps: - uses: actions/checkout@v4
- name: Install Arxo run: | curl -sL "https://github.com/arxohq/arxo/releases/latest/download/arxo-linux-x86_64.tar.gz" | tar xz chmod +x arxo && sudo mv arxo /usr/local/bin/
- name: Run Architecture Analysis run: arxo analyze --fail-fastWith caching
Section titled “With caching”- name: Cache Arxo Analysis uses: actions/cache@v3 with: path: ~/.cache/arxo key: arxo-${{ hashFiles('**/*.ts', '**/*.tsx', '**/*.py') }} restore-keys: arxo-
- name: Run Analysis run: arxo analyzeGenerate reports
Section titled “Generate reports”Upload JSON and HTML reports as artifacts:
- name: Generate Report run: | arxo analyze --format json --output architecture-report.json arxo analyze --format html --output architecture-report.html
- name: Upload Report uses: actions/upload-artifact@v3 if: always() with: name: architecture-reports path: | architecture-report.json architecture-report.htmlPR comments
Section titled “PR comments”Post results as PR comments:
- name: Analyze Architecture id: analyze run: | arxo analyze --format json --output report.json echo "status=$?" >> $GITHUB_OUTPUT
- name: Comment PR uses: actions/github-script@v7 if: github.event_name == 'pull_request' with: script: | const fs = require('fs'); const report = JSON.parse(fs.readFileSync('report.json', 'utf8')); const violations = report.violations || []; const body = violations.length > 0 ? `## ⚠️ Architecture Violations\n\n${violations.map(v => `- ${v.message}`).join('\n')}` : '## ✅ No Architecture Violations'; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: body });Next steps
Section titled “Next steps”- CI/CD Integration — Overview and exit codes
- Configuration — Config and performance tips