2023-09-28 13:59:52 -05:00
|
|
|
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
|
2024-09-30 13:24:24 -05:00
|
|
|
runs-on: ubuntu-latest
|
2023-09-28 13:59:52 -05:00
|
|
|
steps:
|
|
|
|
- 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: 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
|
2024-01-29 18:30:41 -05:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-09-28 13:59:52 -05:00
|
|
|
with:
|
|
|
|
name: coverage-minimal
|
|
|
|
path: coverage-minimal.txt
|
|
|
|
- uses: ./.github/actions/teardown-localstack
|
|
|
|
test-run-extensions:
|
|
|
|
name: Run zot with extensions tests
|
2024-07-23 01:12:40 -05:00
|
|
|
runs-on: ubuntu-latest-16-cores
|
2023-09-28 13:59:52 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
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: 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
|
2024-01-29 18:30:41 -05:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-09-28 13:59:52 -05:00
|
|
|
with:
|
|
|
|
name: coverage-extended
|
|
|
|
path: coverage-extended.txt
|
|
|
|
- uses: ./.github/actions/teardown-localstack
|
|
|
|
test-run-devmode:
|
|
|
|
name: Running privileged tests on Linux
|
2024-09-30 13:24:24 -05:00
|
|
|
runs-on: ubuntu-latest
|
2023-09-28 13:59:52 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
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: 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
|
2024-01-29 18:30:41 -05:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-09-28 13:59:52 -05:00
|
|
|
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
|
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: download all workflow coverage files
|
2024-01-29 18:30:41 -05:00
|
|
|
uses: actions/download-artifact@v4
|
2023-09-28 13:59:52 -05:00
|
|
|
- name: merge code coverage
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
cp coverage-minimal/* .
|
|
|
|
cp coverage-extended/* .
|
|
|
|
cp coverage-devmode/* .
|
|
|
|
make covhtml
|
|
|
|
- name: upload code coverage
|
2024-11-18 23:27:37 -05:00
|
|
|
uses: codecov/codecov-action@v5
|
2023-09-28 13:59:52 -05:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
|