[GitHub CI] Caching (#772)

This commit is contained in:
Connection Refused
2021-10-16 09:40:51 +08:00
committed by GitHub
parent 1a445104c2
commit d31981bed2
10 changed files with 165 additions and 95 deletions

View File

@@ -6,34 +6,72 @@ jobs:
name: Build
runs-on: windows-2022
steps:
- name: Go
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Checksum
shell: pwsh
run: |
$otherHash=$(.\Other\sha256.ps1)
$redirHash=$(.\Redirector\sha256.ps1)
$routeHash=$(.\RouteHelper\sha256.ps1)
echo "OTHER_SHA256=$otherHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "REDIR_SHA256=$redirHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "ROUTE_SHA256=$routeHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Cache Other
uses: actions/cache@v2
with:
key: Netch-${{ runner.os }}-Other-${{ env.OTHER_SHA256 }}
path: .\other\release
- name: Cache Redirector
uses: actions/cache@v2
with:
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIR_SHA256 }}
path: .\Redirector\bin
- name: Cache RouteHelper
uses: actions/cache@v2
with:
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTE_SHA256 }}
path: .\RouteHelper\bin
- name: Check Other
id: check_other
uses: andstor/file-existence-action@v1
with:
files: .\other\release\aiodns.bin
- name: Setup Go
uses: actions/setup-go@v2
if: steps.check_other.outputs.files_exists == 'false'
with:
go-version: 1.17.2
- name: C++
- name: Setup C++
uses: msys2/setup-msys2@v2
if: steps.check_other.outputs.files_exists == 'false'
with:
update: true
release: true
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip
- name: Rust
- name: Setup Rust
uses: actions-rs/toolchain@v1
if: steps.check_other.outputs.files_exists == 'false'
with:
toolchain: nightly
profile: minimal
- name: MSBuild
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.3
with:
vs-prerelease: true
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Build
shell: pwsh
run: |

View File

@@ -9,34 +9,67 @@ jobs:
name: Build
runs-on: windows-2022
steps:
- name: Go
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Checksum
shell: pwsh
run: |
$otherHash=$(.\Other\sha256.ps1)
$redirHash=$(.\Redirector\sha256.ps1)
$routeHash=$(.\RouteHelper\sha256.ps1)
echo "OTHER_SHA256=$otherHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "REDIR_SHA256=$redirHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "ROUTE_SHA256=$routeHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Cache Other
uses: actions/cache@v2
with:
key: Netch-${{ runner.os }}-Other-${{ env.OTHER_SHA256 }}
path: .\Other\release
- name: Cache Redirector
uses: actions/cache@v2
with:
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIR_SHA256 }}
path: .\Redirector\bin
- name: Cache RouteHelper
uses: actions/cache@v2
with:
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTE_SHA256 }}
path: .\RouteHelper\bin
- name: Check Other
id: check_other
uses: andstor/file-existence-action@v1
with:
files: .\other\release\aiodns.bin
- name: Setup Go
uses: actions/setup-go@v2
if: steps.check_other.outputs.files_exists == 'false'
with:
go-version: 1.17.2
- name: C++
- name: Setup C++
uses: msys2/setup-msys2@v2
if: steps.check_other.outputs.files_exists == 'false'
with:
update: true
release: true
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip
- name: Rust
- name: Setup Rust
uses: actions-rs/toolchain@v1
if: steps.check_other.outputs.files_exists == 'false'
with:
toolchain: nightly
profile: minimal
- name: MSBuild
uses: microsoft/setup-msbuild@v1.0.3
with:
vs-prerelease: true
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Build
shell: pwsh
run: |
@@ -52,7 +85,6 @@ jobs:
shell: pwsh
run: |
$hash=(Get-FileHash Netch.7z -Algorithm SHA256).Hash.ToLower()
echo "$hash Netch.7z"
echo "NETCH_SHA256=$hash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Release