Skip to content

Commit

Permalink
Update test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Garulf authored Jan 23, 2022
1 parent 1f76d47 commit 549681f
Showing 1 changed file with 72 additions and 21 deletions.
93 changes: 72 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Test"
name: "Test Plugin"
on:
pull_request:
workflow_dispatch:
Expand All @@ -11,46 +11,99 @@ on:
- assets/*
env:
PYTHON_VER: 3.8
BRANCH: 'main'
jobs:
deps:
name: "Test"
test_run:
name: "Test Run"
runs-on: windows-latest
strategy:
matrix:
flow_tags: ['latest']
python_ver: ['3.8']
steps:
- name: Load Cache
uses: actions/cache@v2
if: startsWith(runner.os, 'Windows')
- name: Checkout Plugin Repo
uses: actions/checkout@v2
with:
path: .\Flow-Launcher-Setup.exe
key: ${{ runner.os }}-flow-
- name: Download Flow Launcher
path: ${{github.event.repository.name}}
- name: Get Plugin's version
if: ${{ github.ref != 'refs/heads/main' }}
id: version
uses: notiz-dev/github-action-json-property@release
with:
path: './${{github.event.repository.name}}/plugin.json'
prop_path: 'Version'
- name: Assert Version updated
if: ${{ github.ref != 'refs/heads/main' }}
run: |
if (-Not (Test-Path .\Flow-Launcher-Setup.exe))
$release_ver = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/${{github.repository}}/main/plugin.json" | ConvertFrom-Json).Version
$release_ver = $release_ver -replace "v", ""
$this_ver = "${{steps.version.outputs.prop}}"
echo "This version:" $this_ver
echo "Release version:" $release_ver
if ([System.Version]$this_ver -gt [System.Version]$release_ver) {
exit 0
} else {
exit 1
}
- name: Get latest Version tag
run: |
if ("${{matrix.flow_tags}}" -eq 'latest') {
$url = "https://api.github.com/repos/Flow-Launcher/Flow.Launcher/releases/latest"
} else {
$url = "https://api.github.com/repos/Flow-Launcher/Flow.Launcher/releases/tags/${{matrix.flow_tags}}"
}
$release = Invoke-WebRequest -Uri $url | ConvertFrom-Json
$tag_name = $release.tag_name
foreach ($asset in $release.assets)
{
curl.exe -L -o Flow-Launcher-Setup.exe "https://github.com/Flow-Launcher/Flow.Launcher/releases/latest/download/Flow-Launcher-Setup.exe"
if($asset.name -like '*setup.exe') {
$download_url = $asset.browser_download_url
$file_name = $asset.name
break
}
}
echo "DOWNLOAD_URL=$download_url" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "FILE_NAME=$file_name" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "TAG_NAME=$tag_name" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Flow Launcher Cache
uses: actions/cache@v2
id: flow_cache
with:
path: |
~\AppData\Roaming\FlowLauncher\*
!~\AppData\Roaming\FlowLauncher\Plugins\*
~\AppData\Local\FlowLauncher\**
key: ${{ runner.os }}-flow-${{ env.TAG_NAME }}
- name: Download Flow Launcher
id: download
if: steps.flow_cache.outputs.cache-hit != 'true'
run: |
curl.exe -L -o ${{ env.FILE_NAME }} ${{ env.DOWNLOAD_URL }}
- name: Install Flow Launcher
run: .\Flow-Launcher-Setup.exe
if: steps.flow_cache.outputs.cache-hit != 'true'
run: .\${{ env.FILE_NAME }}
shell: cmd
- name: Checkout Plugin Repo
uses: actions/checkout@v2
with:
path: ${{github.event.repository.name}}
- name: Move checkout repo
- name: Move Plugin to plugins directory
run: |
$repo_path = Join-Path -Path $pwd -ChildPath ${{github.event.repository.name}}
$plugin_path = Join-Path -Path $env:APPDATA -ChildPath 'FlowLauncher' | Join-Path -ChildPath 'Plugins' | Join-Path -ChildPath ${{github.event.repository.name}}
if (Test-Path $plugin_path)
{
echo "Removing cached directory"
Remove-Item $plugin_path
}
New-Item -ItemType SymbolicLink -Path $plugin_path -Target $repo_path
echo "PLUGIN_PATH=$plugin_path" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: ${{ matrix.python_ver }}
- uses: actions/cache@v2
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-pip-${{ matrix.python_ver }}
- name: Install dependencies
run: |
cd ${{ env.PLUGIN_PATH }}
Expand All @@ -66,6 +119,4 @@ jobs:
- name: Test Run
run: |
cd ${{ env.PLUGIN_PATH }}
echo ${{ env.PLUGIN_PATH }}
echo ${{steps.exe.outputs.prop}}
python ${{steps.exe.outputs.prop}}

0 comments on commit 549681f

Please sign in to comment.