Skip to content

Commit c48f45a

Browse files
committed
fix: abort followup workflow jobs when a predecessor failed
1 parent e9bf8fc commit c48f45a

3 files changed

Lines changed: 132 additions & 117 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 122 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- main
8+
- patch/3967
89
tags:
910
# pre-release tag
1011
- "202[3-9].[0-9][0-9].[0-9]+-rc[0-9]+"
@@ -68,7 +69,9 @@ jobs:
6869
tests-pytest:
6970
needs: [setup]
7071
uses: ./.github/workflows/tests-pytest.yml
71-
if: ${{ needs.setup.outputs.is_tag == 'true' }}
72+
with:
73+
parent_event: ${{ github.event_name }}
74+
# if: ${{ needs.setup.outputs.is_tag == 'true' }}
7275

7376
check-migrations-and-messages:
7477
needs: [setup]
@@ -90,126 +93,130 @@ jobs:
9093
check-migrations-and-messages,
9194
check-dynamic-version,
9295
]
93-
if: (!cancelled())
96+
# this convoluted syntax treats both skipped and successful runs as valid prerequisites
97+
if: >-
98+
always() &&
99+
!cancelled() &&
100+
!contains(needs.*.result, 'failure')
94101
environment: ${{ needs.setup.outputs.env_name }}
95102
steps:
96103
- name: Checkout
97104
uses: actions/checkout@v7
98105

99-
- uses: actions/setup-python@v7
100-
with:
101-
python-version-file: .github/workflows/.python-version
102-
cache: pip
103-
cache-dependency-path: "**/pyproject.toml"
104-
105-
- name: Write python packages to file
106-
run: |
107-
python -m venv .venv
108-
source .venv/bin/activate
109-
pip install pipdeptree
110-
pip install -e .
111-
pipdeptree
112-
pipdeptree >> benefits/static/requirements.txt
106+
# - uses: actions/setup-python@v7
107+
# with:
108+
# python-version-file: .github/workflows/.python-version
109+
# cache: pip
110+
# cache-dependency-path: "**/pyproject.toml"
111+
112+
# - name: Write python packages to file
113+
# run: |
114+
# python -m venv .venv
115+
# source .venv/bin/activate
116+
# pip install pipdeptree
117+
# pip install -e .
118+
# pipdeptree
119+
# pipdeptree >> benefits/static/requirements.txt
113120

114121
- name: Write commit SHA to file
115122
run: echo "${{ github.sha }}" >> benefits/static/sha.txt
116123

