Files
netch/.github/workflows/build.yml
2021-10-16 10:56:03 +08:00

92 lines
2.8 KiB
YAML

name: Netch Build CI
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Checksum Other
shell: pwsh
run: |
echo "OTHER_SHA256=$(.\Other\sha256.ps1)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Checksum Redirector
shell: pwsh
run: |
echo "REDIRECTOR_SHA256=$(.\sha256.ps1 .\Redirector)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Checksum RouteHelper
shell: pwsh
run: |
echo "ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | 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.REDIRECTOR_SHA256 }}
path: |
.\Redirector\bin
- name: Cache RouteHelper
uses: actions/cache@v2
with:
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTEHELPER_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: 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: Setup Rust
uses: actions-rs/toolchain@v1
if: steps.check_other.outputs.files_exists == 'false'
with:
toolchain: nightly
profile: minimal
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.3
with:
vs-prerelease: true
- name: Build
shell: pwsh
run: |
.\build.ps1 -Configuration Release -OutputPath release
- name: Upload
uses: actions/upload-artifact@v2
with:
name: release
path: release