Skip to content

Commit

Permalink
Better CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Thilas committed Jun 23, 2023
1 parent 1408403 commit 1093e09
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 262 deletions.
64 changes: 26 additions & 38 deletions .github/workflows/.common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,71 +16,59 @@ jobs:
update:
name: Update ${{ github.workflow }}
runs-on: windows-latest
# runs-on: ubuntu-latest
timeout-minutes: 20

env:
# Set au version to use or omit to use the latest. Specify branch name to use development version from Github
au_version: release

steps:
- name: Set up git
if: ${{ !inputs.test }}
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"
git config --global core.safecrlf false
# - name: Set up git
# if: ${{ !inputs.test }}
# run: |
# git config --global user.name "GitHub Actions Bot"
# git config --global user.email "<>"
# git config --global core.safecrlf false

- name: Checkout
uses: actions/checkout@v3

- name: Install AU
# shell: pwsh
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
# - name: Install chocolatey-core.extension # required for several packages
# run: choco install -y --no-progress chocolatey-core.extension

- name: Update packages
id: updates
# shell: pwsh
run: |
$arguments = @{
Name = $Env:packages -replace ' ','' -split ','
}
if ($Env:test -ne 'true' -and $Env:force -eq 'true') {
if ($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 {
[array] $packages = ./update_all.ps1 @arguments | ForEach-Object {
$_ | ConvertTo-Json -Compress
}
$packages = ConvertTo-Json $packages -Compress
"Packages = $packages"
"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 }}
# 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' -ErrorAction SilentlyContinue >> $Env:GITHUB_STEP_SUMMARY

- name: Prepare Packages artifact
if: always() && hashFiles('**/*.nupkg')
Expand All @@ -90,15 +78,15 @@ 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:
if: needs.update.outputs.updates != 'null'
needs: update

Expand All @@ -119,20 +107,20 @@ jobs:
PackageVersion: ${{ fromJSON(matrix.package).version }}

steps:
- name: Remove package if installed
- name: Remove package if needed
run: |
if (choco list -r --local `"$Env:PackageName`") {
if (choco list -r `"$Env:PackageName`") {
choco uninstall -y --no-progress `"$Env:PackageName`"
}
- 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
choco install -y --no-progress `"$Env:PackageName`" --version `"$Env:PackageVersion`" --source `"'.;https://community.chocolatey.org/api/v2/'`" --force --verbose --debug
if ($LASTEXITCODE -in 1641, 3010) { exit 0 }
timeout-minutes: 10

Expand All @@ -145,7 +133,7 @@ jobs:
"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 }}
path: ${{ steps.information.outputs.path }}
Expand All @@ -154,7 +142,7 @@ jobs:
# AirServer requires Wireless-Networking while uninstalling, feature not installed on GitHub agents
if: env.PackageName != 'airserver'
run: |
choco uninstall -y --no-progress `"$Env:PackageName`" --debug
choco uninstall -y --no-progress `"$Env:PackageName`" --verbose --debug
if ($LASTEXITCODE -in 1605, 1614, 1641, 3010) { exit 0 }
timeout-minutes: 10

Expand All @@ -166,7 +154,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 }}
path: desktop.png
2 changes: 1 addition & 1 deletion .github/workflows/airserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/airserver.yml
- airserver/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eclipse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/eclipse.yml
- eclipse/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hashcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/hashcheck.yml
- hashcheck/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ilspy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/ilspy.yml
- ilspy/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/imdisk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/imdisk.yml
- imdisk/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kodi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/kodi.yml
- kodi/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lavfilters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/lavfilters.yml
- lavfilters/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/marble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/marble.yml
- marble/**
- Common.ps1
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
2 changes: 1 addition & 1 deletion .github/workflows/procmon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/procmon.yml
- procmon/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sabnzbd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/sabnzbd.yml
- sabnzbd/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/serviio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/serviio.yml
- serviio/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stellarium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/stellarium.yml
- stellarium/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/strawberryperl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/strawberryperl.yml
- strawberryperl/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/subtitleedit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/subtitleedit.yml
- subtitleedit/**
- Common.ps1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vscodium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, synchronize]
branches: [master]
paths:
- .github/workflows/.common.yml
# - .github/workflows/.common.yml
- .github/workflows/vscodium.yml
- vscodium/**
- vscodium.*/**
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ The following global variables influence the execution of `update_all.ps1` scrip

```powershell
$au_NoPlugins = $true #Do not execute plugins
$au_Push = $false #Do not push to chocolatey
```

You can also call AU method `Update-AUPackages` (alias `updateall`) on its own in the repository root. This will just run the updater for the each package without any other option from `update_all.ps1` script. For example to force update of all packages with a single command execute:
Expand Down
Loading

0 comments on commit 1093e09

Please sign in to comment.