Skip to content

Commit 7272c57

Browse files
committed
initial workflow_run setup
1 parent b8f39f6 commit 7272c57

File tree

2 files changed

+129
-75
lines changed

2 files changed

+129
-75
lines changed

.github/workflows/affected.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: 🔍
16+
17+
on:
18+
push:
19+
branches: main
20+
pull_request:
21+
22+
jobs:
23+
affected:
24+
name: Finding affected tests
25+
runs-on: ubuntu-latest
26+
# outputs:
27+
# python: ${{steps.python.outputs.affected}}
28+
# defaults:
29+
# run:
30+
# working-directory: .github/testing
31+
# steps:
32+
# - uses: actions/checkout@v4
33+
# with:
34+
# fetch-depth: 0
35+
# - uses: oven-sh/setup-bun@v2
36+
# - run: bun install
37+
# - id: python
38+
# run: |
39+
# AFFECTED_PYTHON=$(bun run affected python HEAD origin/main)
40+
# echo "$AFFECTED_PYTHON"
41+
# echo "affected=$AFFECTED_PYTHON" >> "$GITHUB_OUTPUT"
42+
steps:
43+
- run: echo "Success!"

.github/workflows/test.yaml

Lines changed: 86 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -15,84 +15,95 @@
1515
name: 🪿
1616

1717
on:
18-
push:
19-
branches: main
20-
pull_request:
21-
workflow_dispatch: # Manual runs
22-
23-
env:
24-
PROJECT: jss-22p1-test
25-
WORKLOAD_IDENTITY_PROVIDER: projects/886556137211/locations/global/workloadIdentityPools/github-actions/providers/github-actions-python
18+
workflow_run:
19+
workflows: ["🔍"]
20+
types: ["completed"]
2621

2722
jobs:
28-
affected:
29-
name: Finding affected tests
23+
test:
3024
runs-on: ubuntu-latest
31-
outputs:
32-
python: ${{steps.python.outputs.affected}}
33-
defaults:
34-
run:
35-
working-directory: .github/testing
3625
steps:
37-
- uses: actions/checkout@v4
38-
with:
39-
fetch-depth: 0
40-
- uses: oven-sh/setup-bun@v2
41-
- run: bun install
42-
- id: python
43-
run: |
44-
AFFECTED_PYTHON=$(bun run affected python HEAD origin/main)
45-
echo "$AFFECTED_PYTHON"
46-
echo "affected=$AFFECTED_PYTHON" >> "$GITHUB_OUTPUT"
26+
- run: echo "Running tests"
4727

48-
python-lint:
49-
name: Lint Python
50-
needs: affected
51-
runs-on: ubuntu-latest
52-
strategy:
53-
matrix:
54-
affected: ${{fromJson(needs.affected.outputs.python)}}
55-
defaults:
56-
run:
57-
working-directory: .github/testing
58-
steps:
59-
- uses: actions/checkout@v4
60-
- uses: oven-sh/setup-bun@v2
61-
- uses: actions/setup-python@v5
62-
with:
63-
python-version: '3.12'
64-
- run: pip install nox
65-
- run: bun install
66-
- run: bun run ci-lint python AFFECTED
67-
env:
68-
AFFECTED: ${{toJson(matrix.affected)}}
28+
# on:
29+
# push:
30+
# branches: main
31+
# pull_request:
32+
# workflow_dispatch: # Manual runs
6933

70-
python-test:
71-
name: Test Python
72-
needs: affected
73-
runs-on: ubuntu-latest
74-
strategy:
75-
matrix:
76-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
77-
affected: ${{fromJson(needs.affected.outputs.python)}}
78-
permissions: # needed for google-github-actions/auth
79-
id-token: write
80-
contents: read
81-
defaults:
82-
run:
83-
working-directory: .github/testing
84-
steps:
85-
- uses: actions/checkout@v4
86-
- uses: oven-sh/setup-bun@v2
87-
- uses: actions/setup-python@v5
88-
with:
89-
python-version: ${{matrix.python-version}}
90-
- uses: 'google-github-actions/auth@v2'
91-
with:
92-
project_id: ${{env.PROJECT}}
93-
workload_identity_provider: ${{env.WORKLOAD_IDENTITY_PROVIDER}}
94-
- run: pip install nox
95-
- run: bun install
96-
- run: bun run ci-test python${{matrix.python-version}} AFFECTED
97-
env:
98-
AFFECTED: ${{toJson(matrix.affected)}}
34+
# env:
35+
# PROJECT: jss-22p1-test
36+
# WORKLOAD_IDENTITY_PROVIDER: projects/886556137211/locations/global/workloadIdentityPools/github-actions/providers/github-actions-python
37+
38+
# jobs:
39+
# affected:
40+
# name: Finding affected tests
41+
# runs-on: ubuntu-latest
42+
# outputs:
43+
# python: ${{steps.python.outputs.affected}}
44+
# defaults:
45+
# run:
46+
# working-directory: .github/testing
47+
# steps:
48+
# - uses: actions/checkout@v4
49+
# with:
50+
# fetch-depth: 0
51+
# - uses: oven-sh/setup-bun@v2
52+
# - run: bun install
53+
# - id: python
54+
# run: |
55+
# AFFECTED_PYTHON=$(bun run affected python HEAD origin/main)
56+
# echo "$AFFECTED_PYTHON"
57+
# echo "affected=$AFFECTED_PYTHON" >> "$GITHUB_OUTPUT"
58+
59+
# python-lint:
60+
# name: Lint Python
61+
# needs: affected
62+
# runs-on: ubuntu-latest
63+
# strategy:
64+
# matrix:
65+
# affected: ${{fromJson(needs.affected.outputs.python)}}
66+
# defaults:
67+
# run:
68+
# working-directory: .github/testing
69+
# steps:
70+
# - uses: actions/checkout@v4
71+
# - uses: oven-sh/setup-bun@v2
72+
# - uses: actions/setup-python@v5
73+
# with:
74+
# python-version: '3.12'
75+
# - run: pip install nox
76+
# - run: bun install
77+
# - run: bun run ci-lint python AFFECTED
78+
# env:
79+
# AFFECTED: ${{toJson(matrix.affected)}}
80+
81+
# python-test:
82+
# name: Test Python
83+
# needs: affected
84+
# runs-on: ubuntu-latest
85+
# strategy:
86+
# matrix:
87+
# python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
88+
# affected: ${{fromJson(needs.affected.outputs.python)}}
89+
# permissions: # needed for google-github-actions/auth
90+
# id-token: write
91+
# contents: read
92+
# defaults:
93+
# run:
94+
# working-directory: .github/testing
95+
# steps:
96+
# - uses: actions/checkout@v4
97+
# - uses: oven-sh/setup-bun@v2
98+
# - uses: actions/setup-python@v5
99+
# with:
100+
# python-version: ${{matrix.python-version}}
101+
# - uses: 'google-github-actions/auth@v2'
102+
# with:
103+
# project_id: ${{env.PROJECT}}
104+
# workload_identity_provider: ${{env.WORKLOAD_IDENTITY_PROVIDER}}
105+
# - run: pip install nox
106+
# - run: bun install
107+
# - run: bun run ci-test python${{matrix.python-version}} AFFECTED
108+
# env:
109+
# AFFECTED: ${{toJson(matrix.affected)}}

0 commit comments

Comments
 (0)