✨ Support update builder (#193) #872
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test CI | |
on: | |
push: | |
branches: | |
- main | |
- gh-readonly-queue/main/* | |
pull_request: | |
branches: | |
- main | |
jobs: | |
unit-test-sqlite3: | |
name: unit-test-sqlite3 | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
go: ["1.20"] | |
node: ["18"] | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: sigma | |
MYSQL_DATABASE: sigma | |
MYSQL_USER: sigma | |
MYSQL_PASSWORD: sigma | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 | |
postgresql: | |
image: postgres:15-alpine | |
env: | |
POSTGRES_PASSWORD: sigma | |
POSTGRES_USER: sigma | |
POSTGRES_DB: sigma | |
ports: | |
- 5432:5432 | |
options: --health-cmd="pg_isready -U sigma -d sigma || exit 1" --health-interval=10s --health-timeout=5s --health-retries=10 | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Setup golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: "yarn" | |
cache-dependency-path: "web/yarn.lock" | |
- name: Build web | |
run: | | |
cd web | |
yarn install --frozen-lockfile | |
yarn build | |
- name: Setup minio | |
run: | | |
./scripts/run_minio.sh | |
sleep 5 | |
- name: Download cache | |
uses: actions/cache@v3 | |
with: | |
path: /home/runner/.cache/go-build | |
key: ${{ runner.os }}-go-test-sqlite3-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-go-test-sqlite3- | |
- name: Run tests | |
env: | |
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_SQLITE }} | |
COS_AK: ${{ secrets.COS_AK }} | |
COS_SK: ${{ secrets.COS_SK }} | |
run: | | |
CI_DATABASE_TYPE=sqlite3 go test -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"` | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unit-test-sqlite3 | |
unit-test-postgresql: | |
name: unit-test-postgresql | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
go: ["1.20"] | |
node: ["18"] | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: sigma | |
MYSQL_DATABASE: sigma | |
MYSQL_USER: sigma | |
MYSQL_PASSWORD: sigma | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 | |
postgresql: | |
image: postgres:15-alpine | |
env: | |
POSTGRES_PASSWORD: sigma | |
POSTGRES_USER: sigma | |
POSTGRES_DB: sigma | |
ports: | |
- 5432:5432 | |
options: --health-cmd="pg_isready -U sigma -d sigma || exit 1" --health-interval=10s --health-timeout=5s --health-retries=10 | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Setup golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: "yarn" | |
cache-dependency-path: "web/yarn.lock" | |
- name: Build web | |
run: | | |
cd web | |
yarn install --frozen-lockfile | |
yarn build | |
- name: Setup minio | |
run: | | |
./scripts/run_minio.sh | |
sleep 5 | |
- name: Download cache | |
uses: actions/cache@v3 | |
with: | |
path: /home/runner/.cache/go-build | |
key: ${{ runner.os }}-go-test-postgresql-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-go-test-postgresql- | |
- name: Run tests | |
env: | |
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_POSTGRESQL }} | |
COS_AK: ${{ secrets.COS_AK }} | |
COS_SK: ${{ secrets.COS_SK }} | |
run: | | |
CI_DATABASE_TYPE=postgresql go test -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"` | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unit-test-postgresql | |
unit-test-mysql: | |
name: unit-test-mysql | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
go: ["1.20"] | |
node: ["18"] | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: sigma | |
MYSQL_DATABASE: sigma | |
MYSQL_USER: sigma | |
MYSQL_PASSWORD: sigma | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 | |
postgresql: | |
image: postgres:15-alpine | |
env: | |
POSTGRES_PASSWORD: sigma | |
POSTGRES_USER: sigma | |
POSTGRES_DB: sigma | |
ports: | |
- 5432:5432 | |
options: --health-cmd="pg_isready -U sigma -d sigma || exit 1" --health-interval=10s --health-timeout=5s --health-retries=10 | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Setup golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: "yarn" | |
cache-dependency-path: "web/yarn.lock" | |
- name: Build web | |
run: | | |
cd web | |
yarn install --frozen-lockfile | |
yarn build | |
- name: Setup minio | |
run: | | |
./scripts/run_minio.sh | |
sleep 5 | |
- name: Download cache | |
uses: actions/cache@v3 | |
with: | |
path: /home/runner/.cache/go-build | |
key: ${{ runner.os }}-go-test-mysql-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-go-test-mysql- | |
- name: Run tests | |
env: | |
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT_MYSQL }} | |
COS_AK: ${{ secrets.COS_AK }} | |
COS_SK: ${{ secrets.COS_SK }} | |
run: | | |
CI_DATABASE_TYPE=mysql go test -timeout 30m -v -coverprofile=coverage.txt -covermode=atomic `go list ./... | grep -v "pkg/tests" | grep -v "pkg/dal/query" | grep -v "pkg/dal/cmd" | grep -v "pkg/types/enums" | grep -v "pkg/handlers/apidocs" | grep -v "pkg/utils/token/mocks" | grep -v "pkg/utils/password/mocks" | grep -v "pkg/handlers/distribution/clients/mocks"` | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unit-test-mysql |