-
Notifications
You must be signed in to change notification settings - Fork 14
148 lines (126 loc) · 4.22 KB
/
build-and-snapshot.yml
File metadata and controls
148 lines (126 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Build, Test and Snapshot Release
on:
push:
branches:
- main
- master
pull_request:
schedule:
- cron: "0 0 * * 0" # Weekly on Sunday at midnight
workflow_dispatch: # Allows manual triggering
jobs:
lint-and-test-python:
name: Python Test Suite
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Check if Python tests exist
id: check-tests
run: |
if [ -f "test/requirements.txt" ] && [ -f "test/test.sh" ]; then
echo "tests_exist=true" >> $GITHUB_OUTPUT
echo "✅ Python test suite found"
else
echo "tests_exist=false" >> $GITHUB_OUTPUT
echo "⚠️ Python test suite not found - skipping tests"
fi
- name: Setup Python test environment
if: steps.check-tests.outputs.tests_exist == 'true'
run: |
cd test
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Run Python linting
if: steps.check-tests.outputs.tests_exist == 'true'
run: |
cd test
source venv/bin/activate
./scripts/lint-python.sh ci
# - name: Run Python tests
# if: steps.check-tests.outputs.tests_exist == 'true'
# run: |
# cd testing
# source venv/bin/activate
# echo "🧪 Running Python tests..."
# pytest -v --tb=short
# echo "✅ Python tests completed!"
build:
name: Build and Test Go Plugin
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [">=1.23.5"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go mod tidy -e || true
- name: Lint Go files
run: |
echo "🔍 Running go fmt..."
go fmt .
echo "🔍 Running go vet..."
go vet .
- name: Build binary
run: |
echo "🔨 Building binary..."
python3 .github/workflows/build.py
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cf-cli-java-plugin-${{ matrix.os }}
path: dist/
release:
name: Create Snapshot Release
needs: [build, lint-and-test-python]
runs-on: ubuntu-latest
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (needs.lint-and-test-python.result == 'success' || needs.lint-and-test-python.result == 'skipped')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist/
- name: Combine all artifacts
run: |
mkdir -p dist
mv dist/*/* dist/ || true
- uses: thomashampson/delete-older-releases@main
with:
keep_latest: 0
delete_tag_regex: snapshot
prerelease_only: true
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
prerelease: false
release: false
tag_name: snapshot
body: |
This is a snapshot release of the cf-cli-java-plugin.
It includes the latest changes and is not intended for production use.
Please test it and provide feedback.
## Build Status
- ✅ Go Plugin: Built and tested on Linux, macOS, and Windows
- ✅ Python Tests: Linting and test suite validation completed
## Changes
This snapshot includes the latest commits from the repository.
name: Snapshot Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}