mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
375c35c5a1
* chore: update to go 1.22 Only go toolchain version is updated. We compile with go 1.22, but we allow others to compile using language version 1.21 if they wish to. If we also updated the go version in go.mod everyone would be forced to update, as that is enforced as a minimum allowed version. This comment explains the difference well enough https://news.ycombinator.com/item?id=36455759 Signed-off-by: Andrei Aaron <aaaron@luxoft.com> * chore: fix freeBSD AMD64 build Looks like they made some cleanup in the logic allowing buildmode pie on various platforms. Related to https://github.com/golang/go/issues/31544 See the code at: https://cs.opensource.google/go/go/+/master:src/internal/platform/supported.go;l=222-231;drc=d7fcb5cf80953f1d63246f1ae9defa60c5ce2d76;bpv=1;bpt=0 Signed-off-by: Andrei Aaron <aaaron@luxoft.com> --------- Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
150 lines
4.4 KiB
YAML
150 lines
4.4 KiB
YAML
name: "Running tests"
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches: [main]
|
|
release:
|
|
types:
|
|
- published
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
test-run-minimal:
|
|
name: Running zot without extensions tests
|
|
runs-on: ubuntu-latest-16-cores
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
cache: false
|
|
go-version: 1.22.x
|
|
- name: Cache go dependencies
|
|
id: cache-go-dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-mod-
|
|
- name: Install go dependencies
|
|
if: steps.cache-go-dependencies.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd $GITHUB_WORKSPACE
|
|
go mod download
|
|
- uses: ./.github/actions/setup-localstack
|
|
- name: run zot minimal tests
|
|
run: |
|
|
cd $GITHUB_WORKSPACE
|
|
make test-minimal
|
|
env:
|
|
S3MOCK_ENDPOINT: localhost:4566
|
|
DYNAMODBMOCK_ENDPOINT: http://localhost:4566
|
|
AWS_ACCESS_KEY_ID: fake
|
|
AWS_SECRET_ACCESS_KEY: fake
|
|
- name: upload coverage
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-minimal
|
|
path: coverage-minimal.txt
|
|
- uses: ./.github/actions/teardown-localstack
|
|
test-run-extensions:
|
|
name: Run zot with extensions tests
|
|
runs-on: ubuntu-latest-16-cores
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
cache: false
|
|
go-version: 1.22.x
|
|
- name: Cache go dependencies
|
|
id: cache-go-dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-mod-
|
|
- name: Install go dependencies
|
|
if: steps.cache-go-dependencies.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd $GITHUB_WORKSPACE
|
|
go mod download
|
|
- uses: ./.github/actions/setup-localstack
|
|
- name: run zot extended tests
|
|
run: |
|
|
cd $GITHUB_WORKSPACE
|
|
make test-extended
|
|
env:
|
|
S3MOCK_ENDPOINT: localhost:4566
|
|
DYNAMODBMOCK_ENDPOINT: http://localhost:4566
|
|
AWS_ACCESS_KEY_ID: fake
|
|
AWS_SECRET_ACCESS_KEY: fake
|
|
- name: upload coverage
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-extended
|
|
path: coverage-extended.txt
|
|
- uses: ./.github/actions/teardown-localstack
|
|
test-run-devmode:
|
|
name: Running privileged tests on Linux
|
|
runs-on: ubuntu-latest-16-cores
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
cache: false
|
|
go-version: 1.22.x
|
|
- name: Cache go dependencies
|
|
id: cache-go-dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-mod-
|
|
- name: Install go dependencies
|
|
if: steps.cache-go-dependencies.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd $GITHUB_WORKSPACE
|
|
go mod download
|
|
- name: run zot development-mode unit tests (possibly using failure injection)
|
|
run: make test-devmode
|
|
- name: run zot privileged tests
|
|
run: sudo env "PATH=$PATH" make privileged-test
|
|
- name: upload coverage
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-devmode
|
|
path: coverage-dev-*.txt
|
|
test-coverage:
|
|
name: Collect all test coverage
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
needs: [test-run-minimal,test-run-extensions,test-run-devmode]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
cache: false
|
|
go-version: 1.22.x
|
|
- name: download all workflow coverage files
|
|
uses: actions/download-artifact@v4
|
|
- name: merge code coverage
|
|
run: |
|
|
cd $GITHUB_WORKSPACE
|
|
cp coverage-minimal/* .
|
|
cp coverage-extended/* .
|
|
cp coverage-devmode/* .
|
|
make covhtml
|
|
- name: upload code coverage
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|