Skip to content

Commit

Permalink
Improve CI (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thilas authored Jun 25, 2023
1 parent aaafb2a commit 950c935
Show file tree
Hide file tree
Showing 21 changed files with 89 additions and 291 deletions.
82 changes: 34 additions & 48 deletions .github/workflows/.common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,52 +35,32 @@ jobs:

- name: Install AU
run: |
git clone -q https://github.com/Thilas/au.git $Env:TEMP/au
. "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version
- name: Install chocolatey-core.extension # required for several packages
run: choco install -y --no-progress chocolatey-core.extension
git clone -q https://github.com/Thilas/au.git "$env:TEMP/au"
. "$env:TEMP/au/scripts/Install-AU.ps1" $env:au_version
- name: Update packages
id: updates
run: |
$arguments = @{
Name = $Env:packages -replace ' ','' -split ','
}
if ($Env:test -ne 'true' -and $Env:force -eq 'true') {
$arguments.Force = $true
}
$script = if ($Env:test -eq 'true') {
'./test_all.ps1'
} else {
'./update_all.ps1'
}
[array] $packages = & $script @arguments -ThrowOnErrors -PassThru -UpdatesOnly | ForEach-Object {
$names = $env:packages -replace " ","" -split ","
$force = $env:force -eq "true"
[array] $packages = ./update_all.ps1 -Name $names -Force:$force | ForEach-Object {
$_ | ConvertTo-Json -Compress
}
$packages = ConvertTo-Json $packages -Compress
"Packages = $packages"
"packages=$packages" >> $Env:GITHUB_OUTPUT
"packages=$packages" >> $env:GITHUB_OUTPUT
env:
packages: ${{ inputs.packages }}
test: ${{ inputs.test }}
force: ${{ inputs.force }}
force: ${{ inputs.test || inputs.force }}
github_user_repo: ${{ github.repository }}
github_api_key: ${{ secrets.GITHUB_TOKEN }}
au_push: ${{ !inputs.test }}
api_key: ${{ secrets.CHOCOLATEY_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish report
if: always() && hashFiles('Update-AUPackages.md', 'Update-Force-Test*.md')
run: Get-Content 'Update-AUPackages.md', 'Update-Force-Test*.md' -ErrorAction SilentlyContinue >> $Env:GITHUB_STEP_SUMMARY

- name: Upload Info artifact
if: always() && hashFiles('update_info.xml')
uses: actions/upload-artifact@v3.1.2
with:
name: Info
path: update_info.xml
if: always() && hashFiles('report.md')
run: Get-Content "report.md" >> $env:GITHUB_STEP_SUMMARY

- name: Prepare Packages artifact
if: always() && hashFiles('**/*.nupkg')
Expand All @@ -90,17 +70,17 @@ jobs:
- name: Upload Packages artifact
if: always() && hashFiles('Packages/*.nupkg')
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v3
with:
name: Packages
path: Packages/*.nupkg

outputs:
updates: ${{ steps.updates.outputs.packages }}

packages:
test:
needs: [update]
if: needs.update.outputs.updates != 'null'
needs: update

strategy:
fail-fast: false
Expand All @@ -115,47 +95,53 @@ jobs:
timeout-minutes: 20

env:
PackageName: ${{ fromJSON(matrix.package).name }}
PackageVersion: ${{ fromJSON(matrix.package).version }}
package_name: ${{ fromJSON(matrix.package).name }}
package_version: ${{ fromJSON(matrix.package).version }}

steps:
- name: Remove package if installed
- name: Remove package if needed
run: |
if (choco list -r --local `"$Env:PackageName`") {
choco uninstall -y --no-progress `"$Env:PackageName`"
if (choco list -r $env:package_name) {
choco uninstall -y --no-progress $env:package_name
}
- name: Download Packages artifact
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v3
with:
name: Packages

- name: Install package
run: |
choco install -y --no-progress `"$Env:PackageName`" --version `"$Env:PackageVersion`" --source `"'.;https://community.chocolatey.org/api/v2/'`" --force --debug
$debug = if ($env:debug) { "--verbose --debug" }
choco install -y --no-progress $env:package_name --version $env:package_version --source "'.;https://community.chocolatey.org/api/v2/'" $debug
if ($LASTEXITCODE -in 1641, 3010) { exit 0 }
env:
debug: ${{ runner.debug }}
timeout-minutes: 10

- name: Determine package information path
id: information
run: |
$path = Join-Path $Env:ChocolateyInstall ".chocolatey/$Env:PackageName.$Env:PackageVersion"
$path = $path -replace '\\', '/'
$path = Join-Path $env:ChocolateyInstall ".chocolatey/$env:package_name.$env:package_version"
$path = $path -replace "\\", "/"
Get-ChildItem $path
"path=$path" >> $Env:GITHUB_OUTPUT
"path=$path" >> $env:GITHUB_OUTPUT
- name: Upload Information artifact
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v3
with:
name: Information ${{ env.PackageName }} ${{ env.PackageVersion }} on ${{ matrix.os }}
name: Information ${{ env.package_name }} ${{ env.package_version }} on ${{ matrix.os }}
path: ${{ steps.information.outputs.path }}

- name: Uninstall package
# AirServer requires Wireless-Networking while uninstalling, feature not installed on GitHub agents
if: env.PackageName != 'airserver'
if: env.package_name != 'airserver'
run: |
choco uninstall -y --no-progress `"$Env:PackageName`" --debug
$debug = if ($env:debug) { "--verbose --debug" }
choco uninstall -y --no-progress $env:package_name $debug
if ($LASTEXITCODE -in 1605, 1614, 1641, 3010) { exit 0 }
env:
debug: ${{ runner.debug }}
timeout-minutes: 10

- name: Take failure screenshot
Expand All @@ -166,7 +152,7 @@ jobs:
- name: Upload failure screenshot into Information artifact
if: failure()
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v3
with:
name: Information ${{ env.PackageName }} ${{ env.PackageVersion }} on ${{ matrix.os }}
name: Information ${{ env.package_name }} ${{ env.package_version }} on ${{ matrix.os }}
path: desktop.png
3 changes: 1 addition & 2 deletions .github/workflows/airserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ on:
- .github/workflows/airserver.yml
- airserver/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 5 0-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/eclipse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/eclipse.yml
# - .github/workflows/eclipse.yml
- eclipse/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 15 0-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/hashcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/hashcheck.yml
# - .github/workflows/hashcheck.yml
- hashcheck/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 25 0-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ilspy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/ilspy.yml
# - .github/workflows/ilspy.yml
- ilspy/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 35 0-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/imdisk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/imdisk.yml
# - .github/workflows/imdisk.yml
- imdisk/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 45 0-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/kodi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/kodi.yml
# - .github/workflows/kodi.yml
- kodi/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 55 0-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/lavfilters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/lavfilters.yml
# - .github/workflows/lavfilters.yml
- lavfilters/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 5 1-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/marble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/marble.yml
# - .github/workflows/marble.yml
- marble/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 15 1-23/6 * * * # Scheduled update
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/procexp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ on:
- .github/workflows/procexp.yml
- procexp/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 25 1-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/procmon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/procmon.yml
# - .github/workflows/procmon.yml
- procmon/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 35 1-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/sabnzbd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/sabnzbd.yml
# - .github/workflows/sabnzbd.yml
- sabnzbd/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 45 1-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/serviio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/serviio.yml
# - .github/workflows/serviio.yml
- serviio/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 55 1-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/stellarium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/stellarium.yml
# - .github/workflows/stellarium.yml
- stellarium/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 5 2-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/strawberryperl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/strawberryperl.yml
# - .github/workflows/strawberryperl.yml
- strawberryperl/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 15 2-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/subtitleedit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/subtitleedit.yml
# - .github/workflows/subtitleedit.yml
- subtitleedit/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 25 2-23/6 * * * # Scheduled update
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/vscodium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ on:
branches: [master]
paths:
- .github/workflows/.common.yml
- .github/workflows/vscodium.yml
# - .github/workflows/vscodium.yml
- vscodium/**
- vscodium.*/**
- Common.ps1
- test_all.ps1
- update_vars.ps1
- update_all.ps1
schedule:
- cron: 0 4 * * * # Scheduled test
- cron: 35 2-23/6 * * * # Scheduled update
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Thomas Démoulins, Miodrag Milić
Copyright (c) 2023 Thomas Démoulins, Miodrag Milić

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 950c935

Please sign in to comment.