-
Notifications
You must be signed in to change notification settings - Fork 377
145 lines (118 loc) · 4.41 KB
/
argilla-v1.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Build Argilla (v1) package
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- main
- develop
- releases/**
pull_request:
paths:
- "argilla-v1/**"
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
working-directory: argilla-v1
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v4
- name: Setup Conda Env 🐍
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
activate-environment: argilla
- name: Get date for conda cache
id: get-date
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
shell: bash
- name: Cache Conda env
uses: actions/cache@v3
id: cache
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('argilla-v1/environment_dev.yml') }}-${{ env.CACHE_NUMBER }}
- name: Update environment
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n argilla -f environment_dev.yml
- name: Cache pip 👜
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ env.CACHE_NUMBER }}-${{ hashFiles('pyproject.toml') }}
- name: Set huggingface hub credentials
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/releases')
run: |
echo "HF_HUB_ACCESS_TOKEN=${{ secrets.HF_HUB_ACCESS_TOKEN }}" >> "$GITHUB_ENV"
echo "Enable HF access token"
- name: Run unit tests 📈
run: |
pip install -e ".[server,listeners]"
pytest tests/unit -vs
- name: Run tests with pandas v2 📈
run: |
pip install "pandas~=2.0" pytest-custom_exit_code
pytest --suppress-no-test-exit-code tests/unit -vs
- name: Run tests with pydantic v2 📈
run: |
pip install "pydantic~=2.0" pytest-custom_exit_code
pytest --suppress-no-test-exit-code tests/unit -vs
- name: Build Package 🍟
run: |
pip install -U build
rm -rf dist && python -m build
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: argilla-v1
path: argilla-v1/dist
# This job will upload a Python Package using Twine when a release is created
# For more information see:
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
publish_release:
name: Publish Release
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
permissions:
# This permission is needed for private repositories.
# contents: read
# IMPORTANT: this permission is mandatory for trusted publishing on PyPI
id-token: write
# This permission is needed for creating tags
contents: write
needs:
- build
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v4
- name: Download python package
uses: actions/download-artifact@v4
with:
name: argilla-v1
path: dist
- name: Read package info
run: |
pip install --no-deps dist/*.whl
PACKAGE_VERSION=$(python -c 'from importlib.metadata import version; print(version("argilla-v1"))')
PACKAGE_NAME=argilla-v1
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
echo "$PACKAGE_NAME==$PACKAGE_VERSION"
- name: Publish Package to TestPyPI 🥪
uses: pypa/gh-action-pypi-publish@release/v1
continue-on-error: true
with:
repository-url: https://test.pypi.org/legacy/
- name: Test Installing 🍿
continue-on-error: true
run: pip install --upgrade --no-deps --force-reinstall --index-url https://test.pypi.org/simple $PACKAGE_NAME==$PACKAGE_VERSION
- name: Publish Package to PyPI 🥩
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1