|
17 | 17 | required: true
|
18 | 18 | default: false
|
19 | 19 | jobs:
|
20 |
| - test-gh-repo: |
| 20 | + build-api: |
21 | 21 | runs-on: ubuntu-latest
|
22 | 22 | steps:
|
23 | 23 | - uses: actions/checkout@v2
|
|
33 | 33 | IMAGE_NAME=ghcr.io/hackforla/homeuniteus/api:latest
|
34 | 34 | docker build -t $IMAGE_NAME ./api
|
35 | 35 | docker push $IMAGE_NAME
|
36 |
| - test-api-gh-repo: |
37 |
| - runs-on: ubuntu-latest |
38 |
| - needs: [test-gh-repo] |
39 |
| - if: >- |
40 |
| - github.event_name == 'push' || |
41 |
| - github.event.pull_request || |
42 |
| - (github.event_name == 'workflow_dispatch' && github.event.inputs.test) |
43 |
| - env: |
44 |
| - COGNITO_REGION: ${{ secrets.COGNITO_REGION }} |
45 |
| - COGNITO_ACCESS_ID: ${{ secrets.COGNITO_ACCESS_ID }} |
46 |
| - COGNITO_ACCESS_KEY: ${{ secrets.COGNITO_ACCESS_KEY }} |
47 |
| - steps: |
48 |
| - - name: Log in to GitHub Container Registry |
49 |
| - uses: docker/login-action@v1 |
50 |
| - with: |
51 |
| - registry: ghcr.io |
52 |
| - username: ${{ github.actor }} |
53 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
54 |
| - - name: Pull API Image |
55 |
| - run: docker pull ghcr.io/hackforla/homeuniteus/api:latest |
56 |
| - - name: Run Debug Tests |
57 |
| - run: docker run ghcr.io/hackforla/homeuniteus/api:latest pytest |
58 |
| - - name: Run Release Tests |
59 |
| - run: docker run --env COGNITO_REGION --env COGNITO_ACCESS_ID --env COGNITO_ACCESS_KEY ghcr.io/hackforla/homeuniteus/api:latest "pytest --mode=release" |
60 |
| - build-api: |
61 |
| - runs-on: ubuntu-latest |
62 |
| - steps: |
63 |
| - - uses: actions/checkout@v2 |
64 |
| - - uses: docker/setup-buildx-action@v1 |
65 |
| - - name: Build API Image |
66 |
| - run: | |
67 |
| - docker build -t api:latest ./api |
68 |
| - docker save api:latest -o api_image.tar |
69 |
| - - uses: actions/upload-artifact@v3 |
70 |
| - with: |
71 |
| - name: api_image |
72 |
| - path: api_image.tar |
73 |
| - retention-days: 7 |
74 | 36 | build-app:
|
75 | 37 | runs-on: ubuntu-latest
|
76 | 38 | steps:
|
@@ -106,17 +68,18 @@ jobs:
|
106 | 68 | COGNITO_ACCESS_ID: ${{ secrets.COGNITO_ACCESS_ID }}
|
107 | 69 | COGNITO_ACCESS_KEY: ${{ secrets.COGNITO_ACCESS_KEY }}
|
108 | 70 | steps:
|
109 |
| - - name: Download API Image Artifact |
110 |
| - uses: actions/download-artifact@v3 |
| 71 | + - name: Log in to GitHub Container Registry |
| 72 | + uses: docker/login-action@v1 |
111 | 73 | with:
|
112 |
| - name: api_image |
113 |
| - path: . |
114 |
| - - name: Load API Image |
115 |
| - run: docker load -i api_image.tar |
| 74 | + registry: ghcr.io |
| 75 | + username: ${{ github.actor }} |
| 76 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + - name: Pull API Image |
| 78 | + run: docker pull ghcr.io/hackforla/homeuniteus/api:latest |
116 | 79 | - name: Run Debug Tests
|
117 |
| - run: docker run api:latest pytest |
| 80 | + run: docker run ghcr.io/hackforla/homeuniteus/api:latest pytest |
118 | 81 | - name: Run Release Tests
|
119 |
| - run: docker run --env COGNITO_REGION --env COGNITO_ACCESS_ID --env COGNITO_ACCESS_KEY api:latest "pytest --mode=release" |
| 82 | + run: docker run --env COGNITO_REGION --env COGNITO_ACCESS_ID --env COGNITO_ACCESS_KEY ghcr.io/hackforla/homeuniteus/api:latest "pytest --mode=release" |
120 | 83 | test-app:
|
121 | 84 | runs-on: ubuntu-latest
|
122 | 85 | needs: [build-app, build-api]
|
@@ -145,8 +108,8 @@ jobs:
|
145 | 108 | docker run --network huu-test-network -d --name backend --env ENV='development' --env HOST=0.0.0.0 api:latest
|
146 | 109 | docker run --network huu-test-network -d --name frontend_nomock --env VITE_HUU_API_BASE_URL=http://backend:api app:latest-test "npx vite --host"
|
147 | 110 | sleep 10
|
148 |
| - docker exec backend curl http://localhost:8080/api/auth/signup/host -H "accept: application/json" -H "Content-Type: application/json" -d "{\"email\": \"[email protected]\", \"password\": \"alskdf454$Adfa\"}" |
149 |
| - docker run --network huu-test-network --name cypress_tests_nomock --env CYPRESS_BASE_URL="http://frontend_nomock:4040" --env CYPRESS_USE_MOCK=false --env CYPRESS_REAL_EMAIL='[email protected]' --env CYPRESS_REAL_PASSWORD='alskdf454$Adfa' app:latest-test "npx cypress run" |
| 111 | + docker exec backend curl http://localhost:8080/api/auth/signup/host -H "accept: application/json" -H "Content-Type: application/json" -d "{\"email\": \"[email protected]\", \"password\": \"alskdf454#Adfa\"}" |
| 112 | + docker run --network huu-test-network --name cypress_tests_nomock --env CYPRESS_BASE_URL="http://frontend_nomock:4040" --env CYPRESS_USE_MOCK=false --env CYPRESS_REAL_EMAIL='[email protected]' --env CYPRESS_REAL_PASSWORD='alskdf454#Adfa' app:latest-test "npx cypress run" |
150 | 113 | - name: Wait for Test to Complete
|
151 | 114 | run: |
|
152 | 115 | while true; do
|
|
0 commit comments