mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-19 09:01:25 +01:00
ci: pin nested shared gate actions to reviewed revision (#289)
This commit is contained in:
1 parent
139cccb97f
commit
2c06746765
3 files changed
+22
-11
No files matched your search
@@ -220,7 +220,7 @@ jobs:
|
||||
fetch-depth: 2
|
||||
- id: select
|
||||
if: inputs.select-os != '' && inputs.select-os != '[]'
|
||||
uses: storytold/craft-common-actions/actions/select-platforms@main
|
||||
uses: storytold/craft-common-actions/actions/select-platforms@139cccb97f9dc462b56f39ee2830718aaa782fed
|
||||
with:
|
||||
os: ${{ inputs.os }}
|
||||
select-os: ${{ inputs.select-os }}
|
||||
@@ -339,7 +339,7 @@ jobs:
|
||||
|
||||
# Does nothing unless the repository has craft-i18n.rev; then builds require the translations.
|
||||
- name: Check out craft-i18n
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-i18n@139cccb97f9dc462b56f39ee2830718aaa782fed
|
||||
|
||||
# Before the cache step: rust-cache keys on CARGO_* and RUST* variables.
|
||||
- name: Caller environment
|
||||
@@ -381,7 +381,7 @@ jobs:
|
||||
|
||||
- name: Install Linux build dependencies
|
||||
if: runner.os == 'Linux' && inputs.packages != ''
|
||||
uses: storytold/craft-common-actions/actions/install-apt-packages@main
|
||||
uses: storytold/craft-common-actions/actions/install-apt-packages@139cccb97f9dc462b56f39ee2830718aaa782fed
|
||||
with:
|
||||
packages: ${{ inputs.packages }}
|
||||
|
||||
@@ -420,7 +420,7 @@ jobs:
|
||||
# The lint part builds in check mode, so it keeps an entry of its own (`<profile>-lint`)
|
||||
# instead of racing the test part for the `gate` entry. Shard legs restore the test part's
|
||||
# entry, and shard 1 alone saves it, so the shards do not race each other for it.
|
||||
- uses: storytold/craft-common-actions/actions/rust-cache@main
|
||||
- uses: storytold/craft-common-actions/actions/rust-cache@139cccb97f9dc462b56f39ee2830718aaa782fed
|
||||
with:
|
||||
cache-version: ${{ inputs.cache-version }}
|
||||
job: ${{ matrix.part == 'lint' && 'lint' || inputs.cache-name != '' && format('gate-{0}', inputs.cache-name) || '' }}
|
||||
|
||||
+16
-5
@@ -15,7 +15,7 @@ WORKFLOW = yaml.load((ROOT / '.github/workflows/gate.yml').read_text(), Loader=y
|
||||
INPUTS = WORKFLOW['on']['workflow_call']['inputs']
|
||||
JOBS = WORKFLOW['jobs']
|
||||
STEPS = JOBS['gate']['steps']
|
||||
OWN_ACTION = re.compile(r'^storytold/craft-common-actions/actions/[a-z0-9-]+@main$')
|
||||
OWN_ACTION_REV = '139cccb97f9dc462b56f39ee2830718aaa782fed'
|
||||
|
||||
|
||||
def step(name):
|
||||
@@ -265,12 +265,23 @@ def ran(steps, name):
|
||||
|
||||
|
||||
class GateWorkflowTests(unittest.TestCase):
|
||||
def test_third_party_actions_are_pinned_to_a_commit(self):
|
||||
def test_all_actions_are_pinned_to_a_commit(self):
|
||||
for job, s in all_steps():
|
||||
if 'uses' in s:
|
||||
with self.subTest(job=job, uses=s['uses']):
|
||||
if not OWN_ACTION.match(s['uses']):
|
||||
self.assertRegex(s['uses'], r'@[0-9a-f]{40}$')
|
||||
self.assertRegex(s['uses'], r'@[0-9a-f]{40}$')
|
||||
|
||||
def test_first_party_actions_share_reviewed_revision(self):
|
||||
expected = {'select-platforms', 'checkout-craft-i18n', 'install-apt-packages', 'rust-cache'}
|
||||
actual = set()
|
||||
prefix = 'storytold/craft-common-actions/actions/'
|
||||
for _, item in all_steps():
|
||||
uses = item.get('uses', '')
|
||||
if uses.startswith(prefix):
|
||||
name, revision = uses[len(prefix):].split('@')
|
||||
self.assertEqual(revision, OWN_ACTION_REV)
|
||||
actual.add(name)
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_manual_branch_saves_require_explicit_opt_in(self):
|
||||
cache = next(s for s in STEPS if 'rust-cache' in s.get('uses', ''))
|
||||
@@ -538,7 +549,7 @@ class LintPartTests(unittest.TestCase):
|
||||
|
||||
SHARDED = dict(test_shards=3, shard_command='cargo nextest run --workspace --partition "$NEXTEST_PARTITION"')
|
||||
TWO_RUNNERS = '["ubuntu-24.04","windows-latest"]'
|
||||
CACHE = 'storytold/craft-common-actions/actions/rust-cache@main'
|
||||
CACHE = 'storytold/craft-common-actions/actions/rust-cache@' + OWN_ACTION_REV
|
||||
|
||||
|
||||
class ShardTests(unittest.TestCase):
|
||||
|
||||
@@ -356,7 +356,7 @@ class GateTests(unittest.TestCase):
|
||||
|
||||
def test_setup_shell_steps_do_not_add_cargo_home_to_the_key(self):
|
||||
cache = next(i for i, s in enumerate(GATE_STEPS)
|
||||
if s.get('uses') == 'storytold/craft-common-actions/actions/rust-cache@main')
|
||||
if s.get('uses') == 'storytold/craft-common-actions/actions/rust-cache@139cccb97f9dc462b56f39ee2830718aaa782fed')
|
||||
for setup in GATE_STEPS[:cache]:
|
||||
# Conservative source guard, not shell data-flow analysis. An opaque setup action
|
||||
# still needs a hosted key comparison; callers' generic env input remains supported.
|
||||
@@ -368,7 +368,7 @@ class GateTests(unittest.TestCase):
|
||||
|
||||
def test_the_gate_restores_through_the_action(self):
|
||||
calls = [s for s in GATE_STEPS
|
||||
if s.get('uses') == 'storytold/craft-common-actions/actions/rust-cache@main']
|
||||
if s.get('uses') == 'storytold/craft-common-actions/actions/rust-cache@139cccb97f9dc462b56f39ee2830718aaa782fed']
|
||||
self.assertEqual(len(calls), 1)
|
||||
self.assertEqual(calls[0]['with']['cache-version'], '${{ inputs.cache-version }}')
|
||||
self.assertEqual(calls[0]['with']['cache-on-failure'], 'false')
|
||||
|
||||
Reference in new issue
Block a user