Skip to content

Commit f919a0f

Browse files
authored
MRG: Merge pull request #3 from octue/test/add-tests
Add tests to workflow
2 parents f4f2929 + acb16d7 commit f919a0f

File tree

3 files changed

+63
-12
lines changed

3 files changed

+63
-12
lines changed

.github/workflows/semantic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: semantic
22

33
on:
4-
pull_request:
5-
branches:
4+
push:
5+
branches-ignore:
66
- main
77

88
jobs:

.github/workflows/test.yml

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1+
# This workflow tests the `octue/get-deployment-info` GitHub action.
12
name: test-deployment-info
23

34
on:
4-
pull_request:
5-
branches:
6-
- main
5+
push:
76

87
jobs:
9-
info:
8+
test-action:
9+
if: "!contains(github.event.head_commit.message, 'skipci')"
1010
runs-on: ubuntu-latest
11-
1211
timeout-minutes: 5
13-
1412
permissions:
1513
contents: read
16-
1714
steps:
1815
- name: Checkout
1916
uses: actions/checkout@v3
@@ -50,7 +47,61 @@ jobs:
5047
echo ${{ steps.get-deployment-info.outputs.gcp_service_name }}
5148
echo ${{ steps.get-deployment-info.outputs.version }}
5249
53-
- uses: nick-fields/assert-action@v1
50+
- name: Get package version
51+
id: get-package-version
52+
run: echo "PACKAGE_VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
53+
54+
- name: Get short SHA
55+
id: get-short-sha
56+
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
57+
58+
- name: Inject slug/short variables
59+
uses: rlespinasse/github-slug-action@v4
60+
61+
- name: Check `branch_tag_kebab`
62+
uses: nick-fields/assert-action@v1
63+
with:
64+
expected: ${{ env.GITHUB_REF_SLUG }}
65+
actual: ${{ steps.get-deployment-info.outputs.branch_tag_kebab }}
66+
67+
- name: Check `image_latest_artefact`
68+
uses: nick-fields/assert-action@v1
5469
with:
55-
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:-latest
70+
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:${{ env.GITHUB_REF_SLUG }}-latest
5671
actual: ${{ steps.get-deployment-info.outputs.image_latest_artefact }}
72+
73+
- name: Check `image_latest_tag`
74+
uses: nick-fields/assert-action@v1
75+
with:
76+
expected: ${{ env.GITHUB_REF_SLUG }}-latest
77+
actual: ${{ steps.get-deployment-info.outputs.image_latest_tag }}
78+
79+
- name: Check `image_version_artefact`
80+
uses: nick-fields/assert-action@v1
81+
with:
82+
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:${{ env.GITHUB_REF_SLUG }}-unreleased
83+
actual: ${{ steps.get-deployment-info.outputs.image_version_artefact }}
84+
85+
- name: Check `image_version_tag`
86+
uses: nick-fields/assert-action@v1
87+
with:
88+
expected: ${{ env.GITHUB_REF_SLUG }}-unreleased
89+
actual: ${{ steps.get-deployment-info.outputs.image_version_tag }}
90+
91+
- name: Check `short_sha`
92+
uses: nick-fields/assert-action@v1
93+
with:
94+
expected: ${{ steps.get-short-sha.outputs.SHORT_SHA }}
95+
actual: ${{ steps.get-deployment-info.outputs.short_sha }}
96+
97+
- name: Check `version_slug`
98+
uses: nick-fields/assert-action@v1
99+
with:
100+
expected: unreleased
101+
actual: ${{ steps.get-deployment-info.outputs.version_slug }}
102+
103+
- name: Check `version`
104+
uses: nick-fields/assert-action@v1
105+
with:
106+
expected: ${{ steps.get-package-version.outputs.PACKAGE_VERSION }}
107+
actual: ${{ steps.get-deployment-info.outputs.version }}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "get-deployment-info"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "A Github Action that gets the information required to build and deploy an Octue service."
55
authors = ["Marcus Lugg <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)