From eca50fb6a52ecd25c2b8613ec05466934d8da99d Mon Sep 17 00:00:00 2001 From: bbrodriges Date: Tue, 1 Oct 2024 09:34:02 +0300 Subject: [PATCH] Initial commit --- .github/workflows/autotest.yml | 42 ++++++++++++++++++++++++++++++++ .github/workflows/statictest.yml | 31 +++++++++++++++++++++++ .gitignore | 25 +++++++++++++++++++ README.md | 30 +++++++++++++++++++++++ main.go | 3 +++ 5 files changed, 131 insertions(+) create mode 100644 .github/workflows/autotest.yml create mode 100644 .github/workflows/statictest.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 main.go diff --git a/.github/workflows/autotest.yml b/.github/workflows/autotest.yml new file mode 100644 index 0000000..746ac64 --- /dev/null +++ b/.github/workflows/autotest.yml @@ -0,0 +1,42 @@ +name: autotests + +on: + pull_request: + push: + +jobs: + + autotest: + runs-on: ubuntu-latest + container: golang:1.22 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Download autotests binaries + uses: robinraju/release-downloader@v1.8 + with: + repository: Yandex-Practicum/go-autotests + latest: true + fileName: "*" + out-file-path: .tools + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup autotest binary + run: | + chmod -R +x $GITHUB_WORKSPACE/.tools + mv $GITHUB_WORKSPACE/.tools/devopsmastertest /usr/local/bin/devopsmastertest + + - name: Build script binary + run: | + go build -buildvcs=false -o srvmonitor + + - name: Run autotest suite + run: | + echo -n "127.0.0.1 srv.msk01.gigacorp.local" | tee -a /etc/hosts > /dev/null + devopsmastertest \ + -test.v \ + -test.run=^TestLesson01$ \ + -binary-path=./srvmonitor + diff --git a/.github/workflows/statictest.yml b/.github/workflows/statictest.yml new file mode 100644 index 0000000..017f57d --- /dev/null +++ b/.github/workflows/statictest.yml @@ -0,0 +1,31 @@ +name: go vet test + +on: + pull_request: + push: + +jobs: + statictest: + runs-on: ubuntu-latest + container: golang:1.22 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Download statictest binary + uses: robinraju/release-downloader@v1.8 + with: + repository: Yandex-Practicum/go-autotests + latest: true + fileName: statictest + out-file-path: .tools + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup autotest binary + run: | + chmod -R +x $GITHUB_WORKSPACE/.tools/statictest + mv $GITHUB_WORKSPACE/.tools/statictest /usr/local/bin/statictest + + - name: Run statictest + run: | + go vet -vettool=$(which statictest) ./... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f72f89 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work +go.work.sum + +# env file +.env diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a37a73 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# go-devops-engineer-magistr-lesson1-tpl + +Шаблон репозитория для практического задания курса "DevOps-инженер облачных сервисов" + +## Начало работы + +1. Склонируйте репозиторий в любую подходящую директорию на вашем компьютере. +2. В корне репозитория выполните команду `go mod init ` (где `` — адрес вашего репозитория на GitHub без префикса `https://`) для создания модуля. + +## Обновление шаблона + +Чтобы иметь возможность получать обновления автотестов и других частей шаблона, выполните команду: + +``` +git remote add -m main template https://github.com/Yandex-Practicum/go-devops-engineer-magistr-lesson1-tpl.git +``` + +Для обновления кода автотестов выполните команду: + +``` +git fetch template && git checkout template/main .github +``` + +Затем добавьте полученные изменения в свой репозиторий. + +## Запуск автотестов + +Автотесты запускаются на любой коммит в репозиторий. + +Подробнее про локальный и автоматический запуск читайте в [README автотестов](https://github.com/Yandex-Practicum/go-autotests). diff --git a/main.go b/main.go new file mode 100644 index 0000000..38dd16d --- /dev/null +++ b/main.go @@ -0,0 +1,3 @@ +package main + +func main() {}