Skip to content

Commit 91a997c

Browse files
committed
build: converting from Docker -> Nix
1 parent f60637a commit 91a997c

36 files changed

+654
-509
lines changed

.cargo/config.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ rustflags = [
1212
"-C", "target-feature=+crt-static",
1313
"-C", "link-self-contained=yes",
1414
]
15+
16+
[target.aarch64-unknown-linux-musl]
17+
rustflags = [
18+
"-C", "target-feature=+crt-static",
19+
"-C", "link-self-contained=yes",
20+
]

.copier-answers.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changes here will be overwritten by Copier
2+
_commit: v1.6.1
3+
_src_path: https://github.com/DeveloperC286/template
4+
project_name: conventional_commits_next_version
5+
uses_git: true

.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
}

.github/workflows/continuous-delivery.yml

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,78 @@ permissions:
1212
jobs:
1313
publish-binary:
1414
name: Publish Binary
15-
runs-on: ubuntu-latest
15+
runs-on: ${{ matrix.architecture }}
16+
strategy:
17+
matrix:
18+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
1619
steps:
1720
- name: Checkout code.
1821
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
- name: Setup Nix.
23+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
1924
- name: Publish binary.
20-
run: make publish-binary RELEASE="${GITHUB_REF_NAME}"
25+
run: nix develop -c make publish-binary RELEASE="${GITHUB_REF_NAME}"
2126
env:
2227
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by GitHub Actions.
2328

2429
publish-crate:
2530
name: Publish Crate
26-
runs-on: ubuntu-latest
31+
runs-on: ubuntu-24.04
2732
steps:
2833
- name: Checkout code.
2934
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
35+
- name: Setup Nix.
36+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
3037
- name: Publish crate.
31-
run: make publish-crate
38+
run: nix develop -c make publish-crate
3239
env:
3340
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3441

35-
publish-docker:
36-
name: Publish Docker Image
37-
runs-on: ubuntu-latest
42+
publish-docker-image:
43+
name: Publish Docker Image (${{ matrix.platform }})
44+
runs-on: ${{ matrix.runner }}
45+
needs: [publish-binary]
46+
strategy:
47+
matrix:
48+
include:
49+
- platform: linux/amd64
50+
runner: ubuntu-24.04
51+
target: x86_64-unknown-linux-musl
52+
suffix: amd64
53+
- platform: linux/arm64
54+
runner: ubuntu-24.04-arm
55+
target: aarch64-unknown-linux-musl
56+
suffix: arm64
3857
steps:
3958
- name: Checkout code.
4059
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4160
- name: Set up Docker Buildx
42-
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
61+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
4362
- name: Login to GitHub Container Registry
44-
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
63+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
4564
with:
4665
registry: ghcr.io
4766
username: ${{ github.actor }}
4867
password: ${{ secrets.GITHUB_TOKEN }}
4968
- name: Publish Docker Image
50-
run: make publish-docker RELEASE="${GITHUB_REF_NAME}"
69+
run: make publish-docker-image RELEASE="${GITHUB_REF_NAME}" PLATFORM="${{ matrix.platform }}" TARGET="${{ matrix.target }}" SUFFIX="${{ matrix.suffix }}"
70+
env:
71+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
73+
publish-docker-manifest:
74+
name: Publish Docker Manifest
75+
runs-on: ubuntu-24.04
76+
needs: [publish-docker-image]
77+
steps:
78+
- name: Checkout code.
79+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
80+
- name: Set up Docker Buildx
81+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
82+
- name: Login to GitHub Container Registry
83+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
84+
with:
85+
registry: ghcr.io
86+
username: ${{ github.actor }}
87+
password: ${{ secrets.GITHUB_TOKEN }}
88+
- name: Publish Docker Manifest
89+
run: make publish-docker-manifest RELEASE="${GITHUB_REF_NAME}"

.github/workflows/continuous-integration.yml

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,84 @@ 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, python]
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
78+
4779
end-to-end-test:
4880
name: End to End Test
49-
runs-on: ubuntu-latest
81+
runs-on: ${{ matrix.architecture }}
82+
strategy:
83+
matrix:
84+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
5085
steps:
5186
- name: Checkout code.
5287
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
88+
- name: Setup Nix.
89+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
5390
- name: End to End test.
54-
run: make end-to-end-test
91+
run: nix develop -c make end-to-end-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: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ permissions:
88
jobs:
99
docker:
1010
name: Docker
11-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.architecture }}
12+
strategy:
13+
matrix:
14+
architecture: [ubuntu-24.04, ubuntu-24.04-arm]
1215
steps:
1316
- name: Checkout code.
1417
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1518
with:
1619
ref: ${{ github.event.pull_request.head.sha }}
1720
fetch-depth: 0
18-
- name: Dogfooding Docker
19-
run: make dogfood-docker FROM="origin/${{ github.base_ref }}"
21+
- name: Setup Nix.
22+
uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31.9.0
23+
- name: Dogfooding Docker.
24+
run: nix develop -c make dogfood-docker FROM="origin/${{ github.base_ref }}"

.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

0 commit comments

Comments
 (0)