-
Notifications
You must be signed in to change notification settings - Fork 4
115 lines (97 loc) · 3.25 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: CI
on:
push:
branches: [main]
pull_request:
branches:
- '*'
schedule:
- cron: '0 0 * * 0' # weekly
jobs:
nix:
name: Build via Nix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix develop --command cabal build
# TODO: also run tests
- run: |
nix build .#ldbcollector-untested
nix-store --export $(nix-store --query --requisites ./result) > ldbcollector.nar
- uses: actions/upload-artifact@v4
with:
name: ldbcollector.nar
path: ldbcollector.nar
compression-level: 0
retention-days: 90
- run: nix flake check
docker:
name: Build an Docker image via Nix and push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/upload-artifact@v4
with:
name: data
path: data
compression-level: 6
retention-days: 90
- uses: cachix/install-nix-action@v25
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: 'Build and push Image'
run: |
./nix-docker-build-and-load.sh
tag="$(./nix-docker-build-and-load.sh echo-tag)"
podman tag "$tag" "ghcr.io/maxhbr/ldbcollector:latest"
podman push "ghcr.io/maxhbr/ldbcollector:latest"
- uses: actions/upload-artifact@v4
with:
name: ldbcollector.tar.gz
path: ldbcollector.tar.gz
compression-level: 0
retention-days: 90
- name: 'Add data and push Image'
run: |
./.github/workflows/docker-add-data-to-img.sh "$(readlink -f data)" "ghcr.io/maxhbr/ldbcollector:latest" "ghcr.io/maxhbr/ldbcollector-with-data:latest"
podman push "ghcr.io/maxhbr/ldbcollector-with-data:latest"
podman save -o ldbcollector-with-data.tar.gz "ghcr.io/maxhbr/ldbcollector-with-data:latest"
- uses: actions/upload-artifact@v4
with:
name: ldbcollector-with-data.tar.gz
path: ldbcollector-with-data.tar.gz
compression-level: 0
retention-days: 30
# cabal:
# name: Build via Cabal
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: submodule checkout (partially complete)
# run: |
# sed -i 's/[email protected]:/https:\/\/github.com\//g' .gitmodules
# sed -i 's/[email protected]:/https:\/\/gitlab.com\//g' .gitmodules
# git submodule sync --recursive || true
# git submodule update --init --recursive || true
# - uses: haskell/actions/setup@v2
# with:
# ghc-version: '9.4.8'
# cabal-version: 'latest'
# enable-stack: false
# - run: cabal update
# - run: cabal build
# # - run: cabal test
# # - run: time cabal run -- write BSD-3-Clause
# # - uses: actions/upload-artifact@v2
# # with:
# # name: out
# # path: _out