diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd271365..5762af03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + + - name: Setup PMG proxy + id: pmg-setup + uses: safedep/pmg@v1 + with: + server-mode: true + api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }} + tenant-id: ${{ secrets.PMG_TENANT_ID }} - name: Set up Python 3 uses: actions/setup-python@v3 with: @@ -31,12 +39,28 @@ jobs: with: name: dist path: dist/ + + - name: Enforce PMG policy + if: always() + run: | + if [ "${{ steps.pmg-setup.outcome }}" = "success" ]; then + pmg proxy stop --fail-on-violation + else + pmg proxy stop || true + fi test: name: Test Coverage needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: Setup PMG proxy + id: pmg-setup + uses: safedep/pmg@v1 + with: + server-mode: true + api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }} + tenant-id: ${{ secrets.PMG_TENANT_ID }} - name: Set up Python 3 uses: actions/setup-python@v3 with: @@ -53,6 +77,14 @@ jobs: python -m coverage xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + - name: Enforce PMG policy + if: always() + run: | + if [ "${{ steps.pmg-setup.outcome }}" = "success" ]; then + pmg proxy stop --fail-on-violation + else + pmg proxy stop || true + fi publish: if: startsWith(github.ref, 'refs/tags/v') @@ -60,6 +92,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Setup PMG proxy + id: pmg-setup + uses: safedep/pmg@v1 + with: + server-mode: true + api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }} + tenant-id: ${{ secrets.PMG_TENANT_ID }} - name: Download all workflow run artifacts uses: actions/download-artifact@v4 with: @@ -78,4 +117,12 @@ jobs: env: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + - name: Enforce PMG policy + if: always() + run: | + if [ "${{ steps.pmg-setup.outcome }}" = "success" ]; then + pmg proxy stop --fail-on-violation + else + pmg proxy stop || true + fi diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index e3ea46df..ebe2b46a 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -21,6 +21,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Setup PMG proxy + id: pmg-setup + uses: safedep/pmg@v1 + with: + server-mode: true + api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }} + tenant-id: ${{ secrets.PMG_TENANT_ID }} - name: Set up Python uses: actions/setup-python@v2 - name: Install dependencies @@ -31,3 +38,11 @@ jobs: python3 setup.py install - name: Run Tests run: python3 -m unittest + - name: Enforce PMG policy + if: always() + run: | + if [ "${{ steps.pmg-setup.outcome }}" = "success" ]; then + pmg proxy stop --fail-on-violation + else + pmg proxy stop || true + fi