Skip to content

Commit

Permalink
♻️ REFAC: build sys, pre-commit, release all updated
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Mar 11, 2022
1 parent 502df5f commit b421096
Show file tree
Hide file tree
Showing 90 changed files with 4,254 additions and 3,865 deletions.
3 changes: 2 additions & 1 deletion .aiida-testing-config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
mock_code:
# code-label: absolute path
pw67: /usr/local/bin/pw.x
pw67: /usr/local/bin/pw.x
33 changes: 0 additions & 33 deletions .github/check_version.py

This file was deleted.

6 changes: 0 additions & 6 deletions .github/install_aiida_github.sh

This file was deleted.

125 changes: 17 additions & 108 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,118 +1,27 @@
name: Continuous Integration
---
# Run basic tests for this app on the latest aiidalab-docker image.

name: continuous-integration

on: [push, pull_request]

jobs:

docs:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Cache python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-docs-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-docs-

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install python dependencies
run:
pip install -e .[docs]

- name: Build documentation
env:
READTHEDOCS: 'True'
run:
SPHINXOPTS='-nW' make -C docs html

pre-commit:
# Adapted from: https://github.com/CasperWA/voila-optimade-client

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Cache python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-pre-commit-

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install python dependencies
run: |
pip install -e .[pre-commit,tests]
- name: Run pre-commit
run:
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )

tests:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.7, 3.8, 3.9]

services:
postgres:
image: postgres:10
env:
POSTGRES_DB: test_${{ matrix.backend }}
POSTGRES_PASSWORD: ''
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672

steps:
- uses: actions/checkout@v1

- name: Cache python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-${{ matrix.python-version }}-tests

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
run: |
sudo apt update
sudo apt install postgresql-12
- name: Install python dependencies
run: |
pip install -e .[tests]
reentry scan
- name: Run pytest
run:
pytest -sv tests
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install pre-commit==2.11.1
- name: Run pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
27 changes: 0 additions & 27 deletions .github/workflows/publish-on-pypi.yml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: Release

on:
push:
tags:
- v*
branches:
- release/*

jobs:

build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install pypa/build
run: python -m pip install build

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Upload distribution artifact
uses: actions/upload-artifact@v2
with:
name: release
path: dist/

publish:

needs: [build]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
name: Download distribution artifact
with:
name: release
path: dist/

- name: Publish distribution on Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/heads/release/')
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true

- uses: softprops/[email protected]
name: Create release
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
dist/*
generate_release_notes: true

- name: Publish distribution on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags/v')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
Loading

0 comments on commit b421096

Please sign in to comment.