fix(ci): Build all features for each package and build all archs

This commit is contained in:
Gerald Pinder 2024-11-25 22:09:36 -05:00
parent ddfacd3492
commit c8d8ab306c
5 changed files with 38 additions and 15 deletions

View file

@ -115,7 +115,7 @@ jobs:
- name: Run build - name: Run build
id: build id: build
run: | run: |
earthly --ci --push -P +build-images earthly --ci --push -P +build-images-all
build-scripts: build-scripts:
timeout-minutes: 5 timeout-minutes: 5
@ -140,7 +140,7 @@ jobs:
- name: Run build - name: Run build
id: build id: build
run: | run: |
earthly --ci --push -P +build-scripts earthly --ci --push -P +build-scripts-all
integration-tests: integration-tests:
permissions: permissions:

View file

@ -172,7 +172,7 @@ jobs:
- name: Run build - name: Run build
id: build id: build
run: | run: |
earthly --ci --push -P +build-scripts earthly --ci --push -P +build-scripts-all
build-images: build-images:
permissions: permissions:
@ -215,11 +215,11 @@ jobs:
- name: Run build - name: Run build
if: github.repository == 'blue-build/cli' if: github.repository == 'blue-build/cli'
run: earthly --push --ci -P +build-images run: earthly --push --ci -P +build-images-all
- name: Run build fork - name: Run build fork
if: github.repository != 'blue-build/cli' if: github.repository != 'blue-build/cli'
run: earthly --ci -P +build-images run: earthly --ci -P +build-images-all
integration-tests: integration-tests:
permissions: permissions:

View file

@ -102,7 +102,7 @@ jobs:
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
CARGO_PACKAGE_VERSION="v$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version')" CARGO_PACKAGE_VERSION="v$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version')"
LATEST=$(test "$CARGO_PACKAGE_VERSION" = "$LATEST_TAG" && echo true || echo false) LATEST=$(test "$CARGO_PACKAGE_VERSION" = "$LATEST_TAG" && echo true || echo false)
earthly --ci --push +build-scripts --TAGGED="true" --LATEST="$LATEST" earthly --ci --push +build-scripts-all --TAGGED="true" --LATEST="$LATEST"
build-images: build-images:
permissions: permissions:
@ -140,4 +140,4 @@ jobs:
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
CARGO_PACKAGE_VERSION="v$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version')" CARGO_PACKAGE_VERSION="v$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version')"
LATEST=$(test "$CARGO_PACKAGE_VERSION" = "$LATEST_TAG" && echo true || echo false) LATEST=$(test "$CARGO_PACKAGE_VERSION" = "$LATEST_TAG" && echo true || echo false)
earthly --push --ci -P +build-images --TAGGED="true" --LATEST="$LATEST" earthly --push --ci -P +build-images-all --TAGGED="true" --LATEST="$LATEST"

View file

@ -16,6 +16,12 @@ run-checks:
BUILD +lint BUILD +lint
BUILD +test BUILD +test
build-images-all:
BUILD --platform=linux/amd64 --platform=linux/arm64 +build-images
build-scripts-all:
BUILD --platform=linux/amd64 --platform=linux/arm64 +build-scripts
build-images: build-images:
BUILD +blue-build-cli BUILD +blue-build-cli
BUILD +blue-build-cli-distrobox BUILD +blue-build-cli-distrobox
@ -31,12 +37,7 @@ lint:
DO rust+CARGO --args="clippy" DO rust+CARGO --args="clippy"
DO rust+CARGO --args="clippy --all-features" DO rust+CARGO --args="clippy --all-features"
DO rust+CARGO --args="clippy --no-default-features" DO rust+CARGO --args="clippy --no-default-features"
FOR feat IN $( \ DO +EACH_PACKAGE --args="clippy --no-default-features"
cargo metadata --format-version 1 \
| jq -cr '.packages[] | select(.name == "blue-build") | .features | keys | .[] | select(. != "default")' \
)
DO rust+CARGO --args="clippy --no-default-features --features $feat"
END
test: test:
FROM +common FROM +common
@ -46,11 +47,30 @@ test:
DO rust+CARGO --args="test --workspace" DO rust+CARGO --args="test --workspace"
DO rust+CARGO --args="test --workspace --all-features" DO rust+CARGO --args="test --workspace --all-features"
DO rust+CARGO --args="test --workspace --no-default-features" DO rust+CARGO --args="test --workspace --no-default-features"
DO +EACH_PACKAGE --args="test --no-default-features"
EACH_PACKAGE:
FUNCTION
ARG --required args
FOR package IN $( \
cargo metadata --format-version 1 \
| jq -cr '.workspace_members | .[]' \
| sed 's|.*#||' | sed 's|@.*||' \
)
DO --pass-args +EACH_FEAT --package="$package"
END
EACH_FEAT:
FUNCTION
ARG --required args
ARG --required package
FOR feat IN $( \ FOR feat IN $( \
cargo metadata --format-version 1 \ cargo metadata --format-version 1 \
| jq -cr '.packages[] | select(.name == "blue-build") | .features | keys | .[] | select(. != "default")' \ | jq -cr ".packages[] | select(.name == \"$package\") | .features | keys | .[] | select(. != \"default\")" \
) )
DO rust+CARGO --args="test --workspace --features $feat" DO rust+CARGO --args="$args --package $package --features $feat"
END END
install: install:

View file

@ -97,6 +97,9 @@ tools:
release *args: release *args:
#!/usr/bin/env bash #!/usr/bin/env bash
set -euxo pipefail set -euxo pipefail
earthly --ci +run-checks
# --workspace: updating all crates in the workspace # --workspace: updating all crates in the workspace
# --no-tag: do not push tag for each new version # --no-tag: do not push tag for each new version
# --no-confirm: don't look for user input, just run the command # --no-confirm: don't look for user input, just run the command