Skip to content

Iter6

Iter6 #24

Workflow file for this run

name: autotests
on:
pull_request:
push:
branches:
- main
jobs:
branchtest:
runs-on: ubuntu-latest
steps:
- name: Check branch name
run: |
if [[ ! $GITHUB_HEAD_REF =~ ^iter[0-9]+$ ]]; then echo "Branch name must match pattern 'iter<number>'" && exit 1; fi
shortenertest:
runs-on: ubuntu-latest
container: golang:1.21
needs: branchtest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: praktikum
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download autotests binaries
uses: robinraju/release-downloader@v1.7
with:
repository: Yandex-Practicum/go-autotests
tag: refactor
fileName: "*"
out-file-path: .tools
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup autotest binary
run: |
chmod -R +x $GITHUB_WORKSPACE/.tools
mv $GITHUB_WORKSPACE/.tools/shortenertestbeta /usr/local/bin/shortenertestbeta
mv $GITHUB_WORKSPACE/.tools/random /usr/local/bin/random
- name: Setup go deps
run: |
go install golang.org/x/tools/cmd/goimports@latest
- name: Build server binary
run: |
cd cmd/shortener
go build -buildvcs=false -o shortener
- name: "Code increment #1"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter1' ||
github.head_ref == 'iter2' ||
github.head_ref == 'iter3' ||
github.head_ref == 'iter4' ||
github.head_ref == 'iter5' ||
github.head_ref == 'iter6' ||
github.head_ref == 'iter7' ||
github.head_ref == 'iter8' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration1$ \
-binary-path=cmd/shortener/shortener
- name: "Code increment #2"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter2' ||
github.head_ref == 'iter3' ||
github.head_ref == 'iter4' ||
github.head_ref == 'iter5' ||
github.head_ref == 'iter6' ||
github.head_ref == 'iter7' ||
github.head_ref == 'iter8' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration2$ -source-path=.
- name: "Code increment #3"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter3' ||
github.head_ref == 'iter4' ||
github.head_ref == 'iter5' ||
github.head_ref == 'iter6' ||
github.head_ref == 'iter7' ||
github.head_ref == 'iter8' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration3$ -source-path=.
- name: "Code increment #4"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter4' ||
github.head_ref == 'iter5' ||
github.head_ref == 'iter6' ||
github.head_ref == 'iter7' ||
github.head_ref == 'iter8' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
SERVER_PORT=$(random unused-port)
shortenertestbeta -test.v -test.run=^TestIteration4$ \
-binary-path=cmd/shortener/shortener \
-server-port=$SERVER_PORT
- name: "Code increment #5"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter5' ||
github.head_ref == 'iter6' ||
github.head_ref == 'iter7' ||
github.head_ref == 'iter8' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
SERVER_PORT=$(random unused-port)
shortenertestbeta -test.v -test.run=^TestIteration5$ \
-binary-path=cmd/shortener/shortener \
-server-port=$SERVER_PORT
- name: "Code increment #6"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter6' ||
github.head_ref == 'iter7' ||
github.head_ref == 'iter8' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration6$ \
-source-path=.
- name: "Code increment #7"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter7' ||
github.head_ref == 'iter8' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration7$ \
-binary-path=cmd/shortener/shortener \
-source-path=.
- name: "Code increment #8"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter8' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration8$ \
-binary-path=cmd/shortener/shortener
- name: "Code increment #9"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter9' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
TEMP_FILE=$(random tempfile)
shortenertestbeta -test.v -test.run=^TestIteration9$ \
-binary-path=cmd/shortener/shortener \
-source-path=. \
-file-storage-path=$TEMP_FILE
- name: "Code increment #10"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter10' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration10$ \
-binary-path=cmd/shortener/shortener \
-source-path=. \
-database-dsn='postgres://postgres:postgres@postgres:5432/praktikum?sslmode=disable'
- name: "Code increment #11"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration11$ \
-binary-path=cmd/shortener/shortener \
-database-dsn='postgres://postgres:postgres@postgres:5432/praktikum?sslmode=disable'
- name: "Code increment #12"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration12$ \
-binary-path=cmd/shortener/shortener \
-database-dsn='postgres://postgres:postgres@postgres:5432/praktikum?sslmode=disable'
- name: "Code increment #13"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration13$ \
-binary-path=cmd/shortener/shortener \
-database-dsn='postgres://postgres:postgres@postgres:5432/praktikum?sslmode=disable'
- name: "Code increment #14"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration14$ \
-binary-path=cmd/shortener/shortener \
-database-dsn='postgres://postgres:postgres@postgres:5432/praktikum?sslmode=disable'
- name: "Code increment #15"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration15$ \
-binary-path=cmd/shortener/shortener \
-database-dsn='postgres://postgres:postgres@postgres:5432/praktikum?sslmode=disable'
- name: "Code increment #16"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration16$ \
-source-path=. \
- name: "Code increment #17"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter17' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration17$ \
-source-path=. \
- name: "Code increment #18"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter18' ||
github.head_ref == 'iter19' ||
github.head_ref == 'iter20' ||
github.head_ref == 'iter21' ||
github.head_ref == 'iter22' ||
github.head_ref == 'iter23' ||
github.head_ref == 'iter24'
run: |
shortenertestbeta -test.v -test.run=^TestIteration18$ \
-source-path=. \