Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
282 changes: 266 additions & 16 deletions .github/workflows/shortenertest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ on:

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.17
container: golang:1.18
needs: branchtest

services:
postgres:
Expand All @@ -31,7 +40,7 @@ jobs:
- name: Download autotests binaries
uses: robinraju/[email protected]
with:
repository: Yandex-Practicum/go-autotests-bin
repository: Yandex-Practicum/go-autotests
latest: true
fileName: "*"
out-file-path: .tools
Expand All @@ -48,30 +57,110 @@ jobs:
go build -o shortener

- name: "Code increment #1"
if: always()
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'
run: |
shortenertest -test.v -test.run=^TestIteration1$ \
-binary-path=cmd/shortener/shortener

- name: "Code increment #2"
if: always()
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'
run: |
shortenertest -test.v -test.run=^TestIteration2$ -source-path=.

- name: "Code increment #3"
if: always()
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'
run: |
shortenertest -test.v -test.run=^TestIteration3$ -source-path=.

- name: "Code increment #4"
if: always()
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'
run: |
shortenertest -test.v -test.run=^TestIteration4$ \
-source-path=. \
-binary-path=cmd/shortener/shortener

- name: "Code increment #5"
if: always()
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'
run: |
SERVER_HOST=$(random domain)
SERVER_PORT=$(random unused-port)
Expand All @@ -82,7 +171,20 @@ jobs:
-server-base-url="http://$SERVER_HOST:$SERVER_PORT"

- name: "Code increment #6"
if: always()
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'
run: |
SERVER_PORT=$(random unused-port)
TEMP_FILE=$(random tempfile)
Expand All @@ -93,7 +195,19 @@ jobs:
-source-path=.

- name: "Code increment #7"
if: always()
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'
run: |
SERVER_PORT=$(random unused-port)
TEMP_FILE=$(random tempfile)
Expand All @@ -104,51 +218,187 @@ jobs:
-source-path=.

- name: "Code increment #8"
if: always()
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'
run: |
shortenertest -test.v -test.run=^TestIteration8$ \
-source-path=. \
-binary-path=cmd/shortener/shortener

- name: "Code increment #9"
if: always()
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'
run: |
shortenertest -test.v -test.run=^TestIteration9$ \
-source-path=. \
-binary-path=cmd/shortener/shortener

- name: "Code increment #10"
if: always()
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'
run: |
shortenertest -test.v -test.run=^TestIteration10$ \
-source-path=. \
-binary-path=cmd/shortener/shortener \
-database-dsn='postgres://postgres:postgres@postgres:5432/praktikum?sslmode=disable'

- name: "Code increment #11"
if: always()
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'
run: |
shortenertest -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: always()
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'
run: |
shortenertest -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: always()
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'
run: |
shortenertest -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: always()
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17'
run: |
shortenertest -test.v -test.run=^TestIteration14$ \
-binary-path=cmd/shortener/shortener \
-database-dsn='postgres://postgres:postgres@postgres:5432/praktikum?sslmode=disable'

- name: "Code increment #14 (degradation)"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17'
run: |
shortenertest -test.v -test.run=^TestIteration14$ \
-binary-path=cmd/shortener/shortener

- name: "Code increment #14 (race detection)"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17'
run: |
go test -v -race ./...

- name: "Code increment #15"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter15' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17'
run: |
shortenertest -test.v -test.run=^TestIteration15$ -source-path=.

- name: "Code increment #16"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter16' ||
github.head_ref == 'iter17'
run: |
shortenertest -test.v -test.run=^TestIteration16$ -source-path=.

- name: "Code increment #17"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter17'
run: |
shortenertest -test.v -test.run=^TestIteration17$ -source-path=.

- name: "Code increment #18"
if: github.repository == ''
run: |
echo "Not implemented"

- name: "Code increment #19"
if: github.repository == ''
run: |
echo "Not implemented"

- name: "Code increment #20"
if: github.repository == ''
run: |
echo "Not implemented"

- name: "Code increment #21"
if: github.repository == ''
run: |
echo "Not implemented"

- name: "Code increment #22"
if: github.repository == ''
run: |
echo "Not implemented"

- name: "Code increment #23"
if: github.repository == ''
run: |
echo "Not implemented"

- name: "Code increment #24"
if: github.repository == ''
run: |
echo "Not implemented"
Loading