mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-01-30 08:55:36 +02:00
There were two problems: - Writing the date on Windows used the wrong syntax. In Powershell, env variables are addressed as $env:NAME, not $NAME. - Use different caches for opt vs fastbuild. We are currently using opt caches for fastbuilds, which results in lots of cache misses.
85 lines
2.8 KiB
YAML
85 lines
2.8 KiB
YAML
name: Build & Test
|
|
|
|
# Run when something is pushed to main or when there's action on a pull request.
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
# Cancel running workflow if a pull request is modified. Note that head_ref is
|
|
# undefined for pushes to main. Use run_id as fallback. This is unique for each
|
|
# run, so runs for pushes to main are never cancelled.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
Build-And-Test-Linux:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Initialize submodules
|
|
run: git submodule update --init --recursive
|
|
|
|
- name: Create timestamp
|
|
run: |
|
|
printf -v date '%(%Y-%m)T' -1
|
|
echo "date=$date" >> $GITHUB_ENV
|
|
|
|
- name: Restore build cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: bazel-cache
|
|
key: ${{ runner.os }}-bazel-cache-fastbuild-${{ env.date }}
|
|
|
|
- name: Build (fastbuild)
|
|
run: bazel build --config=linux --disk_cache=bazel-cache -- //... -//third_party/...
|
|
|
|
# Skip file_finder_test: The test works when file_finder_test is run
|
|
# directly, but not through bazel test. The reason is, bazel test
|
|
# creates symlinks of test files, but the finder ignores symlinks.
|
|
# Also run tests sequentially since some tests write to a common tmp dir.
|
|
- name: Test (fastbuild)
|
|
run: bazel test --config=linux --disk_cache=bazel-cache --test_output=errors --local_test_jobs=1 -- //... -//third_party/... -//cdc_rsync_server:file_finder_test
|
|
|
|
Build-And-Test-Windows:
|
|
runs-on: windows-2019
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Initialize submodules
|
|
run: git submodule update --init --recursive
|
|
|
|
- name: Create timestamp
|
|
run: |
|
|
$date = Get-Date -Format "yyyy-MM"
|
|
echo "date=$date" >> $env:GITHUB_ENV
|
|
|
|
- name: Restore build cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: bazel-cache
|
|
key: ${{ runner.os }}-bazel-cache-fastbuild-${{ env.date }}
|
|
|
|
- name: Build (fastbuild)
|
|
run: bazel build --config=windows --disk_cache=bazel-cache //cdc_rsync //cdc_stream //tests_common //tests_cdc_stream //tests_cdc_rsync
|
|
|
|
- name: Test (fastbuild)
|
|
run: |
|
|
bazel-bin\tests_common\tests_common.exe
|
|
bazel-bin\tests_cdc_stream\tests_cdc_stream.exe
|
|
bazel-bin\tests_cdc_rsync\tests_cdc_rsync.exe
|
|
bazel test --config=windows --disk_cache=bazel-cache --test_output=errors --local_test_jobs=1 `
|
|
//cdc_fuse_fs/... `
|
|
//cdc_rsync/... `
|
|
//cdc_rsync/base/... `
|
|
//cdc_rsync_server/... `
|
|
//cdc_stream/... `
|
|
//common/... `
|
|
//data_store/... `
|
|
//fastcdc/... `
|
|
//manifest/... `
|
|
//metrics/...
|