-
Notifications
You must be signed in to change notification settings - Fork 321
65 lines (55 loc) · 2.4 KB
/
pull-request.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
name: Build from Pull Request
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env:
DAZZLE_VERSION: 0.1.17
BUILDKIT_VERSION: 0.11.6
steps:
- name: 📥 Checkout workspace-images
uses: actions/checkout@v3
with:
repository: gitpod-io/workspace-images
- name: 🔧 Setup pre-commit
run: |
sudo apt-get install python3-pip shellcheck
curl -sSL https://github.com/mvdan/sh/releases/download/v3.5.0/shfmt_v3.5.0_linux_amd64 -o shfmt
sudo mv shfmt /usr/local/bin/shfmt && sudo chmod +x /usr/local/bin/shfmt
sudo pip3 install pre-commit
- name: 🤓 Run pre-commit
run: |
pre-commit run --all-files
- name: 🔆 Install dazzle
run: |
curl -sSL https://github.com/gitpod-io/dazzle/releases/download/v${{env.DAZZLE_VERSION}}/dazzle_${{env.DAZZLE_VERSION}}_Linux_x86_64.tar.gz | sudo tar -xvz -C /usr/local/bin
- name: 🏗️ Setup buildkit
run: |
curl -sSL https://github.com/moby/buildkit/releases/download/v${{env.BUILDKIT_VERSION}}/buildkit-v${{env.BUILDKIT_VERSION}}.linux-amd64.tar.gz | sudo tar xvz -C /usr
sudo buildkitd --oci-worker=true --oci-worker-net=host --debug --group docker &
sudo su -c "while ! test -S /run/buildkit/buildkitd.sock; do sleep 0.1; done"
sudo chmod +777 /run/buildkit/buildkitd.sock
# A hack as GH action does not allow you to force override cache storing if there was a cache hit
# https://github.com/actions/cache/issues/628#issuecomment-986118455
- name: 🗄️ Force Save Registry Cache Per Sha
uses: actions/cache@v3
with:
path: ~/registry
key: ${{ runner.os }}-pull-request-cache-${{ github.sha }}
- name: 🗄️ Restore Registry Cache
uses: actions/cache@v3
with:
path: ~/registry
key: ${{ runner.os }}-pull-request-cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-pull-request-cache-
- name: 📦 Setup local registry
run: |
docker run -it --detach --publish 5000:5000 --volume ~/registry:/var/lib/registry registry:2
- name: 🔨 Dazzle build
run: |
dazzle build localhost:5000/workspace-base-images
- name: 🖇️ Dazzle combine
run: |
dazzle combine localhost:5000/workspace-base-images --all