Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: actions/setup-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.3.1
Choose a base ref
...
head repository: actions/setup-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.4.0
Choose a head ref
  • 3 commits
  • 14 files changed
  • 3 contributors

Commits on Dec 19, 2022

  1. refactor: Use early return pattern to avoid nested conditions (#566)

    * refactor: Use early return pattern
    
    Signed-off-by: jongwooo <jongwooo.han@gmail.com>
    
    * fix: Replace throw with warn
    
    Signed-off-by: jongwooo <jongwooo.han@gmail.com>
    
    Signed-off-by: jongwooo <jongwooo.han@gmail.com>
    jongwooo authored Dec 19, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    206e984 View commit details

Commits on Dec 22, 2022

  1. Update action to use reusable workflows (#569)

    * Update workflows to use reusable-workflows
    
    * Update licensed.yml
    
    * Update workflows
    
    * Add links to reusable workflows
    
    * Update action to use reusable-workflows repo
    
    * Fix review points
    IvanZosimov authored Dec 22, 2022
    Copy the full SHA
    c3e0339 View commit details
  2. Copy the full SHA
    5ccb29d View commit details
15 changes: 15 additions & 0 deletions .github/workflows/basic-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Basic validation

on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
call-basic-validation:
name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
41 changes: 3 additions & 38 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/

on:
@@ -17,36 +12,6 @@ on:
workflow_dispatch:

jobs:
check-dist:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm

- name: Install dependencies
run: npm ci

- name: Rebuild the dist/ directory
run: npm run build

- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
call-check-dist:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
44 changes: 5 additions & 39 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,13 @@
name: "Code scanning - action"
name: CodeQL analysis

on:
push:
branches: [ 'main' ]
pull_request:
schedule:
- cron: '25 3 * * 5'
- cron: '0 3 * * 0'

jobs:
CodeQL-Build:

strategy:
fail-fast: false

# CodeQL runs on ubuntu-latest and windows-latest
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
call-codeQL-analysis:
name: CodeQL analysis
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
25 changes: 6 additions & 19 deletions .github/workflows/workflow.yml → .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Main workflow
name: e2e tests

on:
push:
branches:
@@ -8,9 +9,10 @@ on:
pull_request:
paths-ignore:
- '**.md'

jobs:
run:
name: Run
test-setup-python:
name: Test setup-python
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
@@ -19,21 +21,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm

- name: npm ci
run: npm ci

- name: Lint
run: npm run format-check

- name: npm test
run: npm test

- name: Run with setup-python 2.7
uses: ./
with:
@@ -98,4 +85,4 @@ jobs:
- name: Verify 3.10
run: python __tests__/verify-python.py 3.10
- name: Run python-path sample 3.10
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
21 changes: 3 additions & 18 deletions .github/workflows/licensed.yml
Original file line number Diff line number Diff line change
@@ -9,21 +9,6 @@ on:
- main

jobs:
test:
runs-on: ubuntu-latest
name: Check licenses
steps:
- uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- run: npm ci
- name: Install licensed
run: |
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status
call-licensed:
name: Licensed
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
3 changes: 2 additions & 1 deletion .github/workflows/release-new-action-version.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release new action version

on:
release:
types: [released]
@@ -24,4 +25,4 @@ jobs:
uses: actions/publish-action@v0.2.1
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
43 changes: 43 additions & 0 deletions .github/workflows/test-pypy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Validate PyPy e2e

on:
push:
branches:
@@ -123,4 +124,46 @@ jobs:
EXECUTABLE=${EXECUTABLE/-/} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
${EXECUTABLE} --version
shell: bash

setup-pypy-multiple-versions:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Setup PyPy and check latest
uses: ./
with:
python-version: |
pypy-3.7-v7.3.x
pypy3.8
check-latest: true
- name: PyPy and Python version
run: python --version

- name: Run simple code
run: python -c 'import math; print(math.factorial(5))'

- name: Assert PyPy is running
run: |
import platform
assert platform.python_implementation().lower() == "pypy"
shell: python

- name: Assert expected binaries (or symlinks) are present
run: |
EXECUTABLE="pypy-3.7-v7.3.x"
EXECUTABLE=${EXECUTABLE/-/} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
${EXECUTABLE} --version
shell: bash
- name: Assert expected binaries (or symlinks) are present
run: |
EXECUTABLE='pypy3.8'
EXECUTABLE=${EXECUTABLE/pypy-/pypy} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
${EXECUTABLE} --version
shell: bash
32 changes: 30 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Validate Python e2e

on:
push:
branches:
@@ -190,8 +191,35 @@ jobs:
- name: Validate version
run: |
$pythonVersion = (python --version)
if ("$pythonVersion" -NotMatch "${{ matrix.python }}"){
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
if ("$pythonVersion" -NotMatch "${{ matrix.python-version }}"){
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python-version }}"
exit 1
}
$pythonVersion
shell: pwsh

setup-python-multiple-python-versions:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Setup Python and check latest
uses: ./
with:
python-version: |
3.7
3.8
3.9
3.10
check-latest: true
- name: Validate version
run: |
$pythonVersion = (python --version)
if ("$pythonVersion" -NotMatch "3.10"){
Write-Host "The current version is $pythonVersion; expected version is 3.10"
exit 1
}
$pythonVersion
11 changes: 5 additions & 6 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
@@ -42,14 +42,13 @@ describe('validateVersion', () => {
describe('isCacheFeatureAvailable', () => {
it('isCacheFeatureAvailable disabled on GHES', () => {
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
const infoMock = jest.spyOn(core, 'warning');
const message =
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.';
try {
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
isCacheFeatureAvailable();
} catch (error) {
expect(error).toHaveProperty(
'message',
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
);
expect(isCacheFeatureAvailable()).toBeFalsy();
expect(infoMock).toHaveBeenCalledWith(message);
} finally {
delete process.env['GITHUB_SERVER_URL'];
}
Loading