Skip to content

Commit 83f14c7

Browse files
authored
Trigger deploy to test on main-test branch (#224)
* test 1 * why not building * test 3 * push
1 parent f689e46 commit 83f14c7

5 files changed

Lines changed: 95 additions & 68 deletions

File tree

.github/workflows/docker-build-push.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
name: Build and Push Docker Images
1313
on:
1414
workflow_run:
15-
workflows: ["Tests"]
15+
workflows: [Tests]
1616
types: [completed]
17-
branches: [staging]
17+
branches: [main-test, staging]
1818

19-
concurrency:
20-
group: ${{ github.workflow }}-${{ github.ref }}
21-
cancel-in-progress: true
19+
# concurrency:
20+
# group: ${{ github.workflow }}-${{ github.ref }}
21+
# cancel-in-progress: true
2222

2323
permissions:
2424
contents: read
@@ -37,8 +37,15 @@ jobs:
3737
id: set-env
3838
env:
3939
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch || github.ref_name }}
40+
# TODO uncomment
41+
# run: |
42+
# if [[ "$HEAD_BRANCH" == 'main' ]]; then
43+
# echo "environment=production" >> $GITHUB_OUTPUT
44+
# else
45+
# echo "environment=staging" >> $GITHUB_OUTPUT
46+
# fi
4047
run: |
41-
if [[ "$HEAD_BRANCH" == 'main' ]]; then
48+
if [[ "$HEAD_BRANCH" == 'main-test' ]]; then
4249
echo "environment=production" >> $GITHUB_OUTPUT
4350
else
4451
echo "environment=staging" >> $GITHUB_OUTPUT
@@ -50,7 +57,9 @@ jobs:
5057
runs-on: ubuntu-latest
5158
strategy:
5259
matrix:
53-
service: [app, api, process, widget-benevolat, widget-volontariat]
60+
# TODO uncomment
61+
# service: [app, api, process, widget-benevolat, widget-volontariat]
62+
service: [process]
5463
steps:
5564
- name: Checkout code
5665
uses: actions/checkout@v3

.github/workflows/terraform-deploy.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
workflow_run:
55
workflows: ["Build and Push Docker Images"]
66
types: [completed]
7-
branches: [staging]
7+
# TODO uncomment
8+
# branches: [main, staging]
9+
branches: [main-test, staging]
810

911
concurrency:
1012
group: ${{ github.workflow }}-${{ github.ref }}
@@ -38,10 +40,19 @@ jobs:
3840
env:
3941
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch || github.ref_name }}
4042
MANUAL_ENV: ${{ github.event.inputs.environment }}
43+
# TODO uncomment
44+
# run: |
45+
# if [[ "$GITHUB_EVENT_NAME" == 'workflow_dispatch' ]]; then
46+
# echo "environment=$MANUAL_ENV" >> $GITHUB_OUTPUT
47+
# elif [[ "$HEAD_BRANCH" == 'main' ]]; then
48+
# echo "environment=production" >> $GITHUB_OUTPUT
49+
# else
50+
# echo "environment=staging" >> $GITHUB_OUTPUT
51+
# fi
4152
run: |
4253
if [[ "$GITHUB_EVENT_NAME" == 'workflow_dispatch' ]]; then
4354
echo "environment=$MANUAL_ENV" >> $GITHUB_OUTPUT
44-
elif [[ "$HEAD_BRANCH" == 'main' ]]; then
55+
elif [[ "$HEAD_BRANCH" == 'main-test' ]]; then
4556
echo "environment=production" >> $GITHUB_OUTPUT
4657
else
4758
echo "environment=staging" >> $GITHUB_OUTPUT

.github/workflows/tests.yml

Lines changed: 64 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,41 @@ name: Tests
22

33
on:
44
push:
5-
branches: [main, staging]
5+
# TODO uncomment
6+
# branches: [main, staging]
7+
branches: [main-test, staging]
68
pull_request:
7-
branches: [main, staging]
9+
# TODO uncomment
10+
# branches: [main, staging]
11+
branches: [main-test, staging]
812

9-
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
13+
# concurrency:
14+
# group: ${{ github.workflow }}-${{ github.ref }}
15+
# cancel-in-progress: true
1216

