Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI scalability #157

Merged
merged 72 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
eec7b09
Test a new workflow
gchristov Oct 17, 2024
be96bcb
Start with only showing the changed directories
gchristov Oct 17, 2024
5d07800
Fix git origin
gchristov Oct 17, 2024
8044515
Try something that works locally
gchristov Oct 17, 2024
40a9cce
Try with master
gchristov Oct 17, 2024
12f56db
Again
gchristov Oct 17, 2024
27efab3
try plain diff
gchristov Oct 17, 2024
a909375
fetch depth 2
gchristov Oct 17, 2024
bd71f58
Fetch all history
gchristov Oct 17, 2024
2cecafe
Try a bespoke action for this
gchristov Oct 17, 2024
70f3b0f
Output only dir names
gchristov Oct 17, 2024
5300d2e
Show only directory roots
gchristov Oct 17, 2024
3147e0b
Try to detect a service
gchristov Oct 17, 2024
93d80bd
CHange two services
gchristov Oct 17, 2024
299d863
Allow all tests to run together and silence the current gh workflows …
gchristov Oct 17, 2024
67c8422
Try with an array output instead of printing
gchristov Oct 18, 2024
db1beeb
Another
gchristov Oct 18, 2024
fb91995
Try to pass the output to a different job
gchristov Oct 18, 2024
30854d1
Typo
gchristov Oct 18, 2024
a8cf8a7
test what is wrong
gchristov Oct 18, 2024
f29357c
Output an array instead
gchristov Oct 18, 2024
ed6b136
try normal array
gchristov Oct 18, 2024
c6da9ba
Single quotes
gchristov Oct 18, 2024
48728fc
Oups
gchristov Oct 18, 2024
861b088
Rename
gchristov Oct 18, 2024
cdfd467
Bring back double quotes
gchristov Oct 18, 2024
2b8632f
cat dog example
gchristov Oct 18, 2024
e0b10e6
Fixes
gchristov Oct 18, 2024
aebe31d
Check output
gchristov Oct 18, 2024
124c607
Another
gchristov Oct 18, 2024
01dbf37
Another
gchristov Oct 18, 2024
c702334
Attempt
gchristov Oct 18, 2024
75f94ea
Another
gchristov Oct 18, 2024
22efaeb
Test
gchristov Oct 18, 2024
a30568a
f
gchristov Oct 18, 2024
0aafc55
try with print
gchristov Oct 18, 2024
d2e0c96
Again
gchristov Oct 18, 2024
1553788
Try escaping quote
gchristov Oct 18, 2024
f4a761c
Feed it into the other job
gchristov Oct 18, 2024
1ba9d3d
try joining
gchristov Oct 18, 2024
6b8bd2b
typo
gchristov Oct 18, 2024
42851ed
Try final echo
gchristov Oct 18, 2024
02684a6
Use it for the other job
gchristov Oct 18, 2024
8d962c5
Make it more realistic
gchristov Oct 18, 2024
5457b65
Make it individually cancellable
gchristov Oct 18, 2024
16c5bcf
Try to build all changed services
gchristov Oct 18, 2024
1f7f8bc
Add missing env var
gchristov Oct 18, 2024
077767f
Typo
gchristov Oct 18, 2024
cd281cb
Build docker images
gchristov Oct 18, 2024
8d64442
Exclude docker image builds if there is no compose file
gchristov Oct 18, 2024
720f6a2
Try another way
gchristov Oct 18, 2024
5265670
Another?
gchristov Oct 18, 2024
60aff43
Another approach
gchristov Oct 18, 2024
e7264a0
Add infra previews
gchristov Oct 18, 2024
8b9814b
Rename workflow file
gchristov Oct 18, 2024
f7bb1b1
Trigger CI
gchristov Oct 18, 2024
3424839
f
gchristov Oct 18, 2024
804059c
Test normal workflow
gchristov Oct 18, 2024
c2f7ad2
Ensure infra creds are set
gchristov Oct 18, 2024
1d4dd62
Collect artifacts
gchristov Oct 18, 2024
a1f7663
Unique artifact names
gchristov Oct 18, 2024
a032cc8
Add a test job
gchristov Oct 18, 2024
7b74e8a
Fix tests job
gchristov Oct 18, 2024
fa25bdc
Another fix
gchristov Oct 18, 2024
eb0dcc3
Yarn lock updates
gchristov Oct 18, 2024
9cb9e9a
Run tests for one service to try it out
gchristov Oct 18, 2024
28aa344
Try again
gchristov Oct 18, 2024
b9ff50b
Try with an updated command
gchristov Oct 18, 2024
791585c
Try without special chars in the name
gchristov Oct 18, 2024
2bf3bda
Add individual service testing for now
gchristov Oct 18, 2024
3378de9
Update results name
gchristov Oct 18, 2024
849d132
Tidy up
gchristov Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 0 additions & 104 deletions .github/workflows/common-check.yml

This file was deleted.

104 changes: 0 additions & 104 deletions .github/workflows/common-deploy.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: slack-deploy
name: deploy-check

on:
push:
branches: [ master ]
paths:
- 'slack/**'

env:
JAVA_VERSION: "15"
Expand All @@ -19,11 +17,47 @@ env:
GOOGLE_ANALYTICS_API_SECRET: ${{ secrets.GOOGLE_ANALYTICS_API_SECRET }}

