Skip to content

Commit

Permalink
Merge pull request #68 from bitrise-io/ACI-3019-check-metadata
Browse files Browse the repository at this point in the history
Make it easier to update gradle verification reference
  • Loading branch information
lpusok authored Dec 2, 2024
2 parents 48ebc83 + 09808fe commit 8d1dd83
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 713 deletions.
10 changes: 0 additions & 10 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
linters:
enable-all: true
disable:
- varcheck # deprecated
- deadcode # deprecated
- interfacer # deprecated
- golint # deprecated
- nosnakecase # deprecated
- structcheck # deprecated
- exhaustivestruct # deprecated
- ifshort # deprecated
- maligned # deprecated
- scopelint # deprecated
- funlen
- gochecknoinits
- lll # line too long
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tool versions
GOLANGCI_LINT_VERSION = v1.58.1
GOLANGCI_LINT_VERSION = v1.60.0

.PHONY: lint
lint: ## Runs golangci-lint
Expand Down
88 changes: 60 additions & 28 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ trigger_map:
workflow: test
- tag: '*.*.*'
workflow: release

workflows:
release:
description: Creates Linux and Darwin binaries, then publishes a GitHub release
Expand All @@ -38,33 +39,7 @@ workflows:
set -ex
GOBIN=/usr/local/bin/ go install github.com/goreleaser/goreleaser/v2@latest
- script:
title: Generate verification
inputs:
- content: |
#!/bin/bash
set -ex
# Backup $HOME/.gradle/init.d/bitrise-build-cache.init.gradle.kts
GRADLE_INIT_PATH=$HOME/.gradle/init.d/bitrise-build-cache.init.gradle.kts
if [[ -f "$GRADLE_INIT_PATH" ]]; then
mv $GRADLE_INIT_PATH $GRADLE_INIT_PATH.backup
fi
go build -o /tmp/bin/bitrise-build-cache-cli
SAMPLE_PATH=$(realpath ./gradle_verification_sample)
# add plugin with CLI
cd "$SAMPLE_PATH"
/tmp/bin/bitrise-build-cache-cli add-gradle-deps
# generate xml
rm -f "$SAMPLE_PATH/gradle/verification-metadata.xml"
./gradlew --write-verification-metadata sha256 help
echo "Generated verification xml:"
cat "$SAMPLE_PATH/gradle/verification-metadata.xml"
- bundle::check_gradle_verification_reference: { }
- script:
title: Goreleaser (create binaries + publish to GH)
deps:
Expand Down Expand Up @@ -95,7 +70,12 @@ workflows:
set -ex
make lint
- go-test@1: {}
- bundle::check_gradle_verification_reference: { }
- deploy-to-bitrise-io@2: {}
meta:
bitrise.io:
machine_type_id: g2-m1.8core
stack: osx-xcode-edge

e2e:
steps:
Expand All @@ -113,5 +93,57 @@ workflows:
inputs:
- content: |-
set -ex
bitrise run --config e2e/bitrise.yml test_gradle_output_diagnostics
bitrise run --config e2e/bitrise.yml test_gradle_output_diagnostics
check_gradle_verification:
steps:
- bundle::check_gradle_verification_reference: { }

step_bundles:
check_gradle_verification_reference:
steps:
- script:
title: Generate Gradle verification reference
inputs:
- content: |
#!/bin/bash
set -ex
# Backup $HOME/.gradle/init.d/bitrise-build-cache.init.gradle.kts
GRADLE_INIT_PATH=$HOME/.gradle/init.d/bitrise-build-cache.init.gradle.kts
if [[ -f "$GRADLE_INIT_PATH" ]]; then
mv $GRADLE_INIT_PATH $GRADLE_INIT_PATH.backup
fi
go build -o /tmp/bin/bitrise-build-cache-cli
SAMPLE_PATH=$(realpath ./gradle_verification_sample)
# add plugin with CLI
cd "$SAMPLE_PATH"
/tmp/bin/bitrise-build-cache-cli add-gradle-deps
# generate xml
rm -f "$SAMPLE_PATH/gradle/verification-metadata.xml"
./gradlew --write-verification-metadata sha256 help
GRADLE_VERIFICATION_REF_PATH=$SAMPLE_PATH/gradle/verification-metadata.xml
cat $GRADLE_VERIFICATION_REF_PATH
echo "Generated verification xml: $GRADLE_VERIFICATION_REF_PATH"
envman add --key GRADLE_VERIFICATION_REF_PATH --value "$GRADLE_VERIFICATION_REF_PATH"
- script@1:
title: Check if local updates to verification-metadata.xml are not commited
inputs:
- content: |-
set -x
git update-index --refresh | grep "verification-metadata.xml"
if [[ $? == 0 ]]; then
echo "Please manually commit the changes to the repo:"
echo "$GRADLE_VERIFICATION_REF_PATH"
exit 1
else
echo "The files have no unstaged changes: $GRADLE_VERIFICATION_REF_PATH"
exit 0
fi
18 changes: 13 additions & 5 deletions gradle_verification_sample/gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
<sha256 value="f8698ab46ca996ce889c1afc8ca4f25eb8ac6b034dc898d4583742360016cc04" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.guava" name="guava-parent" version="32.1.3-android">
<artifact name="guava-parent-32.1.3-android.pom">
<sha256 value="41fc26464fba8ab0b55b402676b45369e0aaa9ba8e0a5a5dec80452908ac97e1" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.guava" name="listenablefuture" version="9999.0-empty-to-avoid-conflict-with-guava">
<artifact name="listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar">
<sha256 value="b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -167,12 +172,12 @@
<sha256 value="b1c2199e1c0cc969ef61cbbe4af2ecaf9b06411bdde01cbaf6fc9134dfe04e8a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="io.bitrise.gradle" name="gradle-analytics" version="2.1.7">
<artifact name="gradle-analytics-2.1.7.jar">
<sha256 value="9c2dc73884794752dced8414352cd5ac57907ea7f45509464c3dad3a13561d5f" origin="Generated by Gradle"/>
<component group="io.bitrise.gradle" name="gradle-analytics" version="2.1.8">
<artifact name="gradle-analytics-2.1.8.jar">
<sha256 value="7e7f7f7bfd65195eabd0f3407f54bd13d9834d68b060ac735007728a7e6ab114" origin="Generated by Gradle"/>
</artifact>
<artifact name="gradle-analytics-2.1.7.module">
<sha256 value="e4e1c2fe8ca18c7b797e6b72667aa9a299e46e8cd61df70765f9cc96bfd676df" origin="Generated by Gradle"/>
<artifact name="gradle-analytics-2.1.8.module">
<sha256 value="4c89c0362a3e59d2212d5b265132dc125c2c27fd704c5ab4e9c4e9a861e84e23" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="io.bitrise.gradle" name="remote-cache" version="1.2.9">
Expand Down Expand Up @@ -630,6 +635,9 @@
</artifact>
</component>
<component group="org.junit" name="junit-bom" version="5.9.2">
<artifact name="junit-bom-5.9.2.module">
<sha256 value="ab137ba5a8e32c9b066bf9126a1c76dd5614b724ba5c0b02549772b5e9f4cf1f" origin="Generated by Gradle"/>
</artifact>
<artifact name="junit-bom-5.9.2.pom">
<sha256 value="2ed07d65845131f5336a86476c9a4056b59d0b58b9815ab3679bb0f36f35f705" origin="Generated by Gradle"/>
</artifact>
Expand Down
Loading

0 comments on commit 8d1dd83

Please sign in to comment.