Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.

Commit ef5710a

Browse files
committed
ci: init
Signed-off-by: Sefa Eyeoglu <[email protected]>
1 parent d9e0c82 commit ef5710a

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: Build (${{ matrix.os }})
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- os: ubuntu-latest
18+
use-nix: true
19+
- os: windows-latest
20+
use-nix: false
21+
22+
runs-on: ${{ matrix.os }}
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Install Rust
29+
if: ${{ !matrix.use-nix }}
30+
uses: actions-rust-lang/setup-rust-toolchain@v1
31+
32+
- name: Install Nix
33+
if: ${{ matrix.use-nix }}
34+
uses: DeterminateSystems/nix-installer-action@v16
35+
36+
- name: Setup Nix cache
37+
if: ${{ matrix.use-nix }}
38+
uses: DeterminateSystems/magic-nix-cache-action@v8
39+
40+
- name: Build
41+
if: ${{ !matrix.use-nix }}
42+
run: cargo build --locked
43+
44+
- name: Build
45+
if: ${{ matrix.use-nix }}
46+
run: nix build --print-build-logs .#modmail
47+
48+
flake:
49+
name: Flake checks
50+
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
57+
- name: Install Nix
58+
uses: DeterminateSystems/nix-installer-action@v16
59+
60+
- name: Setup Nix cache
61+
uses: DeterminateSystems/magic-nix-cache-action@v8
62+
63+
- name: Run checks
64+
run: |
65+
nix flake check --print-build-logs --show-trace
66+
67+
# Make sure all above jobs finished successfully
68+
release-gate:
69+
name: CI Release gate
70+
needs: [build, flake]
71+
72+
if: ${{ always() }}
73+
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Exit with error
78+
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
79+
run: exit 1

.github/workflows/update-flake.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Update flake.lock
2+
3+
on:
4+
schedule:
5+
# run every saturday
6+
- cron: '0 0 * * 6'
7+
workflow_dispatch:
8+
9+
jobs:
10+
update:
11+
name: Run update
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Install Nix
23+
uses: DeterminateSystems/nix-installer-action@v16
24+
25+
- name: Update flake.lock
26+
id: update
27+
uses: DeterminateSystems/update-flake-lock@v24
28+
with:
29+
pr-title: 'nix: update flake.lock'
30+
31+
- name: Enable Pull Request Automerge
32+
uses: peter-evans/enable-pull-request-automerge@v3
33+
with:
34+
pull-request-number: ${{ steps.update.outputs.pull-request-number }}
35+
merge-method: rebase
36+
github-token: ${{ secrets.AUTOMATA_TOKEN }}

0 commit comments

Comments
 (0)