mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
fix: reduce test run time (#1832)
Signed-off-by: Alexei Dodon <adodon@cisco.com>
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
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]
|
||||
arch: [amd64, arm64]
|
||||
steps:
|
||||
- name: Check out source code
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/clean-runner
|
||||
- name: Install go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
cache: false
|
||||
go-version: 1.20.x
|
||||
- name: Cache go dependencies
|
||||
id: cache-go-dependencies
|
||||
uses: actions/cache@v3
|
||||
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@v3
|
||||
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.8.12
|
||||
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
|
||||
- uses: ./.github/actions/check-diskspace
|
||||
- name: Run build
|
||||
timeout-minutes: 80
|
||||
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 }}
|
||||
- uses: ./.github/actions/check-diskspace
|
||||
|
||||
- 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
|
||||
Reference in New Issue
Block a user