-
Notifications
You must be signed in to change notification settings - Fork 88
81 lines (65 loc) · 2.42 KB
/
unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Freesound Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ '*' ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
driver: docker
- name: Notify workflow starting
uses: voxmedia/github-action-slack-notify-build@v1
continue-on-error: true
if: success()
id: slack
with:
channel_id: ${{ secrets.SLACK_NOTIFICATIONS_CHANNEL_ID }}
status: STARTING
color: warning
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
- name: Setup
run: bash -c 'mkdir -p ./freesound-data/{packs,uploads,avatars} && echo FS_USER_ID_FROM_ENV=$(id -u) > .env && cp freesound/local_settings.example.py freesound/local_settings.py'
- name: update settings file
run: sed -i 's#^DISPLAY_DEBUG_TOOLBAR.*#DISPLAY_DEBUG_TOOLBAR = False#' freesound/local_settings.py
- name: Login to Docker Hub
run: echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
continue-on-error: true
- name: Pull docker images
run: docker-compose -f docker-compose.test.yml pull
- uses: jpribyl/action-docker-layer-caching@v0.1.1
continue-on-error: true
- name: Build base image
run: make -C docker
- name: Build images
run: docker-compose -f docker-compose.test.yml build db test_runner
- name: Run tests
run: docker-compose -f docker-compose.test.yml run --rm test_runner python manage.py test --noinput --settings=freesound.test_settings
- name: Notify success
uses: voxmedia/github-action-slack-notify-build@v1
continue-on-error: true
if: success()
with:
message_id: ${{ steps.slack.outputs.message_id }}
channel_id: ${{ secrets.SLACK_NOTIFICATIONS_CHANNEL_ID }}
status: SUCCESS
color: good
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
- name: Notify failure
uses: voxmedia/github-action-slack-notify-build@v1
if: failure()
with:
message_id: ${{ steps.slack.outputs.message_id }}
channel_id: ${{ secrets.SLACK_NOTIFICATIONS_CHANNEL_ID }}
status: FAILED
color: danger
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}