Skip to content

Commit b835974

Browse files
authored
Merge pull request #411 from instructlab/unittests-run-conditions
syncs unit testing workflow setup with e2e setup
2 parents 8f58212 + 8793cf6 commit b835974

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

.github/workflows/unit-tests.yaml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,33 @@ name: "Run unit tests via Tox::pytest"
1010
# to verify integration correctness.
1111

1212
on:
13-
pull_request:
14-
types: [opened, reopened, synchronize]
13+
# run against every merge commit to 'main' and release branches
1514
push:
1615
branches:
17-
- "main"
18-
- "release-**"
16+
- main
17+
- release-*
18+
# only run on PRs that touch certain regex paths
19+
pull_request_target:
20+
branches:
21+
- main
22+
- release-*
23+
paths:
24+
# note this should match the merging criteria in 'mergify.yml'
25+
- "**.py"
26+
- "pyproject.toml"
27+
- "requirements**.txt"
28+
- ".github/workflows/unit-tests.yaml" # This workflow
29+
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
32+
cancel-in-progress: true
33+
34+
permissions:
35+
contents: read
36+
37+
defaults:
38+
run:
39+
shell: bash
1940

2041
env:
2142
pytest_mark: "fast"
@@ -64,9 +85,10 @@ jobs:
6485
needs:
6586
- start-ec2-runner
6687
runs-on: ${{needs.start-ec2-runner.outputs.label}}
67-
# This job MUST HAVE NO PERMISSIONS and no access to any secrets
68-
# because it'll run incoming user code without discretion.
69-
permissions: {} # this syntax disables permissions for all available options.
88+
# It is important that this job has no write permissions and has
89+
# no access to any secrets. This part is where we are running
90+
# untrusted code from PRs.
91+
permissions: {}
7092
steps:
7193
- name: "Harden runner"
7294
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.1

0 commit comments

Comments
 (0)