(chore) prepare for release v0.2.0 #9
Workflow file for this run
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: Main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
env: | |
# Change this to invalidate existing cache. | |
CACHE_PREFIX: v0 | |
PYTHONPATH: ./src/ | |
jobs: | |
checks: | |
name: ${{ matrix.task.name }} | |
runs-on: [ubuntu-latest] | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ['3.10'] | |
task: | |
- name: Lint | |
run: make lint-check | |
- name: Test | |
run: | | |
pytest -v --color=yes --durations=3 src/test/ | |
- name: Type check | |
run: make type-check | |
- name: Build | |
run: make build | |
- name: Style | |
run: make style-check | |
include: | |
- python: '3.9' | |
task: | |
name: Lint (min Python) | |
run: make lint-check | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python environment | |
uses: ./.github/actions/setup-venv | |
with: | |
python-version: ${{ matrix.python }} | |
cache-prefix: ${{ env.CACHE_PREFIX }} | |
- name: Restore mypy cache | |
if: matrix.task.name == 'Type check' | |
uses: actions/cache@v3 | |
with: | |
path: .mypy_cache | |
key: mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: | | |
mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-${{ github.ref }} | |
mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }} | |
- name: ${{ matrix.task.name }} | |
run: | | |
. .venv/bin/activate | |
${{ matrix.task.run }} | |
- name: Upload package distribution files | |
if: matrix.task.name == 'Build' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: package | |
path: dist | |
- name: Clean up | |
if: always() | |
run: | | |
. .venv/bin/activate | |
pip uninstall -y ai2-olmo-eval | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [checks] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python environment | |
uses: ./.github/actions/setup-venv | |
with: | |
python-version: '3.10' | |
cache-prefix: ${{ env.CACHE_PREFIX }} | |
- name: Prepare environment | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Download package distribution files | |
uses: actions/download-artifact@v3 | |
with: | |
name: package | |
path: dist | |
- name: Generate release notes | |
run: | | |
. .venv/bin/activate | |
python src/scripts/release_notes.py > ${{ github.workspace }}-RELEASE_NOTES.md | |
- name: Publish package to PyPI | |
run: | | |
. .venv/bin/activate | |
twine upload -u __token__ -p '${{ secrets.PYPI_TOKEN }}' dist/* | |
- name: Publish GitHub release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body_path: ${{ github.workspace }}-RELEASE_NOTES.md | |
prerelease: ${{ contains(env.TAG, 'rc') }} | |
files: | | |
dist/* |