Skip to content

Commit 4a54062

Browse files
committed
build: converting from Docker -> Nix
1 parent f10b76c commit 4a54062

27 files changed

+710
-257
lines changed

.cargo/config.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# From https://github.com/BurntSushi/ripgrep/blob/master/.cargo/config.toml
2+
3+
# Do the same for MUSL targets. At the time of writing (2023-10-23), this is
4+
# the default. But the plan is for the default to change to dynamic linking.
5+
# The whole point of MUSL with respect to ripgrep is to create a fully
6+
# statically linked executable.
7+
#
8+
# See: https://github.com/rust-lang/compiler-team/issues/422
9+
# See: https://github.com/rust-lang/compiler-team/issues/422#issuecomment-812135847
10+
[target.x86_64-unknown-linux-musl]
11+
rustflags = [
12+
"-C", "target-feature=+crt-static",
13+
"-C", "link-self-contained=yes",
14+
]
15+
16+
[target.aarch64-unknown-linux-musl]
17+
rustflags = [
18+
"-C", "target-feature=+crt-static",
19+
"-C", "link-self-contained=yes",
20+
]

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/renovate.json5

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@
44
"config:best-practices"
55
],
66
"automerge": true,
7-
"dockerfile": {
8-
"managerFilePatterns": [
9-
"/(^|/|\\.)Dockerfile$/",
10-
"/(^|/)Dockerfile[^/]*$/"
11-
]
7+
"github-actions": {
8+
"enabled": false
9+
},
10+
"nix": {
11+
"enabled": true,
12+
"lockFileMaintenance": {
13+
"enabled": true,
14+
"commitMessageAction": "update",
15+
"commitMessageTopic": "Nix flake lock"
16+
}
1217
},
1318
"customManagers": [
14-
{
15-
"customType": "regex",
16-
"managerFilePatterns": [
17-
"/(^|/|\\.)Dockerfile$/",
18-
"/(^|/)Dockerfile[^/]*$/"
19-
],
20-
"matchStrings": [
21-
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s.+_VERSION=\"(?<currentValue>.*?)\"\\s"
22-
]
23-
},
2419
{
2520
"customType": "regex",
2621
"managerFilePatterns": [
@@ -36,18 +31,6 @@
3631
"datasourceTemplate": "repology",
3732
"depNameTemplate": "alpine_{{alpineMajor}}_{{alpineMinor}}/{{name}}",
3833
"versioningTemplate": "loose"
39-
},
40-
{
41-
"customType": "regex",
42-
"managerFilePatterns": [
43-
"/(^|/|\\.)Makefile$/",
44-
"/(^|/)Makefile[^/]*$/"
45-
],
46-
"matchStrings": [
47-
"# renovate: depName=(?<depName>.*?)\\s.+_VERSION=(?<currentValue>[a-z0-9.-]+)(?:@(?<currentDigest>sha256:[a-f0-9]+))?"
48-
],
49-
"datasourceTemplate": "docker",
50-
"versioningTemplate": "docker"
5134
}
5235
]
5336
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Continuous Delivery (CD)
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
publish-binary:
14+
name: Publish Binary
15+
runs-on: ${{ matrix.architecture }}
16+
strategy:
17+
matrix:
18+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
19+
steps:
20+
- name: Checkout code.
21+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
- name: Setup Nix.
23+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
24+
- name: Publish binary.
25+
run: nix develop -c make publish-binary RELEASE="${GITHUB_REF_NAME}"
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by GitHub Actions.
28+
29+
publish-docker-image:
30+
name: Publish Docker Image (${{ matrix.platform }})
31+
runs-on: ${{ matrix.runner }}
32+
needs: [publish-binary]
33+
strategy:
34+
matrix:
35+
include:
36+
- platform: linux/amd64
37+
runner: ubuntu-24.04
38+
target: x86_64-unknown-linux-musl
39+
suffix: amd64
40+
- platform: linux/arm64
41+
runner: ubuntu-24.04-arm
42+
target: aarch64-unknown-linux-musl
43+
suffix: arm64
44+
steps:
45+
- name: Checkout code.
46+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
49+
- name: Login to GitHub Container Registry
50+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
51+
with:
52+
registry: ghcr.io
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
- name: Publish Docker Image
56+
run: make publish-docker-image RELEASE="${GITHUB_REF_NAME}" PLATFORM="${{ matrix.platform }}" TARGET="${{ matrix.target }}" SUFFIX="${{ matrix.suffix }}"
57+
env:
58+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
publish-docker-manifest:
61+
name: Publish Docker Manifest
62+
runs-on: ubuntu-24.04
63+
needs: [publish-docker-image]
64+
steps:
65+
- name: Checkout code.
66+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
67+
- name: Set up Docker Buildx
68+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
69+
- name: Login to GitHub Container Registry
70+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
71+
with:
72+
registry: ghcr.io
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
- name: Publish Docker Manifest
76+
run: make publish-docker-manifest RELEASE="${GITHUB_REF_NAME}"

.github/workflows/continuous-integration.yml

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,70 @@ permissions:
88
jobs:
99
formatting:
1010
name: Formatting
11-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.architecture }}
1212
strategy:
1313
matrix:
14+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
1415
language: [rust, shell]
1516
steps:
1617
- name: Checkout code.
1718
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
19+
- name: Setup Nix.
20+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
1821
- name: Check formatting.
19-
run: make check-${{ matrix.language }}-formatting
22+
run: nix develop -c make check-${{ matrix.language }}-formatting
23+
2024
linting:
2125
name: Linting
22-
runs-on: ubuntu-latest
26+
runs-on: ${{ matrix.architecture }}
2327
strategy:
2428
matrix:
25-
language: [rust]
29+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
30+
language: [rust, shell]
2631
steps:
2732
- name: Checkout code.
2833
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
34+
- name: Setup Nix.
35+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
2936
- name: Check linting.
30-
run: make check-${{ matrix.language }}-linting
37+
run: nix develop -c make check-${{ matrix.language }}-linting
38+
39+
scripts-permissions:
40+
name: Scripts Permissions
41+
runs-on: ${{ matrix.architecture }}
42+
strategy:
43+
matrix:
44+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
45+
steps:
46+
- name: Checkout code.
47+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
48+
- name: Check scripts permissions.
49+
run: make check-scripts-permissions
50+
3151
compile:
3252
name: Compile
33-
runs-on: ubuntu-latest
53+
runs-on: ${{ matrix.architecture }}
54+
strategy:
55+
matrix:
56+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
3457
steps:
3558
- name: Checkout code.
3659
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
60+
- name: Setup Nix.
61+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
3762
- name: Compile.
38-
run: make compile
63+
run: nix develop -c make compile
64+
3965
unit-test:
4066
name: Unit Test
41-
runs-on: ubuntu-latest
67+
runs-on: ${{ matrix.architecture }}
68+
strategy:
69+
matrix:
70+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
4271
steps:
4372
- name: Checkout code.
4473
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
74+
- name: Setup Nix.
75+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
4576
- name: Unit test.
46-
run: make unit-test
77+
run: nix develop -c make unit-test