117-
- name: Docker Login to GitHub Container Registry
118-
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
119-
with:
120-
registry: ghcr.io
121-
username: ${{ github.actor }}
122-
password: ${{ secrets.GITHUB_TOKEN }}
123-
124-
- name: Set up Docker Buildx
125-
id: buildx
126-
uses: docker/setup-buildx-action@v4
127-
128-
- name: Cache Parameters
129-
id: cache_params
130-
run: |
131-
CACHE_SCOPE="cal-itp"
132-
MAIN_BRANCH_REF="refs/heads/main"
133-
134-
echo "cache_from_args=type=gha,scope=${CACHE_SCOPE},ref=${MAIN_BRANCH_REF}" >> $GITHUB_OUTPUT
135-
echo "cache_to_args=type=gha,scope=${CACHE_SCOPE},mode=max,ref=${MAIN_BRANCH_REF}" >> $GITHUB_OUTPUT
136-
137-
- name: Build, tag, and push image to GitHub Container Registry
138-
uses: docker/build-push-action@v7
139-
with:
140-
builder: ${{ steps.buildx.outputs.name }}
141-
build-args: GIT-SHA=${{ github.sha }}
142-
cache-from: ${{ steps.cache_params.outputs.cache_from_args }}
143-
cache-to: ${{ steps.cache_params.outputs.cache_to_args }}
144-
context: .
145-
file: appcontainer/Dockerfile
146-
push: true
147-
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
148-
149-
# deploy application service
150-
- name: Deploy to Azure Web App
151-
uses: azure/webapps-deploy@v2
152-
with:
153-
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
154-
images: ghcr.io/${{ github.repository }}:${{ github.sha }}
155-
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
156-
157-
# begin setup to deploy container app
158-
- name: Log in to azure using federated identity credentials
159-
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
160-
with:
161-
client-id: ${{ secrets.AZURE_SP_CLIENT_ID }}
162-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
163-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
164-
165-
- name: Setup terraform
166-
uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4
167-
with:
168-
terraform_version: 1.15.8 # should match TF_VERSION in .devcontainer/Dockerfile
169-
170-
- name: Initialize terraform and select workspace
171-
working-directory: terraform
172-
run: ./init.sh "${{ needs.setup.outputs.env_name }}"
173-
174-
- name: Terraform plan
175-
working-directory: terraform
176-
env:
177-
TF_VAR_CONTAINER_TAG: ${{ github.sha }}
178-
TF_VAR_DEVSECOPS_OBJECT_ID: ${{ secrets.TF_VAR_DEVSECOPS_OBJECT_ID }}
179-
TF_VAR_ENGINEERING_GROUP_OBJECT_ID: ${{ secrets.TF_VAR_ENGINEERING_GROUP_OBJECT_ID }}
180-
TF_VAR_sp_apply_object_id: ${{ secrets.AZURE_SP_OBJECT_ID }}
181-
TF_VAR_sp_plan_object_id: ${{ secrets.AZURE_SP_PLAN_OBJECT_ID }}
182-
run: terraform plan -out=tfplan -lock-timeout=5m
183-
184-
- name: Terraform apply
185-
working-directory: terraform
186-
run: terraform apply -lock-timeout=5m tfplan
187-
188-
# attach a detailed summary directly to a gh actions job. sensitive values that match repo secrets are automatically redacted
189-
- name: Attach detailed summary to job
190-
uses: borchero/terraform-plan-comment@f585438eda2fa77c6f275994b92aeccd86ef3542 # v3.2.0
191-
with:
192-
planfile: tfplan
193-
token: ${{ github.token }}
194-
skip-comment: true
195-
working-directory: terraform
196-
197-
release:
198-
needs: deploy
199-
if: ${{ needs.setup.outputs.is_release =='true' }}
200-
runs-on: ubuntu-latest
201-
permissions:
202-
# https://github.com/softprops/action-gh-release#permissions
203-
contents: write
204-
205-
steps:
206-
- name: Checkout
207-
uses: actions/checkout@v7
208-
with:
209-
fetch-depth: 0
210-
211-
- name: Release
212-
uses: softprops/action-gh-release@v3
213-
with:
214-
prerelease: false
215-
generate_release_notes: true
124+
# - name: Docker Login to GitHub Container Registry
125+
# uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
126+
# with:
127+
# registry: ghcr.io
128+
# username: ${{ github.actor }}
129+
# password: ${{ secrets.GITHUB_TOKEN }}
130+
131+
# - name: Set up Docker Buildx
132+
# id: buildx
133+
# uses: docker/setup-buildx-action@v4
134+
135+
# - name: Cache Parameters
136+
# id: cache_params
137+
# run: |
138+
# CACHE_SCOPE="cal-itp"
139+
# MAIN_BRANCH_REF="refs/heads/main"
140+
141+
# echo "cache_from_args=type=gha,scope=${CACHE_SCOPE},ref=${MAIN_BRANCH_REF}" >> $GITHUB_OUTPUT
142+
# echo "cache_to_args=type=gha,scope=${CACHE_SCOPE},mode=max,ref=${MAIN_BRANCH_REF}" >> $GITHUB_OUTPUT
143+
144+
# - name: Build, tag, and push image to GitHub Container Registry
145+
# uses: docker/build-push-action@v7
146+
# with:
147+
# builder: ${{ steps.buildx.outputs.name }}
148+
# build-args: GIT-SHA=${{ github.sha }}
149+
# cache-from: ${{ steps.cache_params.outputs.cache_from_args }}
150+
# cache-to: ${{ steps.cache_params.outputs.cache_to_args }}
151+
# context: .
152+
# file: appcontainer/Dockerfile
153+
# push: true
154+
# tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
155+
156+
# # deploy application service
157+
# - name: Deploy to Azure Web App
158+
# uses: azure/webapps-deploy@v2
159+
# with:
160+
# app-name: ${{ vars.AZURE_WEBAPP_NAME }}
161+
# images: ghcr.io/${{ github.repository }}:${{ github.sha }}
162+
# publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
163+
164+
# # begin setup to deploy container app
165+
# - name: Log in to azure using federated identity credentials
166+
# uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
167+
# with:
168+
# client-id: ${{ secrets.AZURE_SP_CLIENT_ID }}
169+
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
170+
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
171+
172+
# - name: Setup terraform
173+
# uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4
174+
# with:
175+
# terraform_version: 1.15.8 # should match TF_VERSION in .devcontainer/Dockerfile
176+
177+
# - name: Initialize terraform and select workspace
178+
# working-directory: terraform
179+
# run: ./init.sh "${{ needs.setup.outputs.env_name }}"
180+
181+
# - name: Terraform plan
182+
# working-directory: terraform
183+
# env:
184+
# TF_VAR_CONTAINER_TAG: ${{ github.sha }}
185+
# TF_VAR_DEVSECOPS_OBJECT_ID: ${{ secrets.TF_VAR_DEVSECOPS_OBJECT_ID }}
186+
# TF_VAR_ENGINEERING_GROUP_OBJECT_ID: ${{ secrets.TF_VAR_ENGINEERING_GROUP_OBJECT_ID }}
187+
# TF_VAR_sp_apply_object_id: ${{ secrets.AZURE_SP_OBJECT_ID }}
188+
# TF_VAR_sp_plan_object_id: ${{ secrets.AZURE_SP_PLAN_OBJECT_ID }}
189+
# run: terraform plan -out=tfplan -lock-timeout=5m
190+
191+
# - name: Terraform apply
192+
# working-directory: terraform
193+
# run: terraform apply -lock-timeout=5m tfplan
194+
195+
# # attach a detailed summary directly to a gh actions job. sensitive values that match repo secrets are automatically redacted
196+
# - name: Attach detailed summary to job
197+
# uses: borchero/terraform-plan-comment@f585438eda2fa77c6f275994b92aeccd86ef3542 # v3.2.0
198+
# with:
199+
# planfile: tfplan
200+
# token: ${{ github.token }}
201+
# skip-comment: true
202+
# working-directory: terraform
203+
204+
# release:
205+
# needs: deploy
206+
# if: ${{ needs.setup.outputs.is_release =='true' }}
207+
# runs-on: ubuntu-latest
208+
# permissions:
209+
# # https://github.com/softprops/action-gh-release#permissions
210+
# contents: write
211+
212+
# steps:
213+
# - name: Checkout
214+
# uses: actions/checkout@v7
215+
# with:
216+
# fetch-depth: 0
217+
218+
# - name: Release
219+
# uses: softprops/action-gh-release@v3
220+
# with:
221+
# prerelease: false
222+
# generate_release_notes: true

.github/workflows/tests-pytest.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
name: Pytest
22

3-
on: [push, pull_request, workflow_call]
3+
on:
4+
push:
5+
pull_request:
6+
workflow_call:
7+
inputs:
8+
parent_event:
9+
type: string
10+
required: true
411

512
jobs:
613
pytest:
@@ -41,6 +48,7 @@ jobs:
4148
run: ./tests/pytest/run.sh
4249

4350
- name: Upload coverage report
51+
if: ${{ inputs.parent_event != 'workflow_dispatch' }}
4452
uses: actions/upload-artifact@v7
4553
with:
4654
name: coverage-report

tests/pytest/locale/test_formats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def date_march():
1818

1919

2020
def test_en_DATE_FORMAT_december(date_december):
21-
assert date_format(date_december, DATE_FORMAT_EN) == "December 1, 2024"
21+
assert date_format(date_december, DATE_FORMAT_EN) == "Xecember 1, 2024"
2222

2323

2424
def test_en_DATE_FORMAT_march(date_march):

0 commit comments

Comments
 (0)