-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Package poetry from master, use it in actions
- Loading branch information
Showing
5 changed files
with
196 additions
and
1,969 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,35 +21,22 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
- name: Install poetry | ||
shell: bash | ||
run: | | ||
pip install poetry | ||
poetry config virtualenvs.in-project true | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
|
||
- name: Load dependency cache | ||
id: load-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: app-${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }} | ||
- name: Install dependencies | ||
run: poetry install | ||
if: steps.load-cache.outputs.cache-hit != 'true' | ||
run: nix develop -c poetry install | ||
|
||
- name: Check code style | ||
if: github.event_name != 'push' | ||
run: | | ||
poetry run black --check --diff . | ||
poetry run isort --check --diff . | ||
nix develop -c poetry run black --check --diff . | ||
nix develop -c poetry run isort --check --diff . | ||
- name: Reformat code | ||
if: github.event_name == 'push' | ||
run: | | ||
poetry run black . | ||
poetry run isort . | ||
nix develop -c poetry run black . | ||
nix develop -c poetry run isort . | ||
- name: Commit chanes | ||
if: github.event_name == 'push' | ||
shell: bash | ||
|
@@ -69,26 +56,19 @@ jobs: | |
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
- name: Install poetry | ||
shell: bash | ||
run: | | ||
pip install poetry | ||
poetry config virtualenvs.in-project true | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
- name: Load dependency cache | ||
id: load-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: app-${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }} | ||
- name: Install dependencies | ||
run: poetry install | ||
run: nix develop -c poetry install | ||
if: steps.load-cache.outputs.cache-hit != 'true' | ||
|
||
- name: Release | ||
|
@@ -97,14 +77,12 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
source .venv/bin/activate | ||
git config --global user.name "github-actions" | ||
git config --global user.email "[email protected]" | ||
export GH_TOKEN="${GITHUB_TOKEN}" | ||
export REPOSITORY_USERNAME="__token__" | ||
export REPOSITORY_PASSWORD="${PYPI_TOKEN}" | ||
python -m semantic_release publish -D commit_author="github-actions <[email protected]>" | ||
nix develop -c poetry run python -m semantic_release publish -D commit_author="github-actions <[email protected]>" | ||
- name: Save release commit hash | ||
id: release-commit-hash | ||
run: echo "::set-output name=release-commit-hash::$(git rev-parse HEAD)" | ||
|
@@ -126,4 +104,3 @@ jobs: | |
with: | ||
commit-hash: ${{ needs.Release.outputs.release-commit-hash }} | ||
secrets: inherit | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ pkgs }: | ||
let | ||
poetry-core = pkgs.python3Packages.poetry-core.overrideAttrs (old: { | ||
version = "2.0.0.dev0"; | ||
src = pkgs.fetchFromGitHub { | ||
owner = "python-poetry"; | ||
repo = "poetry-core"; | ||
rev = "4749d63c822147b0dbaa82033c02628f92c97200"; | ||
hash = "sha256-who4WpQXaA83e+Z6TN73bDSkPpNaFsjn1DIqYIVUEqk="; | ||
}; | ||
|
||
doCheck = false; | ||
pytestCheckPhase = ''true''; | ||
}); | ||
in | ||
pkgs.poetry.overridePythonAttrs (old: { | ||
version = "2.0.0.dev0"; | ||
|
||
src = pkgs.fetchFromGitHub { | ||
owner = "python-poetry"; | ||
repo = "poetry"; | ||
rev = "625f42ef96f8321f4e1649f38e39e71cd2b09f3e"; | ||
hash = "sha256-tBim3dlKdkcvWWGavHpv52HAZX1FvPh2S+FTKPMrZVs="; | ||
}; | ||
|
||
propagatedBuildInputs = builtins.map ( | ||
x: if x.pname or "" == "poetry-core" then poetry-core else x | ||
) old.propagatedBuildInputs; | ||
|
||
pythonRelaxDeps = [ | ||
"dulwich" | ||
"keyring" | ||
"virtualenv" | ||
"pkginfo" | ||
]; | ||
|
||
doCheck = false; | ||
postInstall = null; | ||
}) |
Oops, something went wrong.