mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
96226af869
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
110 lines
3.4 KiB
YAML
110 lines
3.4 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
release:
|
|
types:
|
|
- published
|
|
name: build-test
|
|
jobs:
|
|
build-test:
|
|
name: Build and test ZOT
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
s3mock:
|
|
image: localstack/localstack-full
|
|
env:
|
|
SERVICES: s3
|
|
ports:
|
|
- 4563-4599:4563-4599
|
|
- 9090:8080
|
|
steps:
|
|
- name: Install go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.16.x
|
|
|
|
- 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
|
|
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
|
|
|
|
- name: Run build and test
|
|
timeout-minutes: 30
|
|
run: |
|
|
cd $GITHUB_WORKSPACE && make
|
|
env:
|
|
S3MOCK_ENDPOINT: localhost:4566
|
|
AWS_ACCESS_KEY_ID: fake
|
|
AWS_SECRET_ACCESS_KEY: fake
|
|
|
|
- name: Upload code coverage
|
|
uses: codecov/codecov-action@v1
|
|
|
|
- if: github.event_name == 'release' && github.event.action == 'published'
|
|
name: Publish artifacts on releases
|
|
uses: Roang-zero1/github-upload-release-artifacts-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
args: bin/zot*
|
|
|
|
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:
|
|
push: true
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
|
ghcr.io/${{ github.repository }}:latest
|
|
- name: Build minimal container image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
push: true
|
|
file: Dockerfile-minimal
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}-minimal:${{ github.event.release.tag_name }}
|
|
ghcr.io/${{ github.repository }}-minimal:latest
|
|
- name: Build container image (arm64)
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
build-args: ARCH=arm64
|
|
push: true
|
|
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:
|
|
build-args: ARCH=arm64
|
|
push: true
|
|
file: Dockerfile-minimal
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}-arm64-minimal:${{ github.event.release.tag_name }}
|
|
ghcr.io/${{ github.repository }}-arm64-minimal:latest
|