-
Notifications
You must be signed in to change notification settings - Fork 32
94 lines (88 loc) · 3.51 KB
/
dart.yml
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
name: Dart CI
on:
pull_request:
concurrency:
group: dart-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
dart-ci:
name: Dart CI (${{ matrix.dependencies }})
runs-on: ubuntu-24.04
permissions:
packages: write
strategy:
fail-fast: false
matrix:
dependencies:
- current
- downgrade
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Login to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
- name: Install SQLite
run: sudo apt-get update && sudo apt-get install libsqlite3-0 libsqlite3-dev -y --no-install-recommends
- name: Install dart
uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 # v1
with:
sdk: 3.5
- name: Setup
run: ./tool/setup.sh
- name: Check up-to-date pubspec.lock
if: ${{ matrix.dependencies == 'current' }}
run: git --no-pager diff --exit-code
- name: Downgrade dependencies
if: ${{ matrix.dependencies == 'downgrade' }}
run: |
git apply .github/workflows/dependency_overrides.patch
melos exec dart pub downgrade
- name: Check formatting
run: melos run format:check
- name: Lint code
run: melos run analyze
- name: Run tests
run: |
mapfile -t packages < <(melos list --parsable --diff=${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }}..${{ github.event.pull_request.head.sha }} --include-dependents | xargs -r -n1 basename)
packages_glob="$(printf ",%s" "${packages[@]}")"
packages_glob="${packages_glob:1}"
if [ -n "$packages_glob" ]; then
if [[ "$packages_glob" == *"nextcloud"* ]]; then
if [[ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
export PUSH_IMAGES="1"
fi
./tool/build-dev-container.sh
fi
MELOS_PACKAGES="$packages_glob" melos test
else
./tool/build-dev-container.sh
melos test
fi
- name: Setup Codecov
if: ${{ matrix.dependencies == 'current' }}
run: |
cd /tmp
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
curl -Os https://uploader.codecov.io/latest/linux/codecov
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM
chmod +x codecov
mkdir /tmp/bin
mv codecov /tmp/bin
- name: Upload coverage to Codecov
if: ${{ matrix.dependencies == 'current' }}
run: |
export PATH="$PATH:/tmp/bin"
melos exec --file-exists="coverage/lcov.info" --concurrency=1 -- "
codecov --verbose upload-process --fail-on-error -F MELOS_PACKAGE_NAME -f MELOS_PACKAGE_PATH/coverage/lcov.info -t ${{ secrets.CODECOV_TOKEN }}
"