From d2d05000b14b1d8bffc83040d268f30faf03a9d4 Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Thu, 18 Jun 2020 21:46:17 -0400 Subject: [PATCH 1/4] Switch test and build workflows to use a matrix of Python versions. We claim to support Python versions 3.6, 3.7, and 3.8 in setup.py, but we only test and build on Python 3.8. If we claim support for a version then I believe we should be testing and building on that version to ensure "advertised" compatibility. --- .github/workflows/build.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7237b5a..fe5337e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,11 +49,14 @@ jobs: run: pre-commit run --all-files test: runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: ${{ matrix.python_version }} - name: Store installed Python version run: | echo "::set-env name=PY_VERSION::"\ @@ -84,11 +87,14 @@ jobs: build: runs-on: ubuntu-latest needs: [lint, test] + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - name: Store installed Python version run: | echo "::set-env name=PY_VERSION::"\ @@ -112,5 +118,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v1 with: - name: dist + name: dist-${{ matrix.python-version }} path: dist From 6f6f5972fac972fc150286d571eeb5aabb44a2fc Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Thu, 18 Jun 2020 21:56:58 -0400 Subject: [PATCH 2/4] Fix typo and use matrix.python-version instead of env.PY_VERSION. In workflows using the Python version matrix we should just use the version for that run instead of extracting the Python version from the environment. --- .github/workflows/build.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe5337e..8bf777b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,19 +56,15 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: ${{ matrix.python_version }} - - name: Store installed Python version - run: | - echo "::set-env name=PY_VERSION::"\ - "$(python -c "import platform;print(platform.python_version())")" + python-version: ${{ matrix.python-version }} - name: Cache pip test requirements uses: actions/cache@v1 with: path: ${{ env.PIP_CACHE_DIR }} - key: "${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}-\ + key: "${{ runner.os }}-pip-test-py${{ matrix.python-version }}-\ ${{ hashFiles('**/requirements-test.txt') }}" restore-keys: | - ${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}- + ${{ runner.os }}-pip-test-py${{ matrix.python-version }}- ${{ runner.os }}-pip-test- ${{ runner.os }}-pip- - name: Install dependencies @@ -95,18 +91,14 @@ jobs: - uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} - - name: Store installed Python version - run: | - echo "::set-env name=PY_VERSION::"\ - "$(python -c "import platform;print(platform.python_version())")" - name: Cache pip build requirements uses: actions/cache@v1 with: path: ${{ env.PIP_CACHE_DIR }} - key: "${{ runner.os }}-pip-build-py${{ env.PY_VERSION }}-\ + key: "${{ runner.os }}-pip-build-py${{ matrix.python-version }}-\ ${{ hashFiles('**/requirements.txt') }}" restore-keys: | - ${{ runner.os }}-pip-build-py${{ env.PY_VERSION }}- + ${{ runner.os }}-pip-build-py${{ matrix.python-version }}- ${{ runner.os }}-pip-build- ${{ runner.os }}-pip- - name: Install dependencies From 340224664cf8102a40205407d32ebbd11e2fbbab Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Fri, 19 Jun 2020 01:37:39 -0400 Subject: [PATCH 3/4] Use full argument style in build.sh pip call. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 9e06bdf..bb02ac1 100755 --- a/build.sh +++ b/build.sh @@ -33,7 +33,7 @@ pip install --upgrade pip ### # Install local example AWS lambda (eal) and requirements. ### -pip install -r requirements.txt +pip install --requirement requirements.txt ### # Leave the Python virtual environment. From f582afbe595f4781eab17cc8666ba920a93bd50f Mon Sep 17 00:00:00 2001 From: Nicholas McDonnell <50747025+mcdonnnj@users.noreply.github.com> Date: Fri, 19 Jun 2020 10:58:04 -0400 Subject: [PATCH 4/4] Change Actions workflow to have separate build workflows Add in the skeleton-python-library build workflow and change the existing build workflow to build_lambda. This reflects the fact that building the base code is different from generating a lambda artifact. --- .github/workflows/build.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77b03cc..6382504 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,6 +83,38 @@ jobs: build: runs-on: ubuntu-latest needs: [lint, test] + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Cache pip build requirements + uses: actions/cache@v1 + with: + path: ${{ env.PIP_CACHE_DIR }} + key: "${{ runner.os }}-pip-build-py${{ matrix.python-version }}-\ + ${{ hashFiles('**/requirements.txt') }}" + restore-keys: | + ${{ runner.os }}-pip-build-py${{ matrix.python-version }}- + ${{ runner.os }}-pip-build- + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + pip install --upgrade --requirement requirements.txt + - name: Build artifacts + run: python3 setup.py sdist bdist_wheel + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: dist-${{ matrix.python-version }} + path: dist + build_lambda: + runs-on: ubuntu-latest + needs: build steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1