refactor: Vendor oasis-core v22.2, Use mostly vendored oasis-core #2019
Workflow file for this run
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
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge. | |
name: ci-test | |
# Trigger the workflow when: | |
on: | |
# A push occurs to one of the matched branches. | |
push: | |
branches: | |
- main | |
# Or when a pull request event occurs for a pull request against one of the | |
# matched branches. | |
pull_request: | |
branches: | |
- main | |
# Cancel in-progress jobs on same branch. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-go: | |
runs-on: ubuntu-20.04 | |
services: | |
# Generic postgres server; used only for testing our DB client lib. Not used by nexus. | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_HOST: 127.0.0.1 | |
POSTGRES_PORT: 5432 | |
POSTGRES_DB: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
env: | |
CI_TEST_CONN_STRING: "postgresql://postgres:[email protected]:5432/postgres?sslmode=disable" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Install Go tools | |
run: go install github.com/deepmap/oapi-codegen/cmd/[email protected] | |
- name: Build Go | |
run: | | |
make nexus | |
make test-ci | |
- name: Upload to codecov.io | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.txt | |
validate-openapi: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Normalize YAML | |
run: | | |
VERSION=v4.30.5 BINARY=yq_linux_amd64 | |
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O ./yq | |
chmod +x ./yq | |
# OpenAPI parser fails to parse YAML templates (*, <<:). Expand them out here. | |
<api/spec/v1.yaml ./yq --output-format json | ./yq --output-format yaml --input-format json >api/spec/v1-normalized.yaml | |
- name: Validate OpenAPI definition | |
uses: char0n/swagger-editor-validate@v1 | |
with: | |
definition-file: api/spec/v1-normalized.yaml | |
validate-migrations: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Validate storage migrations are serial | |
run: scripts/validate_migrations.py --migrations storage/migrations | |
test-e2e: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Autogenerate Go code | |
run: | | |
go install github.com/deepmap/oapi-codegen/cmd/[email protected] | |
make codegen-go | |
- name: Build docker | |
run: make docker | |
- name: Start docker | |
run: make start-docker-e2e | |
- name: Confirm containers | |
run: docker ps -a | |
- name: Test | |
run: docker exec nexus sh -c "cd /nexus && make test-e2e" | |
- name: Dump logs and DB contents | |
run: | | |
docker logs nexus | tee /tmp/nexus.log; | |
docker logs nexus-postgres | tee /tmp/nexus-postgres.log; | |
docker exec nexus-postgres pg_dump -U indexer --create | tee /tmp/nexus_db.sql; | |
if: success() || failure() # but not if job is manually cancelled | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nexus_db.sql | |
path: | | |
/tmp/nexus_db.sql | |
/tmp/*.log | |
if: success() || failure() # but not if job is manually cancelled | |
test-e2e-regression: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Autogenerate Go code | |
run: | | |
go install github.com/deepmap/oapi-codegen/cmd/[email protected] | |
make codegen-go | |
- name: Build Go | |
run: | | |
make nexus | |
- name: Start db | |
run: | | |
make postgres | |
- name: Run e2e regression tests | |
run : | | |
make test-e2e-regression | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Actual nexus api responses | |
path: | | |
tests/e2e_regression/actual | |
if: failure() # but not if success or job is manually cancelled |