mirror of
https://github.com/DMOJ/online-judge.git
synced 2024-11-25 16:32:37 +08:00
56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
name: build
|
|
on: [push, pull_request]
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python 3.7
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.7'
|
|
- name: Install flake8
|
|
run: pip install flake8 flake8-import-order flake8-future-import flake8-commas flake8-logging-format flake8-quotes
|
|
- name: Lint with flake8
|
|
run: |
|
|
flake8 --version
|
|
flake8
|
|
unit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python 3.7
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.7'
|
|
- name: Cache pip
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: pip-${{ runner.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('requirements.txt') }}
|
|
- name: Install unit test dependencies
|
|
run: |
|
|
pip install wheel
|
|
pip install -r requirements.txt
|
|
pip install mysqlclient coverage
|
|
cp .ci.settings.py dmoj/local_settings.py
|
|
- name: Start MySQL
|
|
run: sudo systemctl start mysql.service
|
|
- name: Run unit tests
|
|
run: coverage run --source=. manage.py test judge
|
|
- name: Generate coverage report
|
|
run: coverage xml
|
|
- uses: codecov/codecov-action@v4
|
|
styles:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Node 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
- name: Install npm packages
|
|
run: npm install -g sass postcss-cli postcss autoprefixer
|
|
- name: Build style.css
|
|
run: ./make_style.sh
|