Skip to content

Commit

Permalink
Merge branch 'main' of github.com:lava-nc/lava into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bamsumit committed Aug 4, 2023
2 parents 200b3cd + 04228de commit ea55d9e
Show file tree
Hide file tree
Showing 19 changed files with 2,902 additions and 787 deletions.
98 changes: 89 additions & 9 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
lfs: true

- name: setup CI
uses: lava-nc/ci-setup-composite-action@v1.2
uses: lava-nc/ci-setup-composite-action@v1.3
with:
repository: 'Lava'

Expand Down Expand Up @@ -44,14 +44,14 @@ jobs:
with:
name: lava

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"

- name: Test artifact tar.gz
run: |
python3.9 -m venv artifact-test
python3 -m venv artifact-test
source artifact-test/bin/activate
artifact=$(ls | grep lava | grep tar)
pip install --no-input $artifact
Expand All @@ -63,7 +63,7 @@ jobs:
- name: Test artifact .whl
run: |
python3.9 -m venv artifact-test
python3 -m venv artifact-test
source artifact-test/bin/activate
artifact=$(ls | grep lava | grep whl)
pip install --no-input $artifact
Expand All @@ -85,17 +85,17 @@ jobs:
with:
name: lava

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"

- name: Test artifact tar.gz
run: |
mkdir tmp
cd tmp
cp ../lava* .
python3.9 -m venv artifact-unittest
python3 -m venv artifact-unittest
source artifact-unittest/bin/activate
pip install -U pip
pip install "nbconvert>=7.2.10,<7.3" pytest>=7.2.0 matplotlib>=3.5.1 ipykernel>=6.15.0 nbformat>=5.3.0
Expand All @@ -114,7 +114,7 @@ jobs:
mkdir tmp
cd tmp
cp ../lava* .
python3.9 -m venv artifact-unittest
python3 -m venv artifact-unittest
source artifact-unittest/bin/activate
pip install -U pip
pip install "nbconvert>=7.2.10,<7.3" pytest>=7.2.0 matplotlib>=3.5.1 ipykernel>=6.15.0 nbformat>=5.3.0
Expand All @@ -129,3 +129,83 @@ jobs:
deactivate
cd ../
rm -rf tmp
upload-release-artifact:
name: Upload release artifact
runs-on: ubuntu-latest
if: github.triggering_actor == 'mgkwill' || github.triggering_actor == 'PhilippPlank' || github.triggering_actor == 'tim-shea'
permissions:
contents: write
id-token: write
needs: [build-artifacts, test-artifact-install, test-artifact-use]

steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: setup CI
uses: lava-nc/[email protected]
with:
repository: 'Lava'

- name: Download lava artifact
uses: actions/download-artifact@v3
with:
name: lava

- name: Check Version
id: check-version
run: |
[[ "$(pipx run poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT
echo "release-version=$(pipx run poetry version --short)" >> $GITHUB_OUTPUT
echo "release-commit=$(git log -n 1 --pretty=format:"%H")" >> $GITHUB_OUTPUT
- name: Print Versions
run: |
[[ "$(pipx run poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true
echo "release-version=$(pipx run poetry version --short)"
echo "release-commit=$(git log -n 1 --pretty=format:"%H")"
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "lava*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: steps.check-version.outputs.prerelease == 'true'
name: "Lava ${{ steps.check-version.outputs.release-version }}"
commit: "${{ steps.check-version.outputs.release-commit }}"
tag: "v${{ steps.check-version.outputs.release-version }}"
discussionCategory: "Announcements"
artifactErrorsFailBuild: true
generateReleaseNotes: true
makeLatest: true

- name: Mint Github API token
id: mint-token
run: |
# retrieve the ambient OIDC token
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
oidc_token=$(jq '.value' <<< "${resp}")
# exchange the OIDC token for an API token
resp=$(curl -X POST https://pypi.org/_/oidc/github/mint-token -d "{\"token\": \"${oidc_token}\"}")
api_token=$(jq '.token' <<< "${resp}")
# mask the newly minted API token, so that we don't accidentally leak it
echo "::add-mask::${api_token}"
# see the next step in the workflow for an example of using this step output
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
- name: Publish to PyPI
if: steps.check-version.outputs.prerelease != 'true'
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ steps.mint-token.outputs.api-token }}
run: |
mkdir dist
cp lava* dist/.
poetry publish
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ cd $HOME
curl -sSL https://install.python-poetry.org | python3 -
git clone [email protected]:lava-nc/lava.git
cd lava
git checkout v0.6.0
git checkout v0.8.0
./utils/githook/install-hook.sh
poetry config virtualenvs.in-project true
poetry install
Expand All @@ -90,7 +90,7 @@ pytest
cd $HOME
git clone [email protected]:lava-nc/lava.git
cd lava
git checkout v0.6.0
git checkout v0.8.0
python3 -m venv .venv
.venv\Scripts\activate
pip install -U pip
Expand Down
Loading

0 comments on commit ea55d9e

Please sign in to comment.