Skip to content

Commit 36965cb

Browse files
committed
Run smoke tests before Docker builds
#230 (comment)
1 parent da55441 commit 36965cb

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

.github/workflows/build-and-push-docker-image.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ on: # yamllint disable-line rule:truthy
1414
type: string
1515

1616
jobs:
17+
smoke-test:
18+
uses: ./.github/workflows/reusable-smoke-test.yml
1719
build-and-push:
20+
if: github.event_name != 'pull_request'
1821
runs-on: ubuntu-latest
22+
needs:
23+
- smoke-test
1924
timeout-minutes: 10
2025
steps:
2126
- uses: actions/checkout@v4
@@ -39,17 +44,11 @@ jobs:
3944
env:
4045
DOCKER_TAG: ${{ inputs.tag || github.ref_name }}
4146
- name: Log in to GHCR
42-
if: github.event_name != 'pull_request'
4347
run: >-
4448
echo ${{ secrets.GITHUB_TOKEN }} |
4549
docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
4650
- name: Push Docker image to GHCR
47-
if: github.event_name != 'pull_request'
4851
run: |
4952
docker push $IMAGE
5053
docker push $IMAGE_MAJOR
5154
docker push $IMAGE_MAJOR_MINOR
52-
smoke-test:
53-
needs:
54-
- build-and-push
55-
uses: ./.github/workflows/reusable-smoke-test.yml

action.yml

-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ runs:
141141
# Create Docker container action
142142
python create-docker-action.py
143143
env:
144-
EVENT: ${{ github.event_name }}
145144
REF: ${{ steps.set-repo-and-ref.outputs.ref }}
146145
REPO: ${{ steps.set-repo-and-ref.outputs.repo }}
147146
REPO_ID: ${{ steps.set-repo-and-ref.outputs.repo-id }}

create-docker-action.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@
55
DESCRIPTION = 'description'
66
REQUIRED = 'required'
77

8-
EVENT = os.environ['EVENT']
98
REF = os.environ['REF']
109
REPO = os.environ['REPO']
1110
REPO_ID = os.environ['REPO_ID']
1211
REPO_ID_GH_ACTION = '178055147'
1312

1413

15-
def set_image(event: str, ref: str, repo: str, repo_id: str) -> str:
16-
if event == 'pull_request' and repo_id == REPO_ID_GH_ACTION:
14+
def set_image(ref: str, repo: str, repo_id: str) -> str:
15+
if repo_id == REPO_ID_GH_ACTION:
1716
return '../../../Dockerfile'
1817
docker_ref = ref.replace('/', '-')
1918
return f'docker://ghcr.io/{repo}:{docker_ref}'
2019

2120

22-
image = set_image(EVENT, REF, REPO, REPO_ID)
21+
image = set_image(REF, REPO, REPO_ID)
2322

2423
action = {
2524
'name': '🏃',

0 commit comments

Comments
 (0)