Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: minor ci cleanup #1147

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# WARNING: Do not edit this file manually! Edit ci/spec.yml and run ci/regen-workflow.py.

{"name": "CI", "on": ["push", "pull_request"], "defaults": {"run": {"shell": "bash"}}, "env": {"PRODUCTION": "TRUE"}, "jobs": {"linting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Run flake8", "run": "flake8 --max-line-length 150 --exclude=*/migrations/* intranet/ scripts/ docs/ *.py"}, {"name": "Run pylint", "run": "pylint --jobs=0 --disable=fixme,broad-except,global-statement,attribute-defined-outside-init,cyclic-import --django-settings-module=intranet.settings intranet/"}, {"name": "Run isort", "run": "isort --check --recursive intranet"}]}, "formatting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Format code", "run": "./scripts/build_ensure_no_changes.sh ./scripts/format.sh"}, {"name": "Format static files and templates", "run": "./scripts/build_ensure_no_changes.sh ./scripts/static_templates_format.sh"}]}, "build": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo (fetching all commits)", "uses": "actions/checkout@v2", "with": {"fetch-depth": 0}}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Regenerate workflow YAML file and check for changes", "run": "set -e\npip install pyyaml\n./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py\n"}, {"name": "Build docs", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_docs.sh"}, {"name": "Build sources", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_sources.sh"}, {"name": "Check for changes to CI spec", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Check for unmigrated changes", "run": "./scripts/build_ensure_no_changes.sh ./manage.py migrate"}, {"name": "Validate PR commit messages", "if": "github.event_name == 'pull_request'", "run": "./scripts/validate-commit-messages.py ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"}, {"name": "Validate push commit messages", "if": "github.event_name == 'push' && (github.repository_owner != 'tjcsl' || github.ref != 'refs/heads/master' || github.ref != 'refs/heads/dev')", "run": "git fetch origin ${{ github.event.before }} && ./scripts/validate-commit-messages.py ${{ github.event.before }}..${{ github.event.after }}"}, {"name": "Push docs", "if": "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'tjcsl' && matrix.python-version == 3.8", "run": "./scripts/push_docs.sh", "env": {"GH_TOKEN": "${{ secrets.DOCS_GH_TOKEN }}"}}]}, "tests": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8], "node-version": ["12.x"]}, "fail-fast": false}, "services": {"rabbitmq": {"image": "rabbitmq:latest", "ports": ["5672:5672"], "options": "--health-cmd \"rabbitmqctl node_health_check\" --health-interval 6s --health-timeout 5s --health-retries 10"}, "redis": {"image": "redis:latest", "ports": ["6379:6379"], "options": "--entrypoint redis-server"}, "postgres": {"image": "postgres:latest", "env": {"POSTGRES_USER": "postgres", "POSTGRES_PASSWORD": "postgres", "POSTGRES_DB": "postgres"}, "ports": ["5432:5432"], "options": "--health-cmd pg_isready --health-interval 6s --health-timeout 5s --health-retries 9"}}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Set up Node.js ${{ matrix.node-version }}", "uses": "actions/setup-node@v1", "with": {"node-version": "${{ matrix.node-version }}"}}, {"name": "Install Sass and add Node modules bin to PATH", "run": "set -e\nnpm install sass\necho \"PATH=${{ github.workspace }}/node_modules/.bin:$PATH\" >> $GITHUB_ENV\n"}, {"name": "Set and create PGPASSFILE", "run": "set -e\nPGPASSFILE=${{ runner.temp }}/.pgpass\necho \"PGPASSFILE=$PGPASSFILE\" >> $GITHUB_ENV\necho 127.0.0.1:5432:postgres:postgres:postgres >$PGPASSFILE\nchmod 600 $PGPASSFILE\n"}, {"name": "Create database", "run": "psql -U postgres -h 127.0.0.1 -c 'create database ion'"}, {"name": "install Kerberos", "run": "sudo apt install -y krb5-user"}, {"name": "Run tests", "run": "coverage run ./setup.py test"}, {"name": "Migrate database", "run": "coverage run -a ./manage.py migrate"}, {"name": "Collect static files", "run": "coverage run -a ./manage.py collectstatic --noinput -v 0"}, {"name": "Report coverage to Coveralls", "uses": "AndreMiras/coveralls-python-action@develop", "with": {"parallel": true}}, {"name": "Build coverage XML file", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "run": "coverage xml"}, {"name": "Report coverage to Codacy", "uses": "codacy/codacy-coverage-reporter-action@master", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "with": {"coverage-reports": "coverage.xml", "project-token": "${{ secrets.CODACY_PROJECT_TOKEN }}"}}]}, "finish_success": {"needs": ["linting", "formatting", "build", "tests"], "runs-on": "ubuntu-latest", "steps": [{"name": "Tell Coveralls that parallel jobs have finished", "uses": "coverallsapp/github-action@master", "with": {"github-token": "${{ secrets.GITHUB_TOKEN }}", "parallel-finished": true}}]}}}
{"name": "CI", "on": ["push", "pull_request"], "defaults": {"run": {"shell": "bash"}}, "env": {"PRODUCTION": "TRUE"}, "jobs": {"linting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Run flake8", "run": "flake8 --max-line-length 150 --exclude=*/migrations/* intranet/ scripts/ docs/ *.py"}, {"name": "Run pylint", "run": "pylint --jobs=0 --disable=fixme,broad-except,global-statement,attribute-defined-outside-init,cyclic-import --django-settings-module=intranet.settings intranet/"}, {"name": "Run isort", "run": "isort --check --recursive intranet"}]}, "formatting": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Format code", "run": "./scripts/build_ensure_no_changes.sh ./scripts/format.sh"}, {"name": "Format static files and templates", "run": "./scripts/build_ensure_no_changes.sh ./scripts/static_templates_format.sh"}]}, "build": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8]}, "fail-fast": false}, "steps": [{"name": "Set up repo (fetching all commits)", "uses": "actions/checkout@v2", "with": {"fetch-depth": 0}}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Regenerate workflow YAML file and check for changes", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Build docs", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_docs.sh"}, {"name": "Build sources", "run": "./scripts/build_ensure_no_changes.sh ./scripts/build_sources.sh"}, {"name": "Check for changes to CI spec", "run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py"}, {"name": "Check for unmigrated changes", "run": "./scripts/build_ensure_no_changes.sh ./manage.py migrate"}, {"name": "Validate PR commit messages", "if": "github.event_name == 'pull_request'", "run": "./scripts/validate-commit-messages.py ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"}, {"name": "Validate push commit messages", "if": "github.event_name == 'push' && (github.repository_owner != 'tjcsl' || github.ref != 'refs/heads/master' || github.ref != 'refs/heads/dev')", "run": "git fetch origin ${{ github.event.before }} && ./scripts/validate-commit-messages.py ${{ github.event.before }}..${{ github.event.after }}"}, {"name": "Push docs", "if": "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'tjcsl' && matrix.python-version == 3.8", "run": "./scripts/push_docs.sh", "env": {"GH_TOKEN": "${{ secrets.DOCS_GH_TOKEN }}"}}]}, "tests": {"runs-on": "ubuntu-latest", "strategy": {"matrix": {"python-version": [3.7, 3.8], "node-version": ["12.x"]}, "fail-fast": false}, "services": {"rabbitmq": {"image": "rabbitmq:latest", "ports": ["5672:5672"], "options": "--health-cmd \"rabbitmqctl node_health_check\" --health-interval 6s --health-timeout 5s --health-retries 10"}, "redis": {"image": "redis:latest", "ports": ["6379:6379"], "options": "--entrypoint redis-server"}, "postgres": {"image": "postgres:latest", "env": {"POSTGRES_USER": "postgres", "POSTGRES_PASSWORD": "postgres", "POSTGRES_DB": "postgres"}, "ports": ["5432:5432"], "options": "--health-cmd pg_isready --health-interval 6s --health-timeout 5s --health-retries 9"}}, "steps": [{"name": "Set up repo", "uses": "actions/checkout@v2"}, {"name": "Set up Python ${{ matrix.python-version }}", "uses": "actions/setup-python@v2", "with": {"python-version": "${{ matrix.python-version }}"}}, {"name": "Set up pip cache", "uses": "actions/cache@v2", "with": {"path": "~/.cache/pip", "key": "pip-${{ matrix.python-version }}"}}, {"name": "Set up packages", "run": "set -e\n\npip install -U pip setuptools\npip install -U \\\n flake8 pylint pylint-django pylint-plugin-utils isort black==20.8b1 autopep8 \\\n coverage coveralls pyyaml\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n"}, {"name": "Copy secret.py", "run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py"}, {"name": "Set up Node.js ${{ matrix.node-version }}", "uses": "actions/setup-node@v1", "with": {"node-version": "${{ matrix.node-version }}"}}, {"name": "Install Sass and add Node modules bin to PATH", "run": "set -e\nnpm install sass\necho \"PATH=${{ github.workspace }}/node_modules/.bin:$PATH\" >> $GITHUB_ENV\n"}, {"name": "Set and create PGPASSFILE", "run": "set -e\nPGPASSFILE=${{ runner.temp }}/.pgpass\necho \"PGPASSFILE=$PGPASSFILE\" >> $GITHUB_ENV\necho 127.0.0.1:5432:postgres:postgres:postgres >$PGPASSFILE\nchmod 600 $PGPASSFILE\n"}, {"name": "Create database", "run": "psql -U postgres -h 127.0.0.1 -c 'create database ion'"}, {"name": "install Kerberos", "run": "sudo apt install -y krb5-user"}, {"name": "Run tests", "run": "coverage run ./setup.py test"}, {"name": "Migrate database", "run": "coverage run -a ./manage.py migrate"}, {"name": "Collect static files", "run": "coverage run -a ./manage.py collectstatic --noinput -v 0"}, {"name": "Report coverage to Coveralls", "uses": "AndreMiras/coveralls-python-action@develop", "with": {"parallel": true}}, {"name": "Build coverage XML file", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "run": "coverage xml"}, {"name": "Report coverage to Codacy", "uses": "codacy/codacy-coverage-reporter-action@master", "if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", "with": {"coverage-reports": "coverage.xml", "project-token": "${{ secrets.CODACY_PROJECT_TOKEN }}"}}]}, "finish_success": {"needs": ["linting", "formatting", "build", "tests"], "runs-on": "ubuntu-latest", "steps": [{"name": "Tell Coveralls that parallel jobs have finished", "uses": "coverallsapp/github-action@master", "with": {"github-token": "${{ secrets.GITHUB_TOKEN }}", "parallel-finished": true}}]}}}
5 changes: 1 addition & 4 deletions ci/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ jobs:
- *copy_secret

- name: Regenerate workflow YAML file and check for changes
run: |
set -e
pip install pyyaml
./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py
run: ./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already a part of #1143.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I figured I'd just rebase whichever one goes in second as otherwise I'd have to muck around w/ downgrading my local setuptools to work around this.


# Build docs/sources
- name: Build docs
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_sources.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
cd "$(dirname -- "$(readlink -f -- "$0")")/.."
exec ./setup.py egg_info
./setup.py egg_info
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup

Expand Down