9
9
description : The environment to deploy.
10
10
11
11
jobs :
12
- # lint:
13
- # runs-on: ubuntu-latest
14
- # steps:
15
- # - uses: actions/checkout@v4
16
- # with:
17
- # fetch-depth: 0
18
- # - uses: actions/setup-python@v4
19
- # with:
20
- # python-version: 3.9
21
- # - run: make init
22
- # - run: make lint
23
-
24
- # test:
25
- # runs-on: ubuntu-latest
26
- # services:
27
- # postgres:
28
- # image: postgis/postgis:14-master
29
- # env:
30
- # POSTGRES_PASSWORD: postgres
31
- # options: >-
32
- # --health-cmd pg_isready
33
- # --health-interval 10s
34
- # --health-timeout 5s
35
- # --health-retries 5
36
- # ports:
37
- # - 5432:5432
38
- # env:
39
- # DATASETTE_URL: https://datasette.digital-land.info
40
- # DATA_FILE_URL: https://data.digital-land.info
41
- # READ_DATABASE_URL: postgresql://postgres:postgres@localhost/digital_land_test
42
- # WRITE_DATABASE_URL: postgresql://postgres:postgres@localhost/digital_land_test
43
- # ENVIRONMENT: development
44
- # PGPASSWORD: postgres
45
- # steps:
46
- # - uses: actions/checkout@v4
47
- # with:
48
- # fetch-depth: 0
49
- #
50
- # - uses: actions/setup-python@v4
51
- # with:
52
- # python-version: 3.9
53
- #
54
- # - run: make init
55
- #
56
- # - name: Setup database
57
- # run: |
58
- # psql -h localhost -c "CREATE DATABASE digital_land_test WITH TEMPLATE postgres" -U postgres
59
- #
60
- # - name: Unit Tests
61
- # run: |
62
- # make test-unit
63
- # echo "## Unit Tests" >> $GITHUB_STEP_SUMMARY
64
- # cat unit-tests.md >> $GITHUB_STEP_SUMMARY
65
- #
66
- # - name: Integration Tests
67
- # run: |
68
- # make test-integration
69
- # echo "## Integration Tests" >> $GITHUB_STEP_SUMMARY
70
- # cat integration-tests.md >> $GITHUB_STEP_SUMMARY
71
- #
72
- # - name: Acceptance Tests
73
- # run: |
74
- # make test-acceptance
75
- # echo "## Acceptance Tests" >> $GITHUB_STEP_SUMMARY
76
- # cat acceptance-tests.md >> $GITHUB_STEP_SUMMARY
77
- #
78
- # - name: Accessibility Tests
79
- # run: |
80
- # make test-accessibility
81
- # echo "## Accessibility Tests" >> $GITHUB_STEP_SUMMARY
82
- # cat accessibility-tests.md >> $GITHUB_STEP_SUMMARY
83
- #
84
- # - uses: actions/upload-artifact@v3
85
- # if: always()
86
- # with:
87
- # name: playwright-report
88
- # path: playwright-report/
89
- # retention-days: 30
90
-
91
12
detect-environments :
92
13
runs-on : ubuntu-latest
93
- # needs: [test, lint]
94
14
outputs :
95
15
environments : ${{ steps.environments.outputs.result }}
96
- # if: github.ref_name == 'main'
97
16
steps :
98
17
- uses : actions/github-script@v6
99
18
id : environments
@@ -106,9 +25,21 @@ jobs:
106
25
await github.request(`GET /repos/${process.env.GITHUB_REPOSITORY}/environments`);
107
26
return environments.map(e => e.name)
108
27
28
+ test :
29
+ runs-on : ubuntu-latest
30
+ steps :
31
+ - uses : actions/checkout@v4
32
+
33
+ - name : Install test dependencies with pip
34
+ run : |
35
+ pip3 install -r requirements/test_requirements.txt
36
+
37
+ - name : Run Lint and Tests
38
+ run : make test
39
+
109
40
deploy :
110
41
runs-on : ubuntu-latest
111
- needs : [detect-environments]
42
+ needs : [detect-environments, test ]
112
43
strategy :
113
44
matrix :
114
45
environment : ${{ fromJSON(needs.detect-environments.outputs.environments) }}
@@ -139,14 +70,15 @@ jobs:
139
70
# npm install
140
71
# make frontend-all
141
72
142
- test :
143
- runs-on : ubuntu-latest
144
- steps :
145
- - uses : actions/checkout@v4
73
+ - uses : aws-actions/amazon-ecr-login@v1
146
74
147
- - name : Install test dependencies with pip
148
- run : |
149
- pip3 install -r requirements/test_requirements.txt
75
+ - run : docker pull $DOCKER_REPO:${GITHUB_REF_NAME} || echo "no current latest image"
76
+
77
+ - run : docker build --build-arg GIT_COMMIT="${{ steps.vars.outputs.sha_short }}" -t $DOCKER_REPO:${{ steps.vars.outputs.sha_short }} .
78
+
79
+ - run : docker tag $DOCKER_REPO:${{ steps.vars.outputs.sha_short }} $DOCKER_REPO:${GITHUB_REF_NAME}
80
+
81
+ - run : docker push $DOCKER_REPO:${{ steps.vars.outputs.sha_short }}
82
+
83
+ - run : docker push $DOCKER_REPO:${GITHUB_REF_NAME}
150
84
151
- - name : Run Lint and Tests
152
- run : make test
0 commit comments