-
-
Notifications
You must be signed in to change notification settings - Fork 92
ci: Refactor stable.yml
#163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,29 @@ env: | |
REGISTRY_IMAGE: clux/muslrust | ||
|
||
jobs: | ||
check-stable: | ||
name: 'Check if workflow should continue' | ||
outputs: | ||
CONTINUE_BUILD: ${{ steps.check-stable-tag.outputs.CONTINUE_BUILD }} | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: 'Check if we need a new stable' | ||
id: check-stable-tag | ||
shell: bash | ||
run: | | ||
pip3 install --user toml | ||
if python3 check_stable.py; then | ||
echo 'Stable tag missing; running all build steps' | ||
echo 'CONTINUE_BUILD=YES' >> "${GITHUB_OUTPUT}" | ||
else | ||
echo 'Stable tag found; skipping all build steps' | ||
fi | ||
|
||
build: | ||
name: 'Stable Build' | ||
needs: [check-stable] | ||
if: ${{ needs.check-stable.outputs.CONTINUE_BUILD == 'YES' }} | ||
runs-on: 'ubuntu-latest' | ||
strategy: | ||
fail-fast: false | ||
|
@@ -41,23 +62,6 @@ jobs: | |
username: clux | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Check if we need a new stable | ||
id: stablecheck | ||
shell: bash | ||
run: | | ||
pip3 install --user toml | ||
if python3 check_stable.py; then | ||
echo "Stable tag missing; running all build steps" | ||
echo "BUILD=YES" >> $GITHUB_OUTPUT | ||
else | ||
echo "Stable tag found; skipping all build steps" | ||
fi | ||
|
||
- name: Prepare | ||
run: | | ||
platform=${{ matrix.platform }} | ||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
|
@@ -82,10 +86,8 @@ jobs: | |
tags: rustmusl-temp | ||
build-args: | | ||
CHANNEL=stable | ||
if: ${{ steps.stablecheck.outputs.BUILD }} | ||
|
||
- name: Run tests | ||
if: ${{ steps.stablecheck.outputs.BUILD }} | ||
shell: bash | ||
run: | | ||
docker buildx build --platform ${{ matrix.platform }} --output type=docker -t test-runner - < Dockerfile.test-runner | ||
|
@@ -98,7 +100,6 @@ jobs: | |
# only identifiable by their digest and it appears docker does not let us select an image that way. | ||
# Not the most elegant, but it works. | ||
- name: Store tag info | ||
if: ${{ steps.stablecheck.outputs.BUILD }} | ||
shell: bash | ||
run: | | ||
mkdir -p /tmp/tags | ||
|
@@ -111,7 +112,6 @@ jobs: | |
echo $RUST_VER > /tmp/tags/rust-ver | ||
|
||
- name: Tag and push | ||
if: ${{ steps.stablecheck.outputs.BUILD }} | ||
shell: bash | ||
run: | | ||
RUST_DATE=$(cat /tmp/tags/rust-date) | ||
|
@@ -125,15 +125,13 @@ jobs: | |
|
||
# TODO: want to do this, but need digest, which might not be trivial to get outside build-push-action | ||
# - name: Attest docker.io | ||
# if: ${{ steps.stablecheck.outputs.BUILD }} | ||
# uses: actions/[email protected] | ||
# with: | ||
# subject-name: docker.io/${{ env.REGISTRY_IMAGE }} | ||
# subject-digest: ${{ steps.push_stable.outputs.digest }} | ||
# push-to-registry: true | ||
|
||
- name: Upload tags | ||
if: ${{ steps.stablecheck.outputs.BUILD }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tags-${{matrix.arch}} | ||
|
@@ -148,21 +146,7 @@ jobs: | |
needs: | ||
- build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check if we need a new stable | ||
id: stablecheck | ||
shell: bash | ||
run: | | ||
pip3 install --user toml | ||
if python3 check_stable.py; then | ||
echo "Stable tag missing; running all build steps" | ||
echo "BUILD=YES" >> $GITHUB_OUTPUT | ||
else | ||
echo "Stable tag found; skipping all build steps" | ||
fi | ||
|
||
- name: Download tags | ||
if: ${{ steps.stablecheck.outputs.BUILD }} | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/tags | ||
|
@@ -185,19 +169,28 @@ jobs: | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Create manifest list and push multi-platform images | ||
if: ${{ steps.stablecheck.outputs.BUILD }} | ||
shell: bash | ||
run: | | ||
RUST_DATE=$(cat /tmp/tags/rust-date) | ||
RUST_CHANNEL=$(cat /tmp/tags/rust-channel) | ||
RUST_VER=$(cat /tmp/tags/rust-ver) | ||
|
||
for tag in ${RUST_CHANNEL} ${RUST_CHANNEL}-${RUST_DATE} ${RUST_VER}-${RUST_CHANNEL} ${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}; do | ||
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:$tag \ | ||
${{ env.REGISTRY_IMAGE }}:amd64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE} \ | ||
${{ env.REGISTRY_IMAGE }}:arm64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE} | ||
done | ||
# The two already published image tags to associate additional tags to: | ||
AMD64="${{ env.REGISTRY_IMAGE }}:amd64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}" | ||
ARM64="${{ env.REGISTRY_IMAGE }}:arm64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}" | ||
|
||
EXTRA_TAGS=( | ||
"${RUST_CHANNEL}" | ||
"${RUST_CHANNEL}-${RUST_DATE}" | ||
"${RUST_VER}-${RUST_CHANNEL}" | ||
"${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}" | ||
) | ||
|
||
# Assign each tag to the two source image tags: | ||
for TAG in "${EXTRA_TAGS[@]}"; do | ||
docker buildx imagetools create --tag "${{ env.REGISTRY_IMAGE }}:${TAG}" "${AMD64}" "${ARM64}" | ||
done | ||
|
||
- name: Inspect image | ||
if: ${{ steps.stablecheck.outputs.BUILD }} | ||
run: | | ||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this was probably from some older experiments iirc.