Skip to content

Commit 8554ed6

Browse files
committed
ci: merge tester and tester-tag into a single parallel workflow
Consolidate tester.yml and tester-tag.yml into a single ci workflow with two independent parallel jobs: - test-instance-ids — targets by explicit instance ID (existing behaviour) - test-tag-targeting — targets by tag (Key=tag:env + Key=tag:role) Both jobs run on push to develop/main and workflow_dispatch. The dispatch input 'environment' controls the tag value for the tag job (defaults to 'production' on push). Neither job depends on the other. Delete tester-tag.yml.
1 parent 3148f81 commit 8554ed6

2 files changed

Lines changed: 65 additions & 81 deletions

File tree

.github/workflows/tester-tag.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/tester.yml

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ name: ci
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: "Tag-targeting environment (used by the tag-targeting job)"
8+
required: false
9+
default: production
10+
type: choice
11+
options: [staging, production]
512
push:
613
branches:
714
- develop
15+
- main
816

917
env:
1018
MINIMUM_PACKAGE_AGE_HOURS: 0
@@ -17,8 +25,9 @@ permissions:
1725
contents: read
1826

1927
jobs:
20-
test:
21-
name: Integration test
28+
# ── Job 1: target by instance ID ─────────────────────────────────────────────
29+
test-instance-ids:
30+
name: Integration test — instance-ids
2231
runs-on: ubuntu-latest
2332

2433
steps:
@@ -46,20 +55,69 @@ jobs:
4655
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
4756
aws-region: ${{ secrets.AWS_REGION }}
4857

49-
- name: Run SSM command
50-
id: deploy
58+
- name: Run SSM command (instance-ids)
59+
id: ssm
5160
uses: ./
5261
with:
5362
aws-region: ${{ secrets.AWS_REGION }}
5463
instance-ids: ${{ secrets.INSTANCE_ID }}
64+
working-directory: /home/ec2-user
5565
wait-for-output: true
5666
wait-timeout: 180
57-
working-directory: /home/ec2-user
58-
comment: aws-ssm-action CI test
67+
comment: ci — instance-ids — ${{ github.sha }}
5968
command: |
6069
echo "Hello from GitHub Actions!" >> logs.txt
6170
echo $(date) >> logs.txt
6271
cat logs.txt
6372
6473
- name: Print output
65-
run: echo "${{ steps.deploy.outputs.output }}"
74+
run: echo "${{ steps.ssm.outputs.output }}"
75+
76+
# ── Job 2: target by tag ──────────────────────────────────────────────────────
77+
test-tag-targeting:
78+
name: Integration test — tag targeting
79+
runs-on: ubuntu-latest
80+
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
84+
85+
- name: Setup Bun
86+
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
87+
88+
- name: Install safe-chain
89+
run: |
90+
curl -fsSL "https://github.com/AikidoSec/safe-chain/releases/download/${SAFE_CHAIN_VERSION}/install-safe-chain.sh" \
91+
-o install-safe-chain.sh
92+
echo "${SAFE_CHAIN_SHA256} install-safe-chain.sh" | sha256sum --check
93+
sh install-safe-chain.sh --ci
94+
95+
- name: Install dependencies
96+
run: bun install
97+
env:
98+
SAFE_CHAIN_MINIMUM_PACKAGE_AGE_HOURS: ${{ env.MINIMUM_PACKAGE_AGE_HOURS }}
99+
100+
- name: Configure AWS credentials (OIDC)
101+
uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0
102+
with:
103+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
104+
aws-region: ${{ secrets.AWS_REGION }}
105+
106+
- name: Run SSM command (tag targeting)
107+
id: ssm
108+
uses: ./
109+
with:
110+
aws-region: ${{ secrets.AWS_REGION }}
111+
targets: |
112+
Key=tag:env,Values=${{ inputs.environment || 'production' }}
113+
Key=tag:role,Values=web
114+
working-directory: /home/ec2-user
115+
wait-for-output: true
116+
wait-timeout: 180
117+
comment: ci — tags — ${{ github.sha }}
118+
command: |
119+
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) Hello from tag-targeting CI" >> logs.txt
120+
cat logs.txt
121+
122+
- name: Print output
123+
run: echo "${{ steps.ssm.outputs.output }}"

0 commit comments

Comments
 (0)