2023-09-28 13:59:52 -05:00
|
|
|
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
|
2023-11-15 13:44:31 -05:00
|
|
|
runs-on: ubuntu-latest
|
2023-09-28 13:59:52 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [linux, darwin, freebsd]
|
|
|
|
arch: [amd64, arm64]
|
|
|
|
steps:
|
|
|
|
- name: Check out source code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install go
|
2023-12-12 05:44:28 -05:00
|
|
|
uses: actions/setup-go@v5
|
2023-09-28 13:59:52 -05:00
|
|
|
with:
|
|
|
|
cache: false
|
2024-11-08 11:58:55 -05:00
|
|
|
go-version: 1.23.x
|
2023-09-28 13:59:52 -05:00
|
|
|
- name: Cache go dependencies
|
|
|
|
id: cache-go-dependencies
|
2024-01-29 18:30:41 -05:00
|
|
|
uses: actions/cache@v4
|
2023-09-28 13:59:52 -05:00
|
|
|
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
|
2024-01-29 18:30:41 -05:00
|
|
|
uses: actions/cache@v4
|
2023-09-28 13:59:52 -05:00
|
|
|
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
|
2024-02-07 13:54:28 -05:00
|
|
|
go install github.com/swaggo/swag/cmd/swag@v1.16.2
|
2023-09-28 13:59:52 -05:00
|
|
|
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
|
|
|
|
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
|
2023-11-15 13:44:31 -05:00
|
|
|
timeout-minutes: 10
|
2023-09-28 13:59:52 -05:00
|
|
|
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
|
|
|
|
|
|
|
|
- if: github.event_name == 'release' && github.event.action == 'published'
|
|
|
|
name: Publish artifacts on releases
|
|
|
|
uses: svenstaro/upload-release-action@v2
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
file: bin/z*
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|
|
|
|
file_glob: true
|
2024-02-05 13:19:48 -05:00
|
|
|
|
|
|
|
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
|
2024-07-01 15:29:39 -05:00
|
|
|
uses: robinraju/release-downloader@v1.11
|
2024-02-05 13:19:48 -05:00
|
|
|
with:
|
|
|
|
tag: ${{ github.ref_name }}
|
|
|
|
fileName: "z*"
|
|
|
|
- name: Generate checksum
|
|
|
|
uses: jmgilman/actions-generate-checksum@v1
|
|
|
|
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@v2
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
file: checksums.sha256.txt
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|