Compare commits
19 Commits
0759c64513
...
86b6150afd
| Author | SHA1 | Date | |
|---|---|---|---|
| 86b6150afd | |||
| 6ffa55510f | |||
| d4a410cb84 | |||
| b9f0e6c9f1 | |||
| 59b3ce7eab | |||
| ecc2058e13 | |||
| 722536bbb6 | |||
| 0c11eb718a | |||
| 1d4e022512 | |||
| b7c76b198b | |||
| cbfb3068e9 | |||
| 16ba661d2b | |||
|
1db36d168c
|
|||
|
8b700b0404
|
|||
|
e67e20ef29
|
|||
|
8fabd409ad
|
|||
|
031dd71cf3
|
|||
|
a8e2bfbb3c
|
|||
|
ba79fbe06d
|
@@ -3,12 +3,12 @@
|
||||
(rust-cargo-default-arguments . "-r")
|
||||
(eglot-workspace-configuration . (:rust-analyzer
|
||||
(:check
|
||||
(:overrideCommand ["ninja" "clippy-json" "-C" "build"]))))
|
||||
(:overrideCommand ["./rust-analyzer.sh"]))))
|
||||
(eval . (add-to-list 'eglot-server-programs
|
||||
'((rust-ts-mode rust-mode) .
|
||||
("rust-analyzer" :initializationOptions
|
||||
(:check
|
||||
(:overrideCommand ["ninja" "clippy-json" "-C" "build"]))))))
|
||||
(:overrideCommand ["./rust-analyzer.sh"]))))))
|
||||
(eval . (eglot-ensure))
|
||||
(eval . (company-mode 1))
|
||||
(eval . (add-hook 'before-save-hook 'fmt-current-buffer nil t))
|
||||
|
||||
@@ -31,4 +31,6 @@ USER gentooligan
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
ENTRYPOINT /bin/bash
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
6
.docker/entrypoint.sh
Executable file
6
.docker/entrypoint.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
|
||||
source /etc/profile
|
||||
source /lib/gentoo/functions.sh
|
||||
exec "$@"
|
||||
@@ -1,11 +1,6 @@
|
||||
name: Gentoo Utils
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
'*'
|
||||
pull_request:
|
||||
branches: [master]
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-oci-image:
|
||||
@@ -19,42 +14,96 @@ jobs:
|
||||
|
||||
- name: Check for changes before building
|
||||
id: image-changes
|
||||
# build image only if 1. changes are detected or 2. an image for the working branch doesnt exist
|
||||
run: |
|
||||
echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITEA_OUTPUT
|
||||
if ! git diff ${{ gitea.event.before }} ${{ gitea.sha }} --no-patch --exit-code .docker; then
|
||||
echo changes_detected=true >> $GITEA_OUTPUT
|
||||
branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
||||
|
||||
if [[ "$branch_name" == "${{ gitea.event.repository.default_branch }}" ]]; then
|
||||
image_tag=latest
|
||||
else
|
||||
echo changes_detected=false >> $GITEA_OUTPUT
|
||||
image_tag=$branch_name
|
||||
fi
|
||||
|
||||
echo "branch_name=$branch_name" >> $GITEA_OUTPUT
|
||||
# slugify
|
||||
image_tag="$(echo "$image_tag" | sed -E 's/[^a-zA-Z0-9]/-/g')"
|
||||
echo "image_tag=$image_tag" >> $GITEA_OUTPUT
|
||||
|
||||
if ! git diff ${{ gitea.event.before }} ${{ gitea.sha }} --no-patch --exit-code .docker; then
|
||||
build_image=true
|
||||
else
|
||||
if ! docker manifest inspect ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${image_tag} >/dev/null 2>&1; then
|
||||
build_image=true
|
||||
else
|
||||
build_image=false
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "build_image=$build_image" >> $GITEA_OUTPUT
|
||||
cat $GITEA_OUTPUT
|
||||
- name: Set up Docker buildx
|
||||
if: steps.image-changes.outputs.changes_detected == 'true'
|
||||
if: steps.image-changes.outputs.build_image == 'true'
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Github Container Registry
|
||||
if: steps.image-changes.outputs.changes_detected == 'true'
|
||||
if: steps.image-changes.outputs.build_image == 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.epenguin.net
|
||||
registry: ${{ vars.REGISTRY_URL }}
|
||||
username: ${{ vars.CI_BOT_USERNAME }}
|
||||
password: ${{ secrets.CI_BOT_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
if: steps.image-changes.outputs.changes_detected == 'true'
|
||||
if: steps.image-changes.outputs.build_image == 'true'
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
tags: git.epenguin.net/${{ gitea.repository }}:latest
|
||||
tags: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ steps.image-changes.outputs.image_tag }}
|
||||
context: "{{defaultContext}}:.docker"
|
||||
outputs:
|
||||
image_tag: ${{ steps.image-changes.outputs.image_tag }}
|
||||
|
||||
build:
|
||||
runs-on: brutalisk
|
||||
container:
|
||||
image: git.epenguin.net/gentoo-utils/gentoo-utils-gitea:latest
|
||||
needs: build-oci-image
|
||||
container:
|
||||
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: build and check
|
||||
run: ./check.sh
|
||||
run: |
|
||||
meson setup -Dfuzz=enabled -Dtests=enabled -Dbuildtype=debugoptimized -Ddocs=enabled build
|
||||
meson compile -C build
|
||||
|
||||
# FIXME: Currently this rebuilds everything. Instead we should bring over the build dir from the build job. This will come in handy
|
||||
# when we have multiple build targets and configs. What we have currently is fine until we get lots of builds going
|
||||
test:
|
||||
runs-on: brutalisk
|
||||
needs: [build-oci-image, build]
|
||||
container:
|
||||
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: test
|
||||
run: |
|
||||
meson setup -Dfuzz=enabled -Dtests=enabled -Dbuildtype=debugoptimized -Ddocs=enabled build
|
||||
meson compile -C build
|
||||
ninja test -C build
|
||||
|
||||
check-format:
|
||||
runs-on: brutalisk
|
||||
needs: [build-oci-image]
|
||||
container:
|
||||
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Check Formatting
|
||||
run: |
|
||||
meson setup -Dfuzz=enabled -Dtests=enabled -Dbuildtype=debugoptimized -Ddocs=enabled build
|
||||
ninja rustfmt -C build
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
ninja rustfmt -C build
|
||||
ninja rustdoc -C build
|
||||
ninja clippy -C build
|
||||
meson test -C build
|
||||
ninja test -C build
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![deny(unused_imports)]
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
|
||||
use core::slice;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
gencorpus = executable(
|
||||
'gencorpus',
|
||||
'atom_parser_gencorpus',
|
||||
'gencorpus.rs',
|
||||
dependencies: [mon],
|
||||
link_with: [gentoo_utils],
|
||||
)
|
||||
|
||||
corpus = custom_target(
|
||||
'corpus',
|
||||
'atom_parser_corpus',
|
||||
output: 'corpus',
|
||||
command: [gencorpus, 'corpus'],
|
||||
)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#![deny(unused_imports)]
|
||||
|
||||
use core::slice;
|
||||
use gentoo_utils::{
|
||||
Parseable,
|
||||
atom::{Atom, Version},
|
||||
};
|
||||
use mon::{Parser, ParserFinishedError, input::InputIter};
|
||||
use gentoo_utils::{Parseable, atom::Version};
|
||||
use mon::{Parser, input::InputIter};
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
io::{BufRead, BufReader, Write},
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
gencorpus = executable(
|
||||
'gencorpus',
|
||||
'atom_vercmp_gencorpus',
|
||||
'gencorpus.rs',
|
||||
dependencies: [mon],
|
||||
link_with: [gentoo_utils],
|
||||
)
|
||||
|
||||
corpus = custom_target(
|
||||
'corpus',
|
||||
'atom_vercmp_corpus',
|
||||
output: 'corpus',
|
||||
command: [gencorpus, 'corpus'],
|
||||
)
|
||||
|
||||
12
rust-analyzer.sh
Executable file
12
rust-analyzer.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# this script is a temporary workaround for not having a proper clippy-json target
|
||||
|
||||
source /etc/profile
|
||||
|
||||
cd build || exit $?
|
||||
|
||||
# compile as far as we can
|
||||
ninja
|
||||
|
||||
ninja clippy-json
|
||||
1
rust-project.json
Symbolic link
1
rust-project.json
Symbolic link
@@ -0,0 +1 @@
|
||||
build/rust-project.json
|
||||
@@ -646,14 +646,6 @@ mod test {
|
||||
|
||||
use crate::Parseable;
|
||||
|
||||
macro_rules! assert_eq_display {
|
||||
($a:expr, $b:expr) => {
|
||||
if $a != $b {
|
||||
panic!("{} != {}", $a, $b);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! assert_cmp_display {
|
||||
($a:expr, $b:expr, $ordering:expr) => {
|
||||
if $a.cmp(&$b) != $ordering {
|
||||
@@ -718,7 +710,9 @@ mod test {
|
||||
for (a, b, ordering) in cpvs.iter().copied().map(|(a, b, ordering)| {
|
||||
(
|
||||
Cpv::parser().parse_finished(InputIter::new(a)).unwrap(),
|
||||
Cpv::parser().parse_finished(InputIter::new(b)).unwrap(),
|
||||
Cpv::parser()
|
||||
.parse_finished(InputIter::new(b))
|
||||
.unwrap(),
|
||||
ordering,
|
||||
)
|
||||
}) {
|
||||
@@ -768,6 +762,7 @@ mod test {
|
||||
.parse_finished(InputIter::new("1.2.0a_alpha1_beta2-r1-8"))
|
||||
.unwrap();
|
||||
|
||||
#[allow(clippy::single_element_loop)]
|
||||
for (version_str, expected) in [("1.2.0", Ordering::Greater)] {
|
||||
let version = Version::parser()
|
||||
.parse_finished(InputIter::new(version_str))
|
||||
|
||||
Reference in New Issue
Block a user