-
Notifications
You must be signed in to change notification settings - Fork 258
138 lines (132 loc) · 5.08 KB
/
Copy pathbuild.yaml
File metadata and controls
138 lines (132 loc) · 5.08 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
137
138
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
name: build
permissions: read-all
jobs:
build-arch:
name: Build ZOT multiarch
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux, darwin, freebsd, windows]
arch: [amd64, arm64]
steps:
- name: Check out source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
cache: false
check-latest: true
go-version: 1.26.x
- name: Cache go dependencies
id: cache-go-dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Cache go build output
id: cache-go-build
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
key: ${{ matrix.os }}-${{ matrix.arch }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.arch }}-go-build-
- name: Install go dependencies
if: steps.cache-go-dependencies.outputs.cache-hit != 'true'
run: |
cd $GITHUB_WORKSPACE
go mod download
- name: Install other dependencies
run: |
cd $GITHUB_WORKSPACE
go install github.com/swaggo/swag/cmd/swag@v1.16.2
sudo apt-get update
sudo apt-get install rpm
sudo apt-get install snapd
sudo apt-get install libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config python3-jsonschema
git clone https://github.com/containers/skopeo -b v1.12.0 $GITHUB_WORKSPACE/src/github.com/containers/skopeo
cd $GITHUB_WORKSPACE/src/github.com/containers/skopeo && \
make bin/skopeo && \
sudo cp bin/skopeo /usr/bin && \
rm -rf $GITHUB_WORKSPACE/src/github.com/containers/skopeo
cd $GITHUB_WORKSPACE
curl -Lo notation.tar.gz https://github.com/notaryproject/notation/releases/download/v1.0.0-rc.4/notation_1.0.0-rc.4_linux_amd64.tar.gz
sudo tar xvzf notation.tar.gz -C /usr/bin notation
rm -f notation.tar.gz
- name: Run build
timeout-minutes: 10
run: |
echo "Building for $OS:$ARCH"
cd $GITHUB_WORKSPACE
make binary binary-minimal binary-debug cli bench exporter-minimal
env:
OS: ${{ matrix.os }}
ARCH: ${{ matrix.arch }}
- name: Generate GraphQL Introspection JSON on Release
if: github.event_name == 'release' && github.event.action == 'published' && matrix.os == 'linux' && matrix.arch == 'amd64'
run: |
bin/zot-linux-amd64 serve examples/config-search.json &
sleep 10
curl -X POST -H "Content-Type: application/json" -d @.pkg/debug/githubWorkflows/introspection-query.json http://localhost:5000/v2/_zot/ext/search | jq > bin/zot-gql-introspection-result.json
pkill zot
- name: Generate zot config schema on Release
if: github.event_name == 'release' && github.event.action == 'published' && matrix.os == 'linux' && matrix.arch == 'amd64'
run: |
make verify-config-schema
- if: github.event_name == 'release' && github.event.action == 'published'
name: Publish artifacts on releases
uses: svenstaro/upload-release-action@29e53e917877a24fad85510ded594ab3c9ca12de # latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/z*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
release-checksums:
name: Release Artifact Checksums
needs: build-arch
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Download Release Artifacts
uses: robinraju/release-downloader@28fc21f50d76778e7023361aa1f863e717d3d56f # v1
with:
tag: ${{ github.ref_name }}
fileName: "z*"
- name: Generate checksum
uses: jmgilman/actions-generate-checksum@3ea6dc9bf8eecf28e2ecc982fab683484a1a8561 # v1.0.1
with:
patterns: z*
method: sha256
output: checksums.sha256.txt
- name: Add wildcard character prefix to filenames in checksum file
run: sed -i 's! ! \*!g' checksums.sha256.txt
- name: Publish checksums on releases
uses: svenstaro/upload-release-action@29e53e917877a24fad85510ded594ab3c9ca12de # latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: checksums.sha256.txt
tag: ${{ github.ref }}
overwrite: true