-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (92 loc) · 3.15 KB
/
ci.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
95
96
97
98
name: CI Workflow
on:
push:
branches:
- master
pull_request:
defaults:
run:
shell: bash
jobs:
api-test:
name: API Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up reviewdog
uses: reviewdog/action-setup@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v6
id: build
with:
context: ./api
target: dev
cache-from: type=gha,scope=${{ github.ref_name }}-test
cache-to: type=gha,scope=${{ github.ref_name }}-test,mode=max
load: true
- name: Run tests
if: ${{ always() && steps.build.conclusion == 'success' }}
working-directory: api
run: |
docker run --rm --volume=/var/run/docker.sock:/var/run/docker.sock:ro --network=host ${{ steps.build.outputs.imageid }} \
cargo make test --workspace
- name: Run clippy
if: ${{ always() && steps.build.conclusion == 'success' }}
working-directory: api
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker run --rm --volume=/var/run/docker.sock:/var/run/docker.sock:ro ${{ steps.build.outputs.imageid }} \
cargo clippy --tests --workspace --quiet --message-format=short --color=never 2>&1 |
reviewdog -f=clippy -reporter=github-pr-annotations -filter-mode=nofilter -fail-level=any -tee
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/bake-action@v5
with:
files: docker-bake.hcl
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
update-schema:
name: Update GraphQL Schema
runs-on: ubuntu-latest
env:
GIT_AUTHOR_NAME: 'github-actions[bot]'
GIT_AUTHOR_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'
GIT_COMMITTER_NAME: 'github-actions[bot]'
GIT_COMMITTER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v6
id: build
with:
context: ./api
target: debug
cache-from: type=gha,scope=${{ github.ref_name }}-debug
cache-to: type=gha,scope=${{ github.ref_name }}-debug,mode=max
load: true
- name: Update GraphQL Schema
run: |
docker run --rm ${{ steps.build.outputs.imageid }} hoarder schema print > ./schema/hoarder.gql
if git diff --exit-code &> /dev/null; then
exit 0
fi
git add ./schema/hoarder.gql
git commit --message="Update GraphQL Schema"
git push