-
Notifications
You must be signed in to change notification settings - Fork 55
136 lines (131 loc) · 4.25 KB
/
Copy pathbuild-test-lint.yaml
File metadata and controls
136 lines (131 loc) · 4.25 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: "build-test-lint"
run-name: Build of ${{ github.ref_name }} by @${{ github.actor }}
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
debug_step:
required: false
description: "Pause the selected step to debug using tmate"
type: choice
default: ""
options:
- ""
- build
- test
- lint
env:
REGISTRY: ghcr.io
IMAGE_NAME: samvera/hyku
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
jobs:
build:
strategy:
matrix:
component: ["solr", "web", "worker"]
os: ["ubuntu-latest", "ubuntu-24.04-arm"]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
permissions: write-all
steps:
- name: Determine git sha to checkout
uses: haya14busa/action-cond@v1
id: gitsha
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: ${{ github.event.pull_request.head.sha }}
if_false: ${{ github.sha }}
- name: Set env
run: echo "TAG=${GIT_SHA::8}" >> $GITHUB_ENV
env:
GIT_SHA: ${{ steps.gitsha.outputs.value }}
- name: Downcase repo
run: echo "REPO_LOWER=${REPO,,}" >> $GITHUB_ENV
env:
REPO: "${{ github.repository }}"
- name: Set platform from matrix
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
echo "PLATFORM_TAG=amd64" >> $GITHUB_ENV
else
echo "PLATFORM_TAG=arm64" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Github Container Login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ${{ matrix.component }} on ${{ matrix.os }}
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/${{ env.PLATFORM_TAG }}
target: hyku-${{ matrix.component }}
cache-from: |
type=registry,ref=ghcr.io/samvera/hyku/${{ matrix.component }}:latest
cache-to: type=inline
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.component }}:${{ env.TAG }}-${{ env.PLATFORM_TAG }}
push:
needs: build
runs-on: ubuntu-latest
steps:
- name: Determine git sha to checkout
uses: haya14busa/action-cond@v1
id: gitsha
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: ${{ github.event.pull_request.head.sha }}
if_false: ${{ github.sha }}
- name: Set env
run: echo "TAG=${GIT_SHA::8}" >> $GITHUB_ENV
env:
GIT_SHA: ${{ steps.gitsha.outputs.value }}
- name: Downcase repo
run: echo "REPO_LOWER=${REPO,,}" >> $GITHUB_ENV
env:
REPO: "${{ github.repository }}"
- name: Github Container Login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create multiarch manifests
run: |
for component in solr web worker; do
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/$component:${{ env.TAG }} \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/$component:${{ env.TAG }}-amd64 \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/$component:${{ env.TAG }}-arm64
done
lint:
needs: push
uses: notch8/actions/.github/workflows/lint.yaml@v1.0.6
with:
webTarget: hyku-web
workerTarget: hyku-worker
rubocop_cmd: "bundle exec rubocop --parallel --format progress"
test:
needs: push
uses: notch8/actions/.github/workflows/test.yaml@v1.0.6
with:
confdir: "/app/samvera/hyrax-webapp/solr/conf"
rspec_cmd: "gem install semaphore_test_boosters && bundle && rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL"
reports:
if: always()
needs: [test, lint]
uses: notch8/actions/.github/workflows/report.yaml@v1.0.6