.github/workflows/conventional-commits.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ permissions:
88
jobs:
99
linting:
1010
name: Linting
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-24.04
12+
container:
13+
image: ghcr.io/developerc286/conventional_commits_linter:0.17.0@sha256:d6fb0dfd79c2e06897692bc3f0dc62bcb7ce90a92030c81a3137935516d525d7
1214
steps:
1315
- name: Checkout code.
1416
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1517
with:
1618
ref: ${{ github.event.pull_request.head.sha }}
1719
fetch-depth: 0
1820
- name: Check Conventional Commits linting.
19-
run: make check-conventional-commits-linting FROM="origin/${{ github.base_ref }}"
21+
run: conventional_commits_linter --type angular "origin/${{ github.base_ref }}"

.github/workflows/dogfood.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Dogfood
2+
3+
on: pull_request
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
docker:
10+
name: Docker
11+
runs-on: ${{ matrix.architecture }}
12+
strategy:
13+
matrix:
14+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
15+
steps:
16+
- name: Checkout code.
17+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
18+
- name: Setup Nix.
19+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
20+
- name: Dogfooding Docker.
21+
run: nix develop -c make dogfood-docker

.github/workflows/git-history.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ permissions:
88
jobs:
99
clean:
1010
name: Clean
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-24.04
12+
container:
13+
image: ghcr.io/developerc286/clean_git_history:1.1.5@sha256:b1374591d48393f6b5fcc888f6bc7da05f7d218961f7850112130b1cad78186a
1214
steps:
1315
- name: Checkout code.
1416
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1517
with:
1618
ref: ${{ github.event.pull_request.head.sha }}
1719
fetch-depth: 0
1820
- name: Check clean Git history.
19-
run: make check-clean-git-history FROM="origin/${{ github.base_ref }}"
21+
run: clean_git_history "origin/${{ github.base_ref }}"

.github/workflows/github-actions-workflows.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,30 @@ permissions:
66
contents: read
77

88
jobs:
9-
linting:
10-
name: Linting
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout code.
14-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
15-
- name: Check GitHub Actions workflows linting.
16-
run: make check-github-actions-workflows-linting
179
formatting:
1810
name: Formatting
19-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.architecture }}
12+
strategy:
13+
matrix:
14+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
2015
steps:
2116
- name: Checkout code.
2217
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
18+
- name: Setup Nix.
19+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
2320
- name: Check formatting.
24-
run: make check-yaml-formatting
21+
run: nix develop -c make check-yaml-formatting
22+
23+
linting:
24+
name: Linting
25+
runs-on: ${{ matrix.architecture }}
26+
strategy:
27+
matrix:
28+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
29+
steps:
30+
- name: Checkout code.
31+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
32+
- name: Setup Nix.
33+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
34+
- name: Check GitHub Actions workflows linting.
35+
run: nix develop -c make check-github-actions-workflows-linting

.github/workflows/mirroring.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ concurrency:
99
group: ${{ github.workflow }}
1010

1111
jobs:
12-
GitLab:
13-
runs-on: ubuntu-latest
12+
gitlab:
13+
name: GitLab
14+
runs-on: ubuntu-24.04
1415
steps:
1516
- name: Checkout code.
1617
run: git clone --mirror "https://github.com/${GITHUB_REPOSITORY}.git" "${GITHUB_WORKSPACE}"

0 commit comments

Comments
 (0)