diff options
| author | ruki <[email protected]> | 2020-06-30 11:38:15 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-06-30 11:38:15 +0800 |
| commit | 2b80ef232b9a17cde8b144a37eb4f8ea77266900 (patch) | |
| tree | bf10097a4ea9d32fb2aa2b0b57bc8a2abbb6a7ab | |
| parent | 761d86e8804754630c122c65c3fba0d501bf0d89 (diff) | |
| parent | f03a57c21313e1f155294c8bad56cc933c71065f (diff) | |
Merge pull request #877 from OpportunityLiu/dev
improve actions for forked repos
| -rw-r--r-- | .github/workflows/linux.yml | 7 | ||||
| -rw-r--r-- | .github/workflows/macos.yml | 7 | ||||
| -rw-r--r-- | .github/workflows/windows.yml | 138 |
3 files changed, 28 insertions, 124 deletions
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 57242d1b1..cc058266b 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -8,17 +8,14 @@ on: jobs: build: - strategy: - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: xmake-io/github-action-setup-xmake@v1 with: - xmake-version: sha@${{ github.sha }} + xmake-version: ${{ github.repository }}#sha@${{ github.sha }} - uses: mihails-strasuns/[email protected] with: compiler: dmd-latest diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d79650dc6..736844b0f 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -8,17 +8,14 @@ on: jobs: build: - strategy: - matrix: - os: [macOS-latest] - runs-on: ${{ matrix.os }} + runs-on: macos-latest steps: - uses: actions/checkout@v1 - uses: xmake-io/github-action-setup-xmake@v1 with: - xmake-version: sha@${{ github.sha }} + xmake-version: ${{ github.repository }}#sha@${{ github.sha }} - uses: mihails-strasuns/[email protected] with: compiler: dmd-latest diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e723d1ff6..a8618f7b5 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,15 +10,16 @@ jobs: build: strategy: matrix: - os: [windows-latest] + arch: [x64, x86] - runs-on: ${{ matrix.os }} + runs-on: windows-latest steps: - uses: actions/checkout@v1 - uses: xmake-io/github-action-setup-xmake@v1 - # this is not supported, use dev branch instead with: + # this is not supported, use dev branch instead + # xmake-version: ${{ github.repository }}#sha@${{ github.sha }} xmake-version: branch@dev - uses: mihails-strasuns/[email protected] with: @@ -32,7 +33,6 @@ jobs: # xmake xmake show git submodule update --init - Copy-Item . ../xmake_x86 -Recurse # nsis Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04.zip" -UseBasicParsing -OutFile ./nsis.zip Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04-strlen_8192.zip" -UseBasicParsing -OutFile ./nsis-longstr.zip @@ -43,22 +43,14 @@ jobs: Expand-Archive ./nsis-uac.zip -DestinationPath ./nsis -Force Move-Item ./nsis/UAC.nsh ./nsis/Include/ - # build (x64) - - name: build (x64) + # build + - name: build run: | - xmake f -vD -P core -a x64 + xmake f -vD -P core -a ${{ matrix.arch }} xmake -vD -P core - # build (x86) - - name: build (x86) - run: | - Push-Location ../xmake_x86 - xmake f -vD -P core -a x86 - xmake -vD -P core - Push-Location - - # tests (x64) - - name: tests (x64) + # tests + - name: tests run: | Copy-Item ./core/build/xmake.exe ./xmake $Env:XMAKE_PROGRAM_DIR = $(Resolve-Path ./xmake) @@ -67,20 +59,8 @@ jobs: xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake xmake lua -v -D tests/run.lua - # tests (x86) - - name: tests (x86) - run: | - Push-Location ../xmake_x86 - Copy-Item ./core/build/xmake.exe ./xmake - $Env:XMAKE_PROGRAM_DIR = $(Resolve-Path ./xmake) - Set-Item -Path Env:Path -Value ($Env:XMAKE_PROGRAM_DIR + ";" + $Env:Path) - xmake show - xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake - xmake lua -v -D tests/run.lua - Pop-Location - - # build artifacts (x64) - - name: artifact (x64) + # build artifacts + - name: artifact run: | # build installer (New-Item ./xmake/winenv/bin -ItemType Directory).FullName @@ -92,7 +72,7 @@ jobs: Copy-Item ./curl.exe ./xmake/winenv/bin Copy-Item ./curl-ca-bundle.crt ./xmake/winenv/bin $version = (Get-Command xmake/xmake.exe).FileVersionInfo - ./nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /Dx64 .\scripts\installer.nsi + ./nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /D${{ matrix.arch }} .\scripts\installer.nsi # archive Copy-Item ./*.md ./xmake Add-Type -AssemblyName System.Text.Encoding @@ -109,64 +89,26 @@ jobs: [System.IO.Compression.ZipFile]::CreateFromDirectory("$PWD\archive", "$PWD\archive.zip", [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new()) (Get-FileHash .\archive.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append - # build artifacts (x86) - - name: artifact (x86) + # upload artifacts + - name: set release arch name run: | - Push-Location ../xmake_x86 - # build installer - (New-Item ./xmake/winenv/bin -ItemType Directory).FullName - Invoke-WebRequest "https://github.com/xmake-mirror/gnuwin32-unzip/releases/download/5.51.1/unzip-5.51-1-bin.zip" -UseBasicParsing -OutFile .\unzip.zip - Expand-Archive ./unzip.zip -DestinationPath ./unzip - Copy-Item ./unzip/bin/unzip.exe ./xmake/winenv/bin - Invoke-WebRequest "https://github.com/xmake-io/xmake-win32env/raw/master/bin/curl.exe" -UseBasicParsing -OutFile .\curl.exe - Invoke-WebRequest "https://raw.githubusercontent.com/xmake-io/xmake-win32env/master/bin/curl-ca-bundle.crt" -UseBasicParsing -OutFile .\curl-ca-bundle.crt - Copy-Item ./curl.exe ./xmake/winenv/bin - Copy-Item ./curl-ca-bundle.crt ./xmake/winenv/bin - $version = (Get-Command xmake/xmake.exe).FileVersionInfo - ../xmake/nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /Dx86 .\scripts\installer.nsi - # archive - Copy-Item ./*.md ./xmake - Add-Type -AssemblyName System.Text.Encoding - Add-Type -AssemblyName System.IO.Compression.FileSystem - class FixedEncoder : System.Text.UTF8Encoding { - FixedEncoder() : base($true) { } - [byte[]] GetBytes([string] $s) - { - $s = $s.Replace("\", "/") - return ([System.Text.UTF8Encoding]$this).GetBytes($s) - } + if ("${{ matrix.arch }}" -eq "x64"){ + echo "::set-env name=RELEASE_NAME::win64" + } else { + echo "::set-env name=RELEASE_NAME::win32" } - Copy-Item ./xmake ./archive/xmake -Recurse - [System.IO.Compression.ZipFile]::CreateFromDirectory("$PWD\archive", "$PWD\archive.zip", [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new()) - (Get-FileHash .\archive.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append - Pop-Location - Copy-Item ../xmake_x86 ./xmake -Recurse - - # upload artifacts - uses: actions/upload-artifact@v2 with: - name: xmake-latest.win64.exe + name: xmake-latest.${{ env.RELEASE_NAME }}.exe path: scripts/xmake.exe - uses: actions/upload-artifact@v2 with: - name: xmake-latest.win32.exe - path: xmake/xmake_x86/scripts/xmake.exe - - uses: actions/upload-artifact@v2 - with: - name: xmake-latest.win64.zip + name: xmake-latest.${{ env.RELEASE_NAME }}.zip path: archive.zip - uses: actions/upload-artifact@v2 with: - name: xmake-latest.win32.zip - path: xmake/xmake_x86/archive.zip - - uses: actions/upload-artifact@v2 - with: - name: xmake-latest.win64.sha256 + name: xmake-latest.${{ env.RELEASE_NAME }}.sha256 path: shafile - - uses: actions/upload-artifact@v2 - with: - name: xmake-latest.win32.sha256 - path: xmake/xmake_x86/shafile # publish release - name: publish @@ -177,18 +119,7 @@ jobs: with: upload_url: ${{ github.event.release.upload_url }} asset_path: scripts/xmake.exe - asset_name: xmake-${{ steps.tagName.outputs.tag }}.win64.exe - asset_content_type: application/zip - - - name: publish - if: github.event.action == 'published' - uses: actions/[email protected] - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: xmake/xmake_x86/scripts/xmake.exe - asset_name: xmake-${{ steps.tagName.outputs.tag }}.win32.exe + asset_name: xmake-${{ steps.tagName.outputs.tag }}.${{ env.RELEASE_NAME }}.exe asset_content_type: application/zip - name: publish @@ -199,18 +130,7 @@ jobs: with: upload_url: ${{ github.event.release.upload_url }} asset_path: archive.zip - asset_name: xmake-${{ steps.tagName.outputs.tag }}.win64.zip - asset_content_type: application/zip - - - name: publish - if: github.event.action == 'published' - uses: actions/[email protected] - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: xmake/xmake_x86/archive.zip - asset_name: xmake-${{ steps.tagName.outputs.tag }}.win32.zip + asset_name: xmake-${{ steps.tagName.outputs.tag }}.${{ env.RELEASE_NAME }}.zip asset_content_type: application/zip - name: publish @@ -221,16 +141,6 @@ jobs: with: upload_url: ${{ github.event.release.upload_url }} asset_path: shafile - asset_name: xmake-${{ steps.tagName.outputs.tag }}.win64.sha256 + asset_name: xmake-${{ steps.tagName.outputs.tag }}.${{ env.RELEASE_NAME }}.sha256 asset_content_type: application/zip - - name: publish - if: github.event.action == 'published' - uses: actions/[email protected] - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: xmake/xmake_x86/shafile - asset_name: xmake-${{ steps.tagName.outputs.tag }}.win32.sha256 - asset_content_type: application/zip |
