Skip to content

Commit

Permalink
move to depot for CI (pypi#15622)
Browse files Browse the repository at this point in the history
* move to depot for CI

* flaky test
  • Loading branch information
ewdurbin authored Mar 18, 2024
1 parent 4ce4e55 commit c8b964b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 168 deletions.
75 changes: 32 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,66 @@ on:
types: [checks_requested]
workflow_dispatch: # generally only for the "combine-prs" workflow
permissions:
id-token: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
deps:
runs-on: ubuntu-latest
build:
if: github.repository == 'pypi/warehouse'
runs-on: depot-ubuntu-22.04
outputs:
buildId: ${{ steps.build.outputs.build-id}}
token: ${{ steps.pull-token.outputs.token }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install platform dependencies
run: |
sudo apt -y update
sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config libxml2-dev libxslt-dev
- uses: actions/setup-python@v5
- name: Set up Depot CLI
uses: depot/setup-action@v1
with:
python-version-file: '.python-version'
- name: pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}
- name: Cache built Python environment
uses: actions/cache@v4
oidc: true
- name: Build image
id: build
uses: depot/build-push-action@v1
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements/*.txt') }}
- name: Install Python dependencies
run: |
pip install -U setuptools wheel pip
pip install -r requirements.txt --no-deps
pip install -r requirements/dev.txt
pip check
save: true
build-args: |
DEVEL=yes
CI=yes
tags: pypi/warehouse:ci-${{ github.run_id }}
- name: Export Token
id: pull-token
run: echo "token=$(depot pull-token)" >> "$GITHUB_OUTPUT"
test:
# Time out if our test suite has gotten hung
timeout-minutes: 15
needs: deps
needs: build
strategy:
matrix:
include:
- name: Tests
command: bin/tests --postgresql-host localhost
command: bin/tests --postgresql-host postgres
- name: Lint
command: bin/lint
- name: User Documentation
command: bin/user-docs
- name: Developer Documentation
command: bin/dev-docs
- name: Dependencies
command: bin/github-actions-deps
command: bin/deps
- name: Licenses
command: bin/licenses
- name: Translations
command: bin/translations
runs-on: ubuntu-latest
runs-on: depot-ubuntu-22.04
container:
image: registry.depot.dev/rltf7cln5v:${{ needs.build.outputs.buildId }}
credentials:
username: x-token
password: ${{ needs.build.outputs.token }}
env:
BILLING_BACKEND: warehouse.subscriptions.services.MockStripeBillingService api_base=http://stripe:12111 api_version=2020-08-27
services:
postgres:
image: ${{ (matrix.name == 'Tests') && 'postgres:14.11' || '' }}
Expand All @@ -77,31 +82,15 @@ jobs:
ports:
- 12111:12111
name: ${{ matrix.name }}
env:
BILLING_BACKEND: warehouse.subscriptions.services.MockStripeBillingService api_base=http://localhost:12111 api_version=2020-08-27
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install platform dependencies
run: |
sudo apt -y update
sudo apt -y install libcurl4-openssl-dev libssl-dev pkg-config libxml2-dev libxslt-dev
- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Cache mypy results
if: ${{ (matrix.name == 'Lint') }}
uses: actions/cache@v4
with:
path: |
dev/.mypy_cache
key: ${{ runner.os }}-mypy-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements/*.txt') }}
- name: Restore built Python environment from deps
uses: actions/cache/restore@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements/*.txt') }}
# Since we don't install deps again, we fail if we can't restore the cache (timeout, etc)
fail-on-cache-miss: true
- name: Run ${{ matrix.name }}
run: ${{ matrix.command }}
96 changes: 0 additions & 96 deletions .github/workflows/provisional-ci.yml

This file was deleted.

13 changes: 0 additions & 13 deletions bin/translations-dockah

This file was deleted.

24 changes: 16 additions & 8 deletions tests/unit/organizations/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,14 @@ def test_get_organization_by_name(self, organization_service):
def test_get_organization_applications_by_name(self, organization_service):
app0 = OrganizationApplicationFactory.create(name="pypi")
app1 = OrganizationApplicationFactory.create(name="PyPI")
assert organization_service.get_organization_applications_by_name("pypi") == [
app0,
app1,
]
assert sorted(
organization_service.get_organization_applications_by_name("pypi")
) == sorted(
[
app0,
app1,
]
)

def test_get_organization_applications_by_name_and_submitter(
self, organization_service
Expand Down Expand Up @@ -134,11 +138,15 @@ def test_approve_organization_application(
assert organization_application.is_approved is None
assert competing_organization_application.is_approved is None

assert organization_service.get_organization_applications_by_name(
organization_application.name
assert sorted(
organization_service.get_organization_applications_by_name(
organization_application.name
)
) == sorted([organization_application, competing_organization_application])
assert organization_service.get_organization_applications_by_name(
organization_application.name, undecided=True
assert sorted(
organization_service.get_organization_applications_by_name(
organization_application.name, undecided=True
)
) == sorted([organization_application, competing_organization_application])

assert (
Expand Down
8 changes: 0 additions & 8 deletions warehouse/locale/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,7 @@ build-mos: compile-pot
L=$$LOCALE $(MAKE) compile-po ; \
done


translations: compile-pot
ifneq ($(GITHUB_ACTIONS), false)
cd ../../; \
git diff --quiet ./warehouse/locale/messages.pot || (echo "There are outstanding translations, run 'make translations' and commit the changes."; exit 1)
else
endif

translations-dockah: compile-pot
ifneq ($(GITHUB_ACTIONS), false)
cd ../../; \
cmp -s ./warehouse/locale/messages.pot /opt/warehouse/src/warehouse/locale/messages.pot || (echo "There are outstanding translations, run 'make translations' and commit the changes."; exit 1)
Expand Down

0 comments on commit c8b964b

Please sign in to comment.