forked from halo-dev/halo
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (92 loc) · 3.28 KB
/
halo.yaml
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
name: Halo CI
on:
pull_request:
branches:
- main
- release-*
paths:
- "**"
- "!**.md"
push:
branches:
- main
- release-*
paths:
- "**"
- "!**.md"
release:
types: # This configuration does not affect the page_build event above
- created
jobs:
check:
runs-on: ubuntu-latest
# Default steps
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
cache: 'gradle'
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
console:
- 'console/**'
- name: Check halo
run: ./gradlew check
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Analyze code
if: ${{ github.event_name == 'push' }} # Due to inability to access secrets during PR, only the code pushed into the branch can be analyzed.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info
- name: Setup console environment
if: steps.changes.outputs.console == 'true'
uses: halo-sigs/actions/admin-env-setup@main
- name: Check console
if: steps.changes.outputs.console == 'true'
run: make -C console check
docker-build-and-push:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
- uses: halo-sigs/actions/halo-next-docker-build@main # change the version to specific ref or release tag while the action is stable.
if: github.event_name != 'pull_request'
with:
image-name: ${{ github.event_name == 'release' && 'halo' || 'halo-dev' }}
ghcr-token: ${{ secrets.GHCR_TOKEN }}
dockerhub-user: ${{ secrets.DOCKER_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_TOKEN }}
push: ${{ github.event_name == 'push' || github.event_name == 'release' }} # we only push to GHCR if the push is to the next branch
console-ref: ${{ github.event_name == 'release' && github.ref || 'main' }}
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x
- uses: halo-sigs/actions/halo-next-docker-build@main
if: github.event_name == 'pull_request'
with:
image-name: halo-dev
push: false
console-ref: false
load: true
platforms: ""
- name: E2E Testing
if: github.event_name == 'pull_request'
run: |
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod u+x /usr/local/bin/docker-compose
repo=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
docker tag ghcr.io/${repo}/halo-dev:pr-${{ github.event.number }} ghcr.io/halo-dev/halo-dev:dev
cd e2e && ./start.sh