Skip to content

chore(ci): fix warnings #1732

chore(ci): fix warnings

chore(ci): fix warnings #1732

Workflow file for this run

name: Tests
on:
push:
branches: [main]
paths:
- "client/scripts/ci"
- "client/scripts/minio"
- ".github/workflows/tests.yml"
- "**/*.go"
- go.mod
schedule:
- cron: "0 8 * * *"
pull_request:
repository_dispatch:
types: [tests]
workflow_dispatch:
jobs:
tests:
name: Tests
strategy:
fail-fast: false
matrix:
directory: [server]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ matrix.directory }}/go.mod
- name: Prepare environment
run: |
# coverage directory
export TRDL_TEST_COVERAGE_DIR=$GITHUB_WORKSPACE/tests_coverage/tests/${{ matrix.os }}/${{ matrix.directory }}
mkdir -p $TRDL_TEST_COVERAGE_DIR
echo TRDL_TEST_COVERAGE_DIR=$TRDL_TEST_COVERAGE_DIR >> $GITHUB_ENV
# git user
./e2e/scripts/ci/git.sh
# install gpg
sudo apt-get update
sudo apt-get install gpg
# install git-signatures
git clone https://github.com/werf/3p-git-signatures.git
cd 3p-git-signatures
make install
echo "~/.local/bin" >> $GITHUB_PATH
# install ginkgo
go install github.com/onsi/ginkgo/v2/[email protected]
shell: bash
- name: Test
working-directory: ${{ matrix.directory }}
run: ginkgo --vet=off --race --keep-going --cover --coverpkg=./... --output-dir=$TRDL_TEST_COVERAGE_DIR ./...
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: tests_coverage
path: tests_coverage
e2e_tests:
name: End-to-end tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: e2e/go.mod
- name: Prepare environment
working-directory: e2e
run: |
# coverage directory
export TRDL_TEST_COVERAGE_DIR=$GITHUB_WORKSPACE/tests_coverage/e2e/${{ matrix.os }}
mkdir -p $TRDL_TEST_COVERAGE_DIR
echo TRDL_TEST_COVERAGE_DIR=$TRDL_TEST_COVERAGE_DIR >> $GITHUB_ENV
# coverage trdl binary
./scripts/ci/trdl_with_coverage.sh
export TRDL_TEST_BINARY_PATH=$GITHUB_WORKSPACE/e2e/bin/tests/trdl_with_coverage
chmod +x $TRDL_TEST_BINARY_PATH
echo TRDL_TEST_BINARY_PATH=$TRDL_TEST_BINARY_PATH >> $GITHUB_ENV
# git user
./scripts/ci/git.sh
# install gpg
sudo apt-get update
sudo apt-get install gpg
# install git-signatures
git clone https://github.com/werf/3p-git-signatures.git
cd 3p-git-signatures
make install
echo "~/.local/bin" >> $GITHUB_PATH
go install github.com/onsi/ginkgo/v2/[email protected]
- name: Test
working-directory: e2e
run: ginkgo -p --keep-going --cover --coverpkg=../client/...,../server/... --output-dir=$TRDL_TEST_COVERAGE_DIR ./...
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: e2e_coverage
path: tests_coverage
upload_coverage:
name: Upload coverage
needs:
- tests
- e2e_tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: e2e/go.mod
- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
path: tests_coverage
- name: Prepare environment
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
go install github.com/wadey/gocovmerge@latest
echo TRDL_TEST_COVERAGE_DIR=tests_coverage >> $GITHUB_ENV
- name: Prepare coverage file
run: |
find $TRDL_TEST_COVERAGE_DIR -type f -exec \
sed -i -e "s|/home/ubuntu/actions-runner/_work/werf/trdl|github.com/werf/trdl|g" {} +
coverage_files=$(find $TRDL_TEST_COVERAGE_DIR -type f)
gocovmerge ${coverage_files[@]} > coverage.out
- name: Format and upload
run: |
export GIT_BRANCH=${GITHUB_REF:11}
export GIT_COMMIT_SHA=$GITHUB_SHA
./cc-test-reporter format-coverage \
-t=gocov \
-p=github.com/werf/trdl/ \
coverage.out
./cc-test-reporter upload-coverage
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
notification:
name: Notification
if: always()
needs: upload_coverage
uses: ./.github/workflows/_notification.yml
secrets:
loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }}
webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }}
notificationChannel: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }}