Merge pull request #5061 from ebmdatalab/dependabot/pip/dependencies-… #4991
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "OpenPrescribing CI" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Retrieve Google Cloud credentials | |
run: ./.github/scripts/decrypt_secret.sh | |
env: | |
GOOGLE_CLOUD_GITHUB_ACTIONS_PASSPHRASE: ${{ secrets.GOOGLE_CLOUD_GITHUB_ACTIONS_PASSPHRASE }} | |
- name: Unit tests | |
run: docker compose run --service-ports test && docker compose run --service-ports test-production | |
env: | |
TEST_SUITE: nonfunctional | |
- name: Notify slack failure | |
if: failure() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
uses: voxmedia/github-action-slack-notify-build@v1 | |
with: | |
channel: tech-noise | |
status: "FAILURE (unit_test)" | |
color: danger | |
functional_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
browser: [ "Edge:latest:Windows:10", "Firefox:latest:OS X:Catalina" ] | |
steps: | |
- name: 'BrowserStack Env Setup' | |
uses: 'browserstack/github-actions/setup-env@master' | |
with: | |
username: ${{ secrets.BROWSERSTACK_USERNAME }} | |
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
build-name: BUILD_INFO | |
project-name: REPO_NAME | |
- name: 'BrowserStack Local Tunnel Setup' | |
uses: 'browserstack/github-actions/setup-local@master' | |
with: | |
local-testing: start | |
local-identifier: random | |
local-logging-level: all-logs | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Retrieve Google Cloud credentials | |
run: ./.github/scripts/decrypt_secret.sh | |
env: | |
GOOGLE_CLOUD_GITHUB_ACTIONS_PASSPHRASE: ${{ secrets.GOOGLE_CLOUD_GITHUB_ACTIONS_PASSPHRASE }} | |
- name: Functional tests | |
run: docker compose run --service-ports test | |
env: | |
TEST_SUITE: functional | |
BROWSER: ${{ matrix.browser }} | |
- name: 'BrowserStackLocal Stop' | |
uses: 'browserstack/github-actions/setup-local@master' | |
with: | |
local-testing: stop | |
- name: Notify slack failure | |
if: failure() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
BROWSER: ${{ matrix.browser }} | |
uses: voxmedia/github-action-slack-notify-build@v1 | |
with: | |
channel: tech-noise | |
status: "FAILURE (functional test $BROWSER)" | |
color: danger | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: "Linting" | |
run: | | |
pip install -r requirements.dev.txt | |
scripts/lint.sh | |
- name: Notify slack failure | |
if: failure() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
uses: voxmedia/github-action-slack-notify-build@v1 | |
with: | |
channel: tech-noise | |
status: "FAILURE (linting)" | |
color: danger | |
notify_slack: | |
runs-on: ubuntu-latest | |
needs: [ unit_test , functional_tests , linting ] | |
steps: | |
- name: Notify slack success | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
uses: voxmedia/github-action-slack-notify-build@v1 | |
with: | |
channel: tech-noise | |
status: SUCCESS | |
color: good |