File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ # setup-django-backend Github workflow action
2+
3+ This composite workflow action takes care of some boilerplate for Maykin's Djanog
4+ projects:
5+
6+ * Setting up Python (with pip cache)
7+ * Installing backend dependencies
8+ * Tuning PostgreSQL for faster test running
9+ * Setting up NodeJS and npm + building the client-side code
10+
11+ ## Example usage:
12+
13+ ``` yaml
14+ jobs :
15+ tests :
16+ name : Run the Django test suite
17+ runs-on : ubuntu-latest
18+
19+ services :
20+ postgres :
21+ image : postgres:14
22+ env :
23+ POSTGRES_HOST_AUTH_METHOD : trust
24+ ports :
25+ - 5432:5432
26+ # Needed because the postgres container does not provide a healthcheck
27+ options :
28+ --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
29+ --name postgres
30+ redis :
31+ image : redis:6
32+ ports :
33+ - 6379:6379
34+ steps :
35+ - uses : actions/checkout@v3
36+ - name : Set up backend environment
37+ uses : maykinmedia/setup-django-backend@main
38+ with :
39+ apt-packages : ' libxml2-dev libxmlsec1-dev libxmlsec1-openssl gettext postgresql-client'
40+ python-version : ' 3.10'
41+ optimize-postgres : ' yes'
42+ pg-service : ' postgres'
43+ setup-node : ' yes'
44+ npm-ci-flags : ' --legacy-peer-deps'
45+
46+ - name : Run tests
47+ run : ...
48+ ` ` `
Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ inputs:
2828 required : false
2929 default : ' '
3030
31+ setup-node :
32+ description : Whether to setup node and npm packages.
33+ required : false
34+ default : ' yes'
35+
3136 npm-ci-flags :
3237 description : Additional arguments for the 'npm ci' command.
3338 required : false
3742 using : ' composite'
3843 steps :
3944 - name : Install OS dependencies
45+ if : ${{ inputs.apt-packages }}
4046 run : |
4147 sudo apt-get update
4248 sudo apt-get install --yes ${{ inputs.apt-packages }}
@@ -79,10 +85,12 @@ runs:
7985
8086 # TODO: enable cache
8187 - uses : actions/setup-node@v3
88+ if : ${{ inputs.setup-node == 'yes' }}
8289 with :
8390 node-version-file : ' .nvmrc'
8491
8592 - name : Build frontend
93+ if : ${{ inputs.setup-node == 'yes' }}
8694 run : |
8795 npm ci ${{ inputs.npm-ci-flags }}
8896 npm run build
You can’t perform that action at this time.
0 commit comments