jobs:
slack-deploy-build:
detect-changed-services:
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.ref }}-slack-deploy-build
group: ${{ github.ref }}-detect-changed-services
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Collect all changed root directories
id: changed-root-directories
uses: tj-actions/changed-files@v45
with:
dir_names: true
dir_names_max_depth: '1'
- name: Collect all changed services
id: changed-services
env:
all_changed_files: ${{ steps.changed-root-directories.outputs.all_changed_files }}
run: |
CHANGED_SERVICES=()
for file in ${all_changed_files}; do
if [ -e "$file/infra/Pulumi.yaml" ]; then
CHANGED_SERVICES+=("$file")
fi
done
joined=$(printf ",\"%s\"" "${CHANGED_SERVICES[@]}")
echo "changed_services=[${joined:1}]"
echo "changed_services=[${joined:1}]" >> "$GITHUB_OUTPUT"

outputs:
changed_services: ${{ steps.changed-services.outputs.changed_services }}

service-deploy-build:
runs-on: ubuntu-24.04
strategy:
matrix:
service: ${{ fromJSON(needs.detect-changed-services.outputs.changed_services) }}
concurrency:
group: ${{ github.ref }}-${{ matrix.service }}-service-deploy-build
cancel-in-progress: true
needs: detect-changed-services
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -36,43 +70,48 @@ jobs:
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up secrets
run: |
echo "$GCP_SA_KEY_INFRA" >> ./slack/infra/credentials-gcp-infra.json
echo "$GCP_SA_KEY_INFRA" >> ./${{ matrix.service }}/infra/credentials-gcp-infra.json
echo "$GCP_SA_KEY_APP" >> ./credentials-gcp-app.json
echo MONITORING_SLACK_URL="$MONITORING_SLACK_URL" >> ./common/monitoring/secrets.properties
echo GOOGLE_ANALYTICS_MEASUREMENT_ID="$GOOGLE_ANALYTICS_MEASUREMENT_ID" >> ./common/analytics/secrets.properties
echo GOOGLE_ANALYTICS_API_SECRET="$GOOGLE_ANALYTICS_API_SECRET" >> ./common/analytics/secrets.properties
echo SLACK_SIGNING_SECRET="$SLACK_SIGNING_SECRET" >> ./slack/domain/secrets.properties
echo SLACK_CLIENT_ID="$SLACK_CLIENT_ID" >> ./slack/domain/secrets.properties
echo SLACK_CLIENT_SECRET="$SLACK_CLIENT_SECRET" >> ./slack/domain/secrets.properties
- name: Build project
echo SLACK_CLIENT_ID="$SLACK_CLIENT_ID" >> ./slack-web/domain/secrets.properties
- name: Build service
run: |
set -o pipefail &&
cd slack &&
cd ${{ matrix.service }} &&
./gradlew --no-daemon assemble &&
cd ..
- name: Deploy infrastructure
uses: pulumi/actions@v5
with:
command: up
stack-name: prod
work-dir: slack/infra
work-dir: ${{ matrix.service }}/infra
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
- name: Artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Build
name: Build (${{ matrix.service }})
path: |
**/build
**/secrets.properties
slack/infra
${{ matrix.service }}/infra

slack-deploy-test:
service-deploy-test:
runs-on: ubuntu-24.04
strategy:
matrix:
service: ${{ fromJSON(needs.detect-changed-services.outputs.changed_services) }}
concurrency:
group: ${{ github.ref }}-slack-deploy-test
group: ${{ github.ref }}-${{ matrix.service }}-service-deploy-test
cancel-in-progress: true
needs: detect-changed-services
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -85,29 +124,28 @@ jobs:
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up secrets
run: |
echo "$GCP_SA_KEY_INFRA" >> ./slack/infra/credentials-gcp-infra.json
echo "$GCP_SA_KEY_APP" >> ./credentials-gcp-app.json
echo MONITORING_SLACK_URL="$MONITORING_SLACK_URL" >> ./common/monitoring/secrets.properties
echo GOOGLE_ANALYTICS_MEASUREMENT_ID="$GOOGLE_ANALYTICS_MEASUREMENT_ID" >> ./common/analytics/secrets.properties
echo GOOGLE_ANALYTICS_API_SECRET="$GOOGLE_ANALYTICS_API_SECRET" >> ./common/analytics/secrets.properties
echo SLACK_SIGNING_SECRET="$SLACK_SIGNING_SECRET" >> ./slack/domain/secrets.properties
echo SLACK_CLIENT_ID="$SLACK_CLIENT_ID" >> ./slack/domain/secrets.properties
echo SLACK_CLIENT_SECRET="$SLACK_CLIENT_SECRET" >> ./slack/domain/secrets.properties
echo SLACK_CLIENT_ID="$SLACK_CLIENT_ID" >> ./slack-web/domain/secrets.properties
- name: Test
run: |
set -o pipefail &&
cd slack &&
cd ${{ matrix.service }} &&
./gradlew --no-daemon --continue jsTest &&
cd ..
- name: Generate test report
uses: mikepenz/action-junit-report@v4
if: always() # Ensure all test reports are collected, even after errors
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
check_name: 'slack-deploy-test-results'
check_name: service-check-test-results (${{ matrix.service }})
- name: Artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Tests
name: Tests (${{ matrix.service }})
path: '**/build/test-results/**/TEST-*.xml'
Loading
Loading