Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick round of CI improvements #459

Merged
merged 6 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/check-upstream-ed25519.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@ on:
- cron: '0 13 * * *'
workflow_dispatch:

permissions: {}

jobs:
check-ed25519-upstream:
name: Open an issue if upstream ed25519 has new commits
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Test if ed25519 upstream master HEAD is what we expect
id: test_ed25519
run: |
if output=$(securesystemslib/_vendor/test-ed25519-upstream.sh); then
echo "::set-output name=result::0"
echo "result=0" >> $GITHUB_OUTPUT
else
echo "::set-output name=result::1"
echo "::set-output name=output::$output"
echo "result=1" >> $GITHUB_OUTPUT
echo "output=$output" >> $GITHUB_OUTPUT
fi
- name: Create issue (unless one is open already)
uses: actions/github-script@v3
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
if: ${{ steps.test_ed25519.outputs.result == '1' }}
with:
script: |
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,47 @@ on:
pull_request:
workflow_dispatch:

permissions: {}

jobs:
build:
strategy:
fail-fast: false
# Run tests on each OS/Python combination
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
# TODO: Add windows-latest when gpg issues are solved
os: [ubuntu-latest, macos-latest]
toxenv: [py]

include:
- python-version: 3.8
- python-version: "3.11"
os: ubuntu-latest
toxenv: purepy38
- python-version: 3.8
toxenv: purepy311
- python-version: "3.11"
os: ubuntu-latest
toxenv: py38-no-gpg
- python-version: 3.8
toxenv: py311-no-gpg
Comment on lines -24 to +29
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes result in the name of the 'check' changing and therefore breaking our branch protection policy.

- python-version: "3.8"
os: ubuntu-latest
toxenv: lint

runs-on: ${{ matrix.os }}

steps:
- name: Checkout securesystemslib
uses: actions/checkout@v2
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984
with:
python-version: ${{ matrix.python-version }}

- name: Find pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this step and the next one could be removed: setup-python now supports pip cache using with-arguments:

          cache: 'pip'
          cache-dependency-path: 'requirements*.txt'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice. Thanks for pointing this out! I just pushed an extra patch to make this change.


- name: pip cache
uses: actions/cache@v2
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
# Use the os dependent pip cache directory found above
path: ${{ steps.pip-cache.outputs.dir }}
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = lint, py37, py38, py39, py310, purepy38, py38-no-gpg, py38-test-gpg-fails
envlist = lint, py37, py38, py39, py310, py311, purepy311, py311-no-gpg, py311-test-gpg-fails
skipsdist = True

[testenv]
Expand All @@ -20,22 +20,22 @@ commands =
coverage run tests/aggregate_tests.py
coverage report -m --fail-under 97

[testenv:purepy38]
[testenv:purepy311]
deps =

commands =
python -m tests.check_gpg_available
python -m tests.check_public_interfaces

[testenv:py38-no-gpg]
[testenv:py311-no-gpg]
setenv =
GNUPG = nonexisting-gpg-for-testing
commands =
python -m tests.check_public_interfaces_gpg

# This checks that importing securesystemslib.gpg.constants doesn't shell out on
# import.
[testenv:py38-test-gpg-fails]
[testenv:py311-test-gpg-fails]
setenv =
GNUPG = false
commands =
Expand Down