-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (81 loc) · 3.23 KB
/
ci.yml
File metadata and controls
96 lines (81 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# .github/workflows/ci.yml
# =============================================================================
# fq-compressor CI Pipeline
# =============================================================================
# Unified CI workflow: format check, build, test
# =============================================================================
name: CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CI_IMAGE_NAME: fqcompressor-ci
jobs:
format-check:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Build CI image
run: docker build -f docker/Dockerfile.dev --target base -t ${{ env.CI_IMAGE_NAME }}:format .
- name: Check formatting
run: docker run --rm -v "${{ github.workspace }}:/workspace" -w /workspace ${{ env.CI_IMAGE_NAME }}:format ./scripts/lint.sh format-check
build-and-test:
name: Build & Test (${{ matrix.preset }})
runs-on: ubuntu-latest
needs: format-check
strategy:
fail-fast: false
matrix:
preset: [gcc-release, clang-debug, clang-release]
steps:
- uses: actions/checkout@v5
- name: Cache Conan
uses: actions/cache@v4
with:
path: ~/.conan2
key: ${{ runner.os }}-conan-${{ hashFiles('conanfile.py') }}
- name: Cache ccache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ${{ runner.os }}-ccache-${{ matrix.preset }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-ccache-${{ matrix.preset }}-
- name: Prepare cache dirs
run: mkdir -p "$HOME/.conan2" "$HOME/.cache/ccache"
- name: Build CI image
run: docker build -f docker/Dockerfile.dev --target base -t ${{ env.CI_IMAGE_NAME }}:${{ matrix.preset }} .
- name: Build
run: |
docker run --rm --user "$(id -u):$(id -g)" \
-v "${{ github.workspace }}:/workspace" \
-v "$HOME/.conan2:/tmp/conan2" \
-v "$HOME/.cache/ccache:/tmp/ccache" \
-e HOME=/tmp -e CONAN_HOME=/tmp/conan2 -e CCACHE_DIR=/tmp/ccache \
-e PATH=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
-w /workspace ${{ env.CI_IMAGE_NAME }}:${{ matrix.preset }} \
./scripts/build.sh ${{ matrix.preset }}
- name: Test
run: |
docker run --rm --user "$(id -u):$(id -g)" \
-v "${{ github.workspace }}:/workspace" \
-v "$HOME/.conan2:/tmp/conan2" \
-v "$HOME/.cache/ccache:/tmp/ccache" \
-e HOME=/tmp -e CONAN_HOME=/tmp/conan2 -e CCACHE_DIR=/tmp/ccache \
-e PATH=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
-w /workspace ${{ env.CI_IMAGE_NAME }}:${{ matrix.preset }} \
./scripts/test.sh ${{ matrix.preset }}
- name: Upload artifacts
if: endsWith(matrix.preset, 'release')
uses: actions/upload-artifact@v4
with:
name: fqcompressor-${{ matrix.preset }}
path: build/${{ matrix.preset }}/src/fqc
retention-days: 7