1- name : CI/CD Pipeline
1+ name : CI
22
33on :
44 push :
5- branches : [ master, main, develop ]
5+ branches : [ master, main ]
66 pull_request :
7- branches : [ master, main, develop ]
8- release :
9- types : [ published ]
7+ branches : [ master, main ]
108
119env :
12- RUBY_VERSION : ' 2.6.0'
10+ STREAM_API_KEY : ${{ vars.STREAM_API_KEY }}
11+ STREAM_API_SECRET : ${{ secrets.STREAM_API_SECRET }}
1312
1413jobs :
1514 test :
1615 name : Test Suite
1716 runs-on : ubuntu-latest
18-
19- strategy :
20- matrix :
21- ruby-version : ['2.6.0', '2.7.0', '3.0.0', '3.1.0', '3.2.0']
17+ environment : ci
2218
2319 steps :
2420 - name : Checkout code
@@ -27,179 +23,21 @@ jobs:
2723 - name : Set up Ruby
2824 uses : ruby/setup-ruby@v1
2925 with :
30- ruby-version : ${{ matrix.ruby-version }}
26+ ruby-version : ' 3.1.0 '
3127 bundler-cache : true
3228
3329 - name : Install dependencies
34- run : |
35- gem install bundler
36- bundle install --jobs 4 --retry 3
30+ run : bundle install --jobs 4 --retry 3
3731
38- - name : Run unit tests
39- run : make test-unit
32+ - name : Run tests
33+ run : make test
4034
4135 - name : Run integration tests
4236 if : github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
43- env :
44- STREAM_API_KEY : ${{ secrets.STREAM_API_KEY }}
45- STREAM_API_SECRET : ${{ secrets.STREAM_API_SECRET }}
46- STREAM_APP_ID : ${{ secrets.STREAM_APP_ID }}
47- run : make test-integration
48-
49- - name : Run code formatting check
50- run : make format-check
51-
52- - name : Run linting
53- run : make lint
54-
55- - name : Run security audit
56- run : make security
57- continue-on-error : true
58-
59- integration-tests :
60- name : Integration Tests
61- runs-on : ubuntu-latest
62- if : github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'))
63-
64- steps :
65- - name : Checkout code
66- uses : actions/checkout@v4
67-
68- - name : Set up Ruby
69- uses : ruby/setup-ruby@v1
70- with :
71- ruby-version : ${{ env.RUBY_VERSION }}
72- bundler-cache : true
73-
74- - name : Install dependencies
75- run : |
76- gem install bundler
77- bundle install --jobs 4 --retry 3
78-
79- - name : Run integration tests
80- env :
81- STREAM_API_KEY : ${{ secrets.STREAM_API_KEY }}
82- STREAM_API_SECRET : ${{ secrets.STREAM_API_SECRET }}
83- STREAM_APP_ID : ${{ secrets.STREAM_APP_ID }}
8437 run : make test-integration
85-
86- release :
87- name : Release
88- runs-on : ubuntu-latest
89- needs : [test, integration-tests]
90- if : github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
91-
92- steps :
93- - name : Checkout code
94- uses : actions/checkout@v4
95- with :
96- fetch-depth : 0
97-
98- - name : Set up Ruby
99- uses : ruby/setup-ruby@v1
100- with :
101- ruby-version : ${{ env.RUBY_VERSION }}
102- bundler-cache : true
103-
104- - name : Install dependencies
105- run : |
106- gem install bundler
107- bundle install --jobs 4 --retry 3
108-
109- - name : Check for major release
110- id : check-major
111- run : |
112- if git log --oneline -1 | grep -q "major"; then
113- echo "release_type=major" >> $GITHUB_OUTPUT
114- echo "should_release=true" >> $GITHUB_OUTPUT
115- else
116- echo "should_release=false" >> $GITHUB_OUTPUT
117- fi
118-
119- - name : Check for minor release
120- id : check-minor
121- run : |
122- if git log --oneline -1 | grep -q "minor"; then
123- echo "release_type=minor" >> $GITHUB_OUTPUT
124- echo "should_release=true" >> $GITHUB_OUTPUT
125- else
126- echo "should_release=false" >> $GITHUB_OUTPUT
127- fi
128-
129- - name : Check for patch release
130- id : check-patch
131- run : |
132- if git log --oneline -1 | grep -q "patch"; then
133- echo "release_type=patch" >> $GITHUB_OUTPUT
134- echo "should_release=true" >> $GITHUB_OUTPUT
135- else
136- echo "should_release=false" >> $GITHUB_OUTPUT
137- fi
138-
139- - name : Determine release type
140- id : release-type
141- run : |
142- if [ "${{ steps.check-major.outputs.should_release }}" = "true" ]; then
143- echo "release_type=major" >> $GITHUB_OUTPUT
144- echo "should_release=true" >> $GITHUB_OUTPUT
145- elif [ "${{ steps.check-minor.outputs.should_release }}" = "true" ]; then
146- echo "release_type=minor" >> $GITHUB_OUTPUT
147- echo "should_release=true" >> $GITHUB_OUTPUT
148- elif [ "${{ steps.check-patch.outputs.should_release }}" = "true" ]; then
149- echo "release_type=patch" >> $GITHUB_OUTPUT
150- echo "should_release=true" >> $GITHUB_OUTPUT
151- else
152- echo "should_release=false" >> $GITHUB_OUTPUT
153- fi
154-
155- - name : Release gem
156- if : steps.release-type.outputs.should_release == 'true'
157- env :
158- RUBYGEMS_API_KEY : ${{ secrets.RUBYGEMS_API_KEY }}
159- run : |
160- echo "Releasing ${{ steps.release-type.outputs.release_type }} version..."
161- make release-${{ steps.release-type.outputs.release_type }}
162-
163- - name : Create GitHub Release
164- if : steps.release-type.outputs.should_release == 'true'
165- uses : actions/create-release@v1
166- env :
167- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
168- with :
169- tag_name : v${{ steps.release-type.outputs.release_type }}
170- release_name : Release ${{ steps.release-type.outputs.release_type }}
171- body : |
172- This is an automated ${{ steps.release-type.outputs.release_type }} release.
173-
174- Changes in this release:
175- - See commit history for details
176- draft : false
177- prerelease : false
178-
179- security-scan :
180- name : Security Scan
181- runs-on : ubuntu-latest
182- if : github.event_name == 'pull_request'
183-
184- steps :
185- - name : Checkout code
186- uses : actions/checkout@v4
18738
188- - name : Set up Ruby
189- uses : ruby/setup-ruby@v1
190- with :
191- ruby-version : ${{ env.RUBY_VERSION }}
192- bundler-cache : true
193-
194- - name : Install dependencies
39+ - name : Run code quality checks
19540 run : |
196- gem install bundler
197- bundle install --jobs 4 --retry 3
198-
199- - name : Run security audit
200- run : make security
201-
202- - name : Run CodeQL Analysis
203- uses : github/codeql-action/analyze@v2
204- with :
205- languages : ruby
41+ make format-check
42+ make lint
43+ make security
0 commit comments