Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
48 lines (39 loc) · 1.92 KB
/
Copy pathaction.yml
File metadata and controls
48 lines (39 loc) · 1.92 KB
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
name: ci-fetch-build-run
descrption: Pulls the latest head of the current branch and runs the CI pipeline
inputs:
distro_ver:
description : The type of machine to run the job on
required : True
branch:
description : The branch name for the job
required : True
env:
ghcr_token: ${{ secrets.GHCR_TOKEN }}
runs:
using: composite
steps:
- name: Login to ghcr.io
run: echo ${{ env.ghcr_token }} | docker login ghcr.io -u illixr-ci --password-stdin
shell: bash
# Pulls latest and current branch tag of this container. This allows the docker build to use the cache for faster builds.
- name: Pull Docker Cache
run: docker pull ghcr.io/illixr/illixr-tests:${{ inputs.branch }} || docker pull ghcr.io/illixr/illixr-tests:latest || true
shell: bash
# Performs the docker build and pulls the cache from either the branch name tag or from latest.
# The latest tag is what is on master so it will use that cache the first time this branch runs
- name: Build Docker Image
run: docker build --build-arg JOBS="$(nproc)" --build-arg=BASE_IMG=ubuntu:${{ inputs.distro_ver }} --cache-from ghcr.io/illixr/illixr-tests:${{ inputs.branch }},ghcr.io/illixr/illixr-tests:latest . -t ghcr.io/illixr/illixr-tests:${{ inputs.branch }}
shell: bash
- name: Push Docker Image
run: docker push ghcr.io/illixr/illixr-tests:${{ inputs.branch }}
shell: bash
# For builds on master we also want to push the image as the latest tag.
- name: Tag Master Docker Image As Latest
run: if [ ${{ inputs.branch }} = "master" ]; then docker tag ghcr.io/illixr/illixr-tests:${{ inputs.branch }} ghcr.io/illixr/illixr-tests:latest && docker push ghcr.io/illixr/illixr-tests:latest fi
shell: bash
- name: Pull Docker Image
run: docker pull ghcr.io/illixr/illixr-tests:${{ inputs.branch }}
shell: bash
- name: Run Tests
run: docker run ghcr.io/illixr/illixr-tests:${{ inputs.branch }}
shell: bash