2021-06-28 04:45:29 -05:00
|
|
|
on:
|
|
|
|
push:
|
2022-01-06 15:21:44 -05:00
|
|
|
branches:
|
2021-10-21 13:13:14 -05:00
|
|
|
- main
|
2021-06-28 04:45:29 -05:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2021-10-21 13:13:14 -05:00
|
|
|
- main
|
2021-06-28 04:45:29 -05:00
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
|
|
|
name: build-test
|
|
|
|
jobs:
|
|
|
|
build-test:
|
2021-12-03 22:50:58 -05:00
|
|
|
name: Build and test ZOT
|
2021-06-28 04:45:29 -05:00
|
|
|
runs-on: ubuntu-latest
|
2021-07-16 22:53:05 -05:00
|
|
|
services:
|
|
|
|
s3mock:
|
2021-12-13 14:23:31 -05:00
|
|
|
image: ghcr.io/project-zot/localstack/localstack:0.13.2
|
2021-07-16 22:53:05 -05:00
|
|
|
env:
|
|
|
|
SERVICES: s3
|
|
|
|
ports:
|
|
|
|
- 4563-4599:4563-4599
|
|
|
|
- 9090:8080
|
2021-06-28 04:45:29 -05:00
|
|
|
steps:
|
|
|
|
- name: Install go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2022-01-06 15:21:44 -05:00
|
|
|
go-version: 1.17.x
|
2021-06-28 04:45:29 -05:00
|
|
|
|
|
|
|
- name: Check out source code
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
go get -u github.com/swaggo/swag/cmd/swag
|
|
|
|
go mod download
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install rpm
|
|
|
|
sudo apt install snapd
|
|
|
|
sudo snap install skopeo --edge --devmode
|
2021-10-29 21:10:55 -05:00
|
|
|
curl -Lo notation.tar.gz https://github.com/notaryproject/notation/releases/download/v0.7.1-alpha.1/notation_0.7.1-alpha.1_linux_amd64.tar.gz
|
|
|
|
sudo tar xvzf notation.tar.gz -C /usr/bin notation
|
|
|
|
go get github.com/wadey/gocovmerge
|
2021-06-28 04:45:29 -05:00
|
|
|
|
|
|
|
- name: Run build and test
|
2021-12-20 23:18:13 -05:00
|
|
|
timeout-minutes: 60
|
2021-06-28 04:45:29 -05:00
|
|
|
run: |
|
2021-12-15 17:14:53 -05:00
|
|
|
cd $GITHUB_WORKSPACE && make && make ARCH=arm64 binary-arch-minimal && make ARCH=arm64 binary-arch
|
2021-07-16 22:53:05 -05:00
|
|
|
env:
|
|
|
|
S3MOCK_ENDPOINT: localhost:4566
|
|
|
|
AWS_ACCESS_KEY_ID: fake
|
|
|
|
AWS_SECRET_ACCESS_KEY: fake
|
2021-06-28 04:45:29 -05:00
|
|
|
|
|
|
|
- name: Upload code coverage
|
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
|
|
|
|
- if: github.event_name == 'release' && github.event.action == 'published'
|
|
|
|
name: Publish artifacts on releases
|
2021-12-15 17:14:53 -05:00
|
|
|
uses: svenstaro/upload-release-action@v2
|
2021-06-28 04:45:29 -05:00
|
|
|
with:
|
2021-12-15 17:14:53 -05:00
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
2022-01-10 20:15:35 -05:00
|
|
|
file: bin/z*
|
2021-12-15 17:14:53 -05:00
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|
|
|
|
file_glob: true
|
2021-06-28 04:45:29 -05:00
|
|
|
|
|
|
|
push-image:
|
|
|
|
if: github.event_name == 'release' && github.event.action== 'published'
|
|
|
|
name: Push Docker image to GitHub Packages
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out the repo
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Log in to GitHub Docker Registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build container image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-12-15 17:47:53 -05:00
|
|
|
build-args: |
|
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
2021-06-28 04:45:29 -05:00
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
|
|
|
ghcr.io/${{ github.repository }}:latest
|
2021-06-30 19:19:16 -05:00
|
|
|
- name: Build minimal container image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-12-15 17:47:53 -05:00
|
|
|
build-args: |
|
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
2021-06-30 19:19:16 -05:00
|
|
|
push: true
|
2021-07-01 12:28:23 -05:00
|
|
|
file: Dockerfile-minimal
|
2021-06-30 19:19:16 -05:00
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}-minimal:${{ github.event.release.tag_name }}
|
|
|
|
ghcr.io/${{ github.repository }}-minimal:latest
|
2022-01-17 09:36:13 -05:00
|
|
|
- name: Build zot-exporter container image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
build-args: |
|
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
|
|
|
push: true
|
|
|
|
file: Dockerfile-zxp
|
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}-zxp:${{ github.event.release.tag_name }}
|
|
|
|
ghcr.io/${{ github.repository }}-zxp:latest
|
|
|
|
- name: Build zot-exporter container image (arm64)
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
build-args: |
|
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
|
|
|
ARCH=arm64
|
|
|
|
push: true
|
|
|
|
file: Dockerfile-arch-zxp
|
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}-arm64-zxp:${{ github.event.release.tag_name }}
|
|
|
|
ghcr.io/${{ github.repository }}-arm64-zxp:latest
|
2021-12-03 12:42:03 -05:00
|
|
|
- name: Build container image (arm64)
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-12-15 17:47:53 -05:00
|
|
|
build-args: |
|
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
|
|
|
ARCH=arm64
|
2021-12-03 12:42:03 -05:00
|
|
|
push: true
|
2021-12-08 14:47:47 -05:00
|
|
|
file: Dockerfile-arch
|
2021-12-03 12:42:03 -05:00
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}-arm64:${{ github.event.release.tag_name }}
|
|
|
|
ghcr.io/${{ github.repository }}-arm64:latest
|
|
|
|
- name: Build minimal container image (arm64)
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-12-15 17:47:53 -05:00
|
|
|
build-args: |
|
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
|
|
|
ARCH=arm64
|
2021-12-03 12:42:03 -05:00
|
|
|
push: true
|
2021-12-08 14:47:47 -05:00
|
|
|
file: Dockerfile-arch-minimal
|
2021-12-03 12:42:03 -05:00
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}-arm64-minimal:${{ github.event.release.tag_name }}
|
|
|
|
ghcr.io/${{ github.repository }}-arm64-minimal:latest
|
2022-01-19 02:12:48 -05:00
|
|
|
- name: Build container image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
build-args: |
|
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
|
|
|
push: true
|
|
|
|
file: Dockerfile-zb
|
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
|
|
|
ghcr.io/${{ github.repository }}:latest
|
|
|
|
- name: Build container image (arm64)
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
build-args: |
|
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
|
|
|
ARCH=arm64
|
|
|
|
push: true
|
|
|
|
file: Dockerfile-arch-zb
|
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}-arm64:${{ github.event.release.tag_name }}
|
|
|
|
ghcr.io/${{ github.repository }}-arm64:latest
|