Skip to content

Commit ed8b1fa

Browse files
committed
Adding test
1 parent 39d2a2f commit ed8b1fa

File tree

1 file changed

+23
-91
lines changed

1 file changed

+23
-91
lines changed

.github/workflows/publish.yml

+23-91
Original file line numberDiff line numberDiff line change
@@ -9,91 +9,10 @@ on:
99
description: The environment to deploy.
1010

1111
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-
9112
detect-environments:
9213
runs-on: ubuntu-latest
93-
# needs: [test, lint]
9414
outputs:
9515
environments: ${{ steps.environments.outputs.result }}
96-
# if: github.ref_name == 'main'
9716
steps:
9817
- uses: actions/github-script@v6
9918
id: environments
@@ -106,9 +25,21 @@ jobs:
10625
await github.request(`GET /repos/${process.env.GITHUB_REPOSITORY}/environments`);
10726
return environments.map(e => e.name)
10827
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+
10940
deploy:
11041
runs-on: ubuntu-latest
111-
needs: [detect-environments]
42+
needs: [detect-environments, test]
11243
strategy:
11344
matrix:
11445
environment: ${{ fromJSON(needs.detect-environments.outputs.environments) }}
@@ -139,14 +70,15 @@ jobs:
13970
# npm install
14071
# make frontend-all
14172

142-
test:
143-
runs-on: ubuntu-latest
144-
steps:
145-
- uses: actions/checkout@v4
73+
- uses: aws-actions/amazon-ecr-login@v1
14674

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}
15084

151-
- name: Run Lint and Tests
152-
run: make test

0 commit comments

Comments
 (0)