Automated API tests #35
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: Automated API tests | |
on: | |
workflow_dispatch: | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4.1.6 | |
- name: Set up Go | |
uses: actions/setup-go@v5.0.1 | |
with: | |
go-version: '1.22.4' | |
- name: Cache Go modules | |
uses: actions/cache@v4.0.2 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Install Gonkey | |
run: go install github.com/lamoda/gonkey@latest | |
- name: Run tests | |
run: gonkey -tests=./gonkey/tests -host=https://api.nasa.gov/ -v | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
- uses: actions/upload-artifact@master | |
with: | |
name: allure-results | |
path: allure-results | |
- name: Get Allure history | |
uses: actions/checkout@v4.1.1 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Allure Report action from marketplace | |
uses: simple-elf/allure-report-action@v1.9 | |
if: always() | |
with: | |
allure_results: allure-results | |
allure_history: allure-history | |
keep_reports: 20 | |
- name: Deploy report to Github Pages | |
if: always() | |
uses: peaceiris/actions-gh-pages@v2 | |
env: | |
PERSONAL_TOKEN: ${{ secrets.GH_TOKEN }} | |
PUBLISH_BRANCH: gh-pages | |
PUBLISH_DIR: allure-history |