-
Notifications
You must be signed in to change notification settings - Fork 14
65 lines (56 loc) · 1.75 KB
/
verify-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# This workflow will perform a test whenever there
# is some change in code done to ensure that the
# changes are not buggy and we are getting desired output.
name: Verify Build
on:
push:
workflow_dispatch:
pull_request:
schedule:
- cron: '0 0 * * *' # every day at midnight
env:
TEST_REPO: helloworld
IMAGE_NAME: hello-world
TAGS: latest v1
jobs:
test-s2i-job:
runs-on: ubuntu-latest
# This will install latest version of s2i and
# to build the image and using Docker we will
# run the image to verify the build.
name: Install S2I and build image
steps:
# Checkout S2I action github repository
- name: Checkout s2i-build action
uses: actions/checkout@v4
with:
path: 's2i-build'
# Checkout hello-world repository for testing
- name: Checkout application
uses: actions/checkout@v4
with:
repository: 'go-training/helloworld'
path: ${{ env.TEST_REPO }}
# Install s2i cli for future steps
- name: Install S2i
uses: redhat-actions/openshift-tools-installer@v1
with:
source: github
github_pat: ${{ github.token }}
s2i: "latest"
# Build container image
- name: Build
id: build_image
uses: ./s2i-build/
with:
path_context: './${{ env.TEST_REPO }}'
builder_image: 'centos/go-toolset-7-centos7'
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.TAGS }}
- name: Echo Outputs
run: |
echo "Image: ${{ steps.build_image.outputs.image }}"
echo "Tags: ${{ steps.build_image.outputs.tags }}"
# Run image to verify the build
- name: Run image
run: docker run ${{ env.IMAGE_NAME}}:latest