Skip to content

Bump actions/setup-python from 2 to 4 #216

Bump actions/setup-python from 2 to 4

Bump actions/setup-python from 2 to 4 #216

---
name: Test AutoPkg Release Nupkg
# based upon: https://github.com/autopkg/recipes/blob/master/AutoPkg/AutoPkgGitMaster.nupkg.recipe
on:
push:
paths:
- ".github/workflows/AutoPkgReleaseNupkg.yaml"
- "AutoPkgRecipe/AutoPkgReleaseSource.download.recipe.yaml"
- "AutoPkgRecipe/AutoPkgRelease.nupkg.recipe.yaml"
pull_request:
paths:
- ".github/workflows/AutoPkgReleaseNupkg.yaml"
- "AutoPkgRecipe/AutoPkgReleaseSource.download.recipe.yaml"
- "AutoPkgRecipe/AutoPkgRelease.nupkg.recipe.yaml"
jobs:
AutoPkgNupkg:
runs-on: windows-latest
steps:
# only needed on self hosted windows runners:
- name: set powershell execution policy CurrentUser
if: runner.os == 'Windows'
shell: cmd
run: powershell -command "Set-ExecutionPolicy -Force -ExecutionPolicy RemoteSigned -Scope CurrentUser"
- name: Set token
# required for githubreleaseinfoprovider in github actions
# without this, API limits will be hit
run: |
cd ~
echo ${{ secrets.GITHUB_TOKEN }} > ".autopkg_gh_token"
- uses: actions/checkout@v3
- name: checkout autopkg dev
uses: actions/checkout@v3
with:
repository: autopkg/autopkg
path: autopkg
ref: dev
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache-dependency-path: |
autopkg/gh_actions_requirements.txt
requirements.txt
- name: Install AutoPkg Reqirements
run: pip install --requirement autopkg/gh_actions_requirements.txt
- name: Install requirements
run: pip install --requirement requirements.txt
- name: create empty config windows
# https://stackoverflow.com/questions/57946173/github-actions-run-step-on-specific-os
if: runner.os == 'Windows'
shell: cmd
run: |
if not exist "%USERPROFILE%/AppData/Local/Autopkg" mkdir "%USERPROFILE%/AppData/Local/Autopkg"
if not exist "%USERPROFILE%/AppData/Local/Autopkg/config.json" echo {} > "%USERPROFILE%/AppData/Local/Autopkg/config.json"
- name: create default autopkg config file Linux
if: runner.os == 'Linux'
run: |
cd ~ && mkdir -p .config/Autopkg
cd ~ && echo {} > .config/Autopkg/config.json
- name: run test recipe autopkg
run: python autopkg/Code/autopkg run -v Test-Recipes/AutopkgCore.test.recipe.yaml
- name: run nupkg recipe
run: python autopkg/Code/autopkg run -v AutoPkgRecipe/AutoPkgRelease.nupkg.recipe.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: chocolately install python
# python versions: 3.8.10, 3.9.12, 3.10.5
# run: choco install python3 --version 3.9 --no-progress --yes --force --force-dependencies
- name: test chocolately install autopkg.nupkg
run: choco install autopkg -s "~\Library\AutoPkg\Cache\com.github.jgstew.nupkg.AutoPkg\nupkgs\" --no-progress --yes --force --force-dependencies --verbose
- name: test autopkg chocolately install
run: autopkg run -v Test-Recipes/AutopkgCore.test.recipe.yaml
# - name: Get Choco log contents if failure occurs
# if: ${{ failure() }}
# # should upload artifact instead
# run: cat C:\ProgramData\chocolatey\logs\chocolatey.log
# Related:
# - https://github.com/jgstew/bigfix-content/blob/master/.github/workflows/autopkg.yaml