1317
jobs:
14-
api-tests:
15-
name: API Tests
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/checkout@v3
19-
20-
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v2
22-
23-
- name: Build test image
24-
uses: docker/build-push-action@v4
25-
with:
26-
context: ./api
27-
file: ./api/Dockerfile
28-
load: true
29-
tags: api-test:latest
30-
cache-from: type=gha
31-
cache-to: type=gha,mode=max
32-
33-
- name: Run tests
34-
run: docker run --rm api-test:latest npm run test:ci
18+
# TODO uncomment
19+
# api-tests:
20+
# name: API Tests
21+
# runs-on: ubuntu-latest
22+
# steps:
23+
# - uses: actions/checkout@v3
24+
25+
# - name: Set up Docker Buildx
26+
# uses: docker/setup-buildx-action@v2
27+
28+
# - name: Build test image
29+
# uses: docker/build-push-action@v4
30+
# with:
31+
# context: ./api
32+
# file: ./api/Dockerfile
33+
# load: true
34+
# tags: api-test:latest
35+
# cache-from: type=gha
36+
# cache-to: type=gha,mode=max
37+
38+
# - name: Run tests
39+
# run: docker run --rm api-test:latest npm run test:ci
3540

3641
process-tests:
3742
name: Process Tests
@@ -55,35 +60,36 @@ jobs:
5560
- name: Run tests
5661
run: docker run --rm process-test:latest npm run test
5762

58-
widget-benevolat-tests:
59-
name: Widget benevolat Tests
60-
runs-on: ubuntu-latest
61-
62-
# Does not run if no files in widget-benevolat/ have been modified
63-
if: ${{ github.event_name == 'push' || contains(toJSON(github.event.pull_request.files.*.filename), 'widget-benevolat/') }}
64-
steps:
65-
- uses: actions/checkout@v3
66-
67-
- name: Use Node.js
68-
uses: actions/setup-node@v3
69-
with:
70-
node-version: "18.x"
71-
cache: "npm"
72-
cache-dependency-path: "widget-benevolat/package-lock.json"
73-
74-
- name: Install dependencies
75-
run: cd widget-benevolat && npm ci
76-
77-
- name: Install Playwright browsers and dependencies
78-
run: cd widget-benevolat && npx playwright install --with-deps
79-
80-
- name: Run tests
81-
run: cd widget-benevolat && npm run test:e2e
82-
83-
- name: Upload HTML test report
84-
uses: actions/upload-artifact@v4
85-
if: always()
86-
with:
87-
name: playwright-report
88-
path: widget-benevolat/tests/e2e/_playwright-report
89-
retention-days: 30
63+
# TODO uncomment
64+
# widget-benevolat-tests:
65+
# name: Widget benevolat Tests
66+
# runs-on: ubuntu-latest
67+
68+
# # Does not run if no files in widget-benevolat/ have been modified
69+
# if: ${{ github.event_name == 'push' || contains(toJSON(github.event.pull_request.files.*.filename), 'widget-benevolat/') }}
70+
# steps:
71+
# - uses: actions/checkout@v3
72+
73+
# - name: Use Node.js
74+
# uses: actions/setup-node@v3
75+
# with:
76+
# node-version: "18.x"
77+
# cache: "npm"
78+
# cache-dependency-path: "widget-benevolat/package-lock.json"
79+
80+
# - name: Install dependencies
81+
# run: cd widget-benevolat && npm ci
82+
83+
# - name: Install Playwright browsers and dependencies
84+
# run: cd widget-benevolat && npx playwright install --with-deps
85+
86+
# - name: Run tests
87+
# run: cd widget-benevolat && npm run test:e2e
88+
89+
# - name: Upload HTML test report
90+
# uses: actions/upload-artifact@v4
91+
# if: always()
92+
# with:
93+
# name: playwright-report
94+
# path: widget-benevolat/tests/e2e/_playwright-report
95+
# retention-days: 30

process/Dockerfile.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ COPY --from=builder /app/prisma ./prisma
3333

3434
EXPOSE 8080
3535

36-
CMD ["node", "dist/index.js"]
36+
CMD ["npm", "run", "start:docker"]

process/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"stop": "pm2 stop process",
1515
"start-dev": "ts-node src/index.ts",
1616
"start": "node dist/index.js",
17+
"start:docker": "prisma migrate deploy && node dist/index.js",
1718
"start-pm2": "pm2 start dist/index.js --name process",
1819
"reload": "pm2 reload process",
1920
"lint": "eslint --ext .js,.ts src/",

0 commit comments

Comments
 (0)