Skip to content

Commit 209a859

Browse files
committed
Use github variables to control backend environment
Use github variables to control backend environment and allow manual triggering with a specific environment
1 parent 8afbdea commit 209a859

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

.github/workflows/main.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
on:
23
push:
34
branches:
@@ -6,11 +7,18 @@ on:
67
merge_group:
78
schedule:
89
- cron: '0 0 * * *' # Every day at midnight UTC
9-
10+
# allow manual triggering with a given environment
11+
workflow_dispatch:
12+
inputs:
13+
ENVIRONMENT:
14+
required: true
15+
type: environment
1016
name: CI
1117
jobs:
1218

1319
test:
20+
environment:
21+
name: ${{ vars.ENVIRONMENT }}
1422
runs-on: ubuntu-latest
1523
steps:
1624
- name: Check out source code
@@ -34,6 +42,8 @@ jobs:
3442
run: pdm run test-docs
3543

3644
license:
45+
environment:
46+
name: ${{ vars.ENVIRONMENT}}
3747
runs-on: ubuntu-latest
3848
steps:
3949
- name: Check out source code
@@ -45,5 +55,10 @@ jobs:
4555

4656
test-submit:
4757
uses: ./.github/workflows/test-examples.yml
58+
with:
59+
CHIPFLOW_API_ORIGIN: ${{ vars.CHIPFLOW_API_ORIGIN }}
60+
CHIPFLOW_BACKEND_VERSION: ${{ vars.CHIPFLOW_BACKEND_VERSION }}
61+
ENVIRONMENT: ${{ vars.ENVIRONMENT }}
4862
secrets:
4963
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
64+

.github/workflows/test-examples.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@ on:
55
secrets:
66
CHIPFLOW_API_KEY:
77
required: true
8+
inputs:
9+
CHIPFLOW_API_ORIGIN:
10+
required: true
11+
type: string
12+
CHIPFLOW_BACKEND_VERSION:
13+
required: true
14+
type: string
15+
ENVIRONMENT:
16+
required: true
17+
type: string
18+
819

920
jobs:
1021
test-submit:
1122
runs-on: ubuntu-latest
23+
environment: ${{ vars.ENVIRONMENT }}
1224
strategy:
1325
matrix:
1426
dry: [true, false]
@@ -18,7 +30,7 @@ jobs:
1830
env:
1931
DRY: ${{ matrix.dry && '--dry-run' || '' }}
2032
is_dry: ${{ matrix.dry && '(dry run)' || '' }}
21-
our_path: "${{ github.workspace}}/${{ github.repo }}"
33+
our_path: ${{ github.workspace}}
2234
test_repo_path: "${{ github.workspace }}/${{ matrix.repo.name }}"
2335

2436
name: ${{ matrix.dry && 'Test Submit - Dry run' || 'Test submit' }}
@@ -39,20 +51,23 @@ jobs:
3951
id: check-head-ref
4052
working-directory: ${{ env.test_repo_path }}
4153
if: github.event_name == 'pull_request'
54+
env:
55+
HEAD_REF: ${{ github.head_ref }}
56+
BASE_REF: ${{ github.base_ref }}
4257
run: |
4358
git remote update
44-
if git checkout ${{ github.head_ref }}; then
45-
echo "Using branch ${{github.head_ref}}"
59+
if git checkout $HEAD_REF; then
60+
echo "Using branch $HEAD_REF"
4661
echo "found-branch=1\n" >> $GITHUB_OUTPUT
4762
else
48-
echo "${{github.head_ref}} not found, checking base ${{github.base_ref}}"
63+
echo "$HEAD_REF not found, checking base $BASE_REF"
4964
echo "found-branch=0\n" >> $GITHUB_OUTPUT
5065
fi
5166
5267
- name: Check for branch ${{ github.base_ref }}
5368
id: check-base-ref
5469
working-directory: ${{ env.test_repo_path }}x
55-
if: github.event_name == 'pull_request' && steps.check-head-ref == 0
70+
if: github.event_name == 'pull_request' && steps.check-head-ref.outputs.found-branch == '0'
5671
run: |
5772
git remote update
5873
if git checkout ${{ github.base_ref }}; then
@@ -92,3 +107,5 @@ jobs:
92107
pdm run chipflow silicon submit --wait $DRY | cat
93108
env:
94109
CHIPFLOW_API_KEY: ${{ secrets.CHIPFLOW_API_KEY}}
110+
CHIPFLOW_API_ORIGIN: ${{ inputs.CHIPFLOW_API_ORIGIN }}
111+
CHIPFLOW_BACKEND_VERSION: ${{ inputs.CHIPFLOW_BACKEND_VERSION }}

0 commit comments

Comments
 (0)