Skip to content

with the correct key #7510

with the correct key

with the correct key #7510

Workflow file for this run

name: Iaso Automated CI testing
# This workflow run automatically for every PR on github it checks the syntax and launch the tests.
on:
pull_request:
types: [opened, synchronize, ready_for_review]
push:
# Run On push (or merge) on main. This populates the cache and avoid the issue where we have undetected migrations
# conflict following subsequent merge
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test_js:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Use node.js 20
uses: actions/setup-node@v2
with:
node-version: '20.13.1'
cache: npm
- name: upgrade npm
run: |
npm install --global [email protected]
- name: Environment info
run: |
node --version
npm --version
- name: npm install and test
run: |
npm ci
npm test
- name: Check that no JS translation are missing
run: |
python scripts/update_trads.py
- name: Slack notification
uses: rtCamp/[email protected]
env:
SLACK_USERNAME: ${{ github.workflow }}
SLACK_ICON_EMOJI: ':robot_face:'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: iaso-dev
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: ${{ format('Job {0} failed on {1}', github.job, github.ref) }}
SLACK_FOOTER: ${{ format('<https://github.com/{0}/commit/{1}/checks|πŸ”—{2} logs> | <https://github.com/{0}/commit/{1}/checks|πŸ”— Commit {1}>', github.repository, github.sha, github.job) }}
MSG_MINIMAL: true
if: failure()
build-and-push-image:
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Determining version ${{ github.ref_name }}
id: version
run: |
export GITHUB_BRANCH=${GITHUB_REF##*heads/}
echo $GITHUB_BRANCH
git describe --tags
export VERSION_NAME=$(git describe --tags)--$GITHUB_BRANCH
echo "::set-output name=VERSION_NAME::$VERSION_NAME"
echo "::set-output name=IMAGE_TAG::${{ env.REGISTRY }}/blsq/iaso:$GITHUB_SHA"
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.version.outputs.IMAGE_TAG }}
target: dev
file: docker/bundle/Dockerfile
cache-from: type=registry,ref=ghcr.io/blsq/iaso:buildcache
cache-to: type=registry,ref=ghcr.io/blsq/iaso:buildcache,mode=max
test_python:
runs-on: ubuntu-20.04
services:
postgres:
image: postgis/postgis:12-3.3
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
- 5432:5432
# needed because the postgres container does not provide a health check
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install GDAL and gettext
run: sudo apt-get update && sudo apt install gdal-bin gettext
- uses: actions/cache@v2
id: cache-venv
with:
path: ./venv/
# The cache key depends on requirements.txt
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-venv-
# Build a virtualenv, but only if it doesn't already exist
- run: python -v && python -m venv ./venv && . ./venv/bin/activate && pip install -U pip &&
pip install -r requirements-dev.txt
if: steps.cache-venv.outputs.cache-hit != 'true'
- name: Environment info
run: |
pip list
- name: Check formatting with Black
run: |
. ./venv/bin/activate && black --check .
- name: Django tests
run: |
. ./venv/bin/activate && python manage.py compilemessages
. ./venv/bin/activate && python manage.py migrate
. ./venv/bin/activate && python manage.py createcachetable
. ./venv/bin/activate && python -W "ignore" manage.py test
# check we don't have missing migration
. ./venv/bin/activate && python manage.py makemigrations --check
env:
IASO_ENVIRONMENT: development
RDS_DB_NAME: github_actions
SECRET_KEY: secret
DEBUG: true
DJANGO_SETTINGS_MODULE: hat.settings
RDS_PASSWORD: postgres
RDS_HOSTNAME: localhost
RDS_PORT: 5432
RDS_USERNAME: postgres
CACHE: false
DEV_SERVER: true
PLUGINS: polio,wfp
AWS_STORAGE_BUCKET_NAME: iaso-dev
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DEFAULT_FILE_STORAGE: storages.backends.s3boto3.S3Boto3Storage
- name: Slack notification
uses: rtCamp/[email protected]
env:
SLACK_USERNAME: ${{ github.workflow }}
SLACK_ICON_EMOJI: ':robot_face:'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: iaso-dev
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: ${{ format('Job {0} failed on {1}', github.job, github.ref) }}
SLACK_FOOTER: ${{ format('<https://github.com/{0}/commit/{1}/checks|πŸ”—{2} logs> | <https://github.com/{0}/commit/{1}/checks|πŸ”— Commit {1}>', github.repository, github.sha, github.job) }}
MSG_MINIMAL: true
if: failure()