-
Notifications
You must be signed in to change notification settings - Fork 6
379 GitHub action to run codegen automatically when there is backend change #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lmarini
merged 21 commits into
main
from
379-github-action-to-run-codegen-automatically-when-there-is-backend-change
Apr 6, 2023
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
86b58da
writing codegen yaml
longshuicy 469e67b
add a step to run built backend image
longshuicy def94a6
Update codegen.yaml
longshuicy 153b68d
add new test yaml for building backend container and connect with git…
longshuicy e585ab7
only test 14 for now
longshuicy d13bf39
add correct working directory; point docker compose to the right yaml
longshuicy b15669c
rewrite docker compose test and add new codegen command
longshuicy 41798f4
Update codegen.yaml
longshuicy 1517b1e
use verify changed file action
longshuicy 6922ba4
fail codegen
longshuicy 45e1f26
add codgen testing if action succeed?
longshuicy f21564b
add the correct tag
longshuicy 5aaf3ca
redundant restart
longshuicy 922f680
have to run test codegen
longshuicy 376031c
temporarily comment out the identity provider until we figure out how…
longshuicy 4163dba
update codegen
longshuicy 424aef0
update readme
longshuicy 4d9472f
Merge branch 'main' into 379-github-action-to-run-codegen-automatical…
longshuicy 7fc21b2
Merge branch 'main' into 379-github-action-to-run-codegen-automatical…
longshuicy 1661213
linting
longshuicy ecbff80
codegen out of sync
longshuicy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: Codegen | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - 'main' | ||
| - 'release/*' | ||
| tags: | ||
| - 'v*' | ||
| pull_request: | ||
| branches: | ||
| - 'main' | ||
| - 'release/*' | ||
|
|
||
| jobs: | ||
| docker: | ||
| timeout-minutes: 10 | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node: | ||
| - "14" | ||
|
|
||
| steps: | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v2 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Build Backend no push | ||
| uses: docker/build-push-action@v3 | ||
| with: | ||
| context: ./backend | ||
| platforms: linux/amd64 | ||
| push: false | ||
| tags: github-action | ||
|
|
||
| - name: Start containers | ||
| run: docker-compose -f "docker-compose.test.yml" up -d --build | ||
|
|
||
| # setup node | ||
| - name: Install node | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: frontend | ||
| run: npm install | ||
|
|
||
| - name: Run Codegen | ||
| working-directory: frontend | ||
| run: npm run codegen:v2:test | ||
|
|
||
| - name: Verify Changed files | ||
| uses: tj-actions/verify-changed-files@v14 | ||
| id: verify-changed-files | ||
| with: | ||
| files: frontend/src/openapi | ||
|
|
||
| - name: Perform action when openapi file changes | ||
| if: contains(steps.verify-changed-files.outputs.changed_files, 'frontend/src/openapi') | ||
| run: | | ||
| echo "Codegen is out of sync" | ||
| echo "Changed files: ${{ steps.verify-changed-files.outputs.changed_files }}" | ||
| exit 1 | ||
|
|
||
| - name: Stop containers | ||
| if: always() | ||
| run: docker-compose -f "docker-compose.test.yml" down |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,198 @@ | ||
| version: '3.7' | ||
|
|
||
| # Settings and configurations that are common for all minio containers | ||
| x-minio-common: &minio-common | ||
| image: quay.io/minio/minio:RELEASE.2022-01-25T19-56-04Z | ||
| command: server --console-address ":9001" http://minio{1...4}/data | ||
| restart: unless-stopped | ||
| environment: | ||
| MINIO_ROOT_USER: minioadmin | ||
| MINIO_ROOT_PASSWORD: minioadmin | ||
| networks: | ||
| - clowder2 | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] | ||
| interval: 30s | ||
| timeout: 20s | ||
| retries: 3 | ||
|
|
||
| services: | ||
|
|
||
| reverse-proxy: | ||
| image: traefik:v2.5 | ||
| restart: unless-stopped | ||
| command: | ||
| - --api.insecure=true | ||
| - --providers.docker | ||
| # - --entryPoints.web.address=:80 | ||
| ports: | ||
| # The HTTP port | ||
| - "80:80" | ||
| # The Web UI (enabled by --api.insecure=true) | ||
| - "8080:8080" | ||
| networks: | ||
| - clowder2 | ||
| volumes: | ||
| # So that Traefik can listen to the Docker events | ||
| - /var/run/docker.sock:/var/run/docker.sock | ||
|
|
||
| backend: | ||
| image: 'clowder/clowder2-backend:github-action' | ||
| restart: unless-stopped | ||
| build: | ||
| context: ./backend | ||
| networks: | ||
| - clowder2 | ||
| environment: | ||
| MONGODB_URL: mongodb://mongo:27017 | ||
| MINIO_SERVER_URL: minio-nginx:9000 | ||
| RABBITMQ_HOST: rabbitmq:15672 | ||
| elasticsearch_url: http://elasticsearch:9200 | ||
| auth_base: http://localhost | ||
| auth_url: http://localhost/keycloak/realms/clowder/protocol/openid-connect/auth?client_id=clowder2-backend&response_type=code | ||
| oauth2_scheme_auth_url: http://keycloak:8080/keycloak/realms/clowder/protocol/openid-connect/auth?client_id=clowder2-backend&response_type=code | ||
| auth_register_url: http://localhost/keycloak/realms/clowder/protocol/openid-connect/registrations?client_id=clowder2-backend&response_type=code | ||
| auth_token_url: http://keycloak:8080/keycloak/realms/clowder/protocol/openid-connect/token | ||
| auth_server_url: http://keycloak:8080/keycloak/ | ||
| keycloak_base: http://localhost/api | ||
| frontend_url: http://localhost | ||
| depends_on: | ||
| - mongo | ||
| - minio-nginx | ||
| - keycloak | ||
| - elasticsearch | ||
| labels: | ||
| - "traefik.enable=true" | ||
| - "traefik.http.routers.backend.rule=PathPrefix(`/api`)" | ||
| - "traefik.http.services.backend.loadbalancer.server.port=80" | ||
| - "traefik.http.routers.backend.priority=5" | ||
|
|
||
| mongo: | ||
| image: mongo:5.0 | ||
| restart: unless-stopped | ||
| networks: | ||
| - clowder2 | ||
| volumes: | ||
| - mongo:/data/db | ||
| - ./scripts/mongoviews/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro | ||
|
|
||
| minio1: | ||
| <<: *minio-common | ||
| hostname: minio1 | ||
| volumes: | ||
| - data1:/data | ||
|
|
||
| minio2: | ||
| <<: *minio-common | ||
| hostname: minio2 | ||
| volumes: | ||
| - data2:/data | ||
|
|
||
| minio3: | ||
| <<: *minio-common | ||
| hostname: minio3 | ||
| volumes: | ||
| - data3:/data | ||
|
|
||
| minio4: | ||
| <<: *minio-common | ||
| hostname: minio4 | ||
| volumes: | ||
| - data4:/data | ||
|
|
||
| minio-nginx: | ||
| image: nginx:1.19.2-alpine | ||
| restart: unless-stopped | ||
| hostname: nginx | ||
| networks: | ||
| - clowder2 | ||
| volumes: | ||
| - ./docker/minio-nginx.conf:/etc/nginx/nginx.conf:ro | ||
| depends_on: | ||
| - minio1 | ||
| - minio2 | ||
| - minio3 | ||
| - minio4 | ||
|
|
||
| postgres: | ||
| image: postgres | ||
| restart: unless-stopped | ||
| networks: | ||
| - clowder2 | ||
| volumes: | ||
| - postgres_data:/var/lib/postgresql/data | ||
| environment: | ||
| POSTGRES_DB: keycloak_prod | ||
| POSTGRES_USER: keycloak | ||
| POSTGRES_PASSWORD: password | ||
|
|
||
| keycloak: | ||
| image: quay.io/keycloak/keycloak:19.0 | ||
| restart: unless-stopped | ||
| networks: | ||
| - clowder2 | ||
| volumes: | ||
| - ./scripts/keycloak/clowder-realm-prod.json:/opt/keycloak/data/import/realm.json:ro | ||
| - ./scripts/keycloak/clowder-theme/:/opt/keycloak/themes/clowder-theme/:ro | ||
| command: | ||
| - start-dev | ||
| - --http-relative-path /keycloak | ||
| - --import-realm | ||
| environment: | ||
| KEYCLOAK_ADMIN: admin | ||
| KEYCLOAK_ADMIN_PASSWORD: admin | ||
| KC_DB: postgres | ||
| KC_DB_URL_HOST: postgres | ||
| KC_DB_URL_DATABASE: keycloak_prod | ||
| KC_DB_USERNAME: keycloak | ||
| KC_DB_PASSWORD: password | ||
| depends_on: | ||
| - postgres | ||
| labels: | ||
| - "traefik.enable=true" | ||
| - "traefik.http.routers.keycloak.rule=PathPrefix(`/keycloak`)" | ||
| - "traefik.http.services.keycloak.loadbalancer.server.port=8080" | ||
| - "traefik.http.routers.keycloak.priority=10" | ||
|
|
||
| # message broker | ||
| rabbitmq: | ||
| image: rabbitmq:3-management-alpine | ||
| environment: | ||
| - RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=-rabbitmq_management path_prefix "/rabbitmq" | ||
| - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-guest} | ||
| - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-guest} | ||
| ports: | ||
| - "5672:5672" | ||
| - "15672:15672" | ||
| networks: | ||
| - clowder2 | ||
| volumes: | ||
| - rabbitmq:/var/lib/rabbitmq | ||
|
|
||
| elasticsearch: | ||
| image: docker.elastic.co/elasticsearch/elasticsearch:8.3.3 | ||
| restart: unless-stopped | ||
| networks: | ||
| - clowder2 | ||
| environment: | ||
| - "cluster.name=clowder2" | ||
| - "discovery.type=single-node" | ||
| - "xpack.security.enabled=false" | ||
| - "xpack.security.http.ssl.enabled=false" | ||
| volumes: | ||
| - elasticsearch:/usr/share/elasticsearch/data | ||
|
|
||
| ## By default this config uses default local driver, | ||
| ## For custom volumes replace with volume driver configuration. | ||
| volumes: | ||
| mongo: | ||
| data1: | ||
| data2: | ||
| data3: | ||
| data4: | ||
| postgres_data: | ||
| elasticsearch: | ||
| rabbitmq: | ||
|
|
||
| networks: | ||
| clowder2: |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.