Skip to content

Commit cefabe2

Browse files
committed
Break up the CI release step to a separate job
Creating the release should only happen if both 32- and 64-bit builds complete. Split the wokflow into multiple jobs: - One job runs on Windows, and does all the build and test steps for both 32- and 64-bit releases, in separate runners. If it's a build that might get released, it'll stage the binaries, but not yet mark them as ready for upload. - The second job only runs if this is going to be a release, and if the first job completed succesfully. It runs on Linux, for speed, and is responsible for (a) downloading the relevant artifacts from the previous builds, (b) creating the GitHub release, which will include the packages and hint files from the first job, and (c) marking the staged binaries on the Cygwin server as being ready to release.
1 parent fe2458c commit cefabe2

File tree

1 file changed

+80
-25
lines changed

1 file changed

+80
-25
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: CI
22
on: [push, pull_request]
33
jobs:
4-
ci:
4+
5+
build-test:
56
strategy:
67
matrix:
78
platform: [x86, x64]
@@ -60,47 +61,101 @@ jobs:
6061
echo "$MAINTAINER_KEY" >~/.ssh/id_rsa
6162
echo 'cygwin.com,8.43.85.97 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGqrxexIuyqmCVe33p1HuhUFzsXte5QZKb+BJlsRrvXOpUOJEW2S0kszyAiymeV7AXaYmHDKVRJpGVR+0ua0Xww=' >~/.ssh/known_hosts
6263
timeout-minutes: 1
63-
- name: Compute release name
64+
- name: Cygport stage
6465
if: github.ref == 'refs/heads/main'
66+
run: SSH_KEY=~/.ssh/id_rsa cygport moreutils.cygport stage
67+
timeout-minutes: 5
68+
- name: Tar up build results
69+
if: always()
70+
run: tar -caf moreutils-${{ matrix.platform }}.txz moreutils-*-*.*/
71+
timeout-minutes: 10
72+
- name: Store build results
73+
if: always()
74+
uses: actions/upload-artifact@v2
75+
with:
76+
name: build-results-${{ matrix.platform }}
77+
path: moreutils-${{ matrix.platform }}.txz
78+
if-no-files-found: error
79+
timeout-minutes: 5
80+
81+
release:
82+
if: github.ref == 'refs/heads/main'
83+
needs: build-test
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Install lftp
87+
run: |
88+
sudo apt-get update
89+
sudo apt-get install lftp
90+
timeout-minutes: 5
91+
- name: Checkout
92+
uses: actions/checkout@v2
93+
with:
94+
fetch-depth: 0
95+
timeout-minutes: 1
96+
- name: Compute release name
6597
id: release-name
6698
run: |
6799
eval $(grep -e '^VERSION=' -e '^RELEASE=' moreutils.cygport)
68-
printf '::set-output name=release::v%s-%s' "$VERSION" "$RELEASE"
100+
printf '::set-output name=release::%s-%s' "$VERSION" "$RELEASE"
101+
timeout-minutes: 1
102+
- name: Download build results
103+
uses: actions/download-artifact@v2
104+
timeout-minutes: 5
105+
- name: Unpack build results
106+
run: |
107+
tar -xaf build-results-x86/moreutils-x86.txz
108+
tar -xaf build-results-x64/moreutils-x64.txz
109+
timeout-minutes: 5
110+
- name: Name release artifacts for the GitHub release
111+
env:
112+
PVR: ${{ steps.release-name.outputs.release }}
113+
run: |
114+
(
115+
cd "moreutils-${PVR}.i686/dist/moreutils" &&
116+
rm "moreutils-${PVR}-src".* &&
117+
mv "moreutils-${PVR}.hint" "moreutils-${PVR}.i686.hint" &&
118+
mv "moreutils-${PVR}.tar.xz" "moreutils-${PVR}.i686.tar.xz"
119+
)
120+
(
121+
cd "moreutils-${PVR}.x86_64/dist/moreutils" &&
122+
mv "moreutils-${PVR}.hint" "moreutils-${PVR}.x86_64.hint" &&
123+
mv "moreutils-${PVR}.tar.xz" "moreutils-${PVR}.x86_64.tar.xz"
124+
)
69125
timeout-minutes: 1
70126
- name: Create release tag
71-
if: github.ref == 'refs/heads/main'
72127
env:
73128
GIT_COMMITTER_NAME: ${{ github.actor }}
74129
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com
75130
run: |
76-
git tag -am '${{ steps.release-name.outputs.release }}' '${{ steps.release-name.outputs.release }}'
77-
git push origin tag '${{ steps.release-name.outputs.release }}'
131+
git tag -am 'v${{ steps.release-name.outputs.release }}' 'v${{ steps.release-name.outputs.release }}'
132+
git push origin tag 'v${{ steps.release-name.outputs.release }}'
78133
timeout-minutes: 1
79134
- name: Create a GitHub release
80-
if: github.ref == 'refs/heads/main'
81135
uses: softprops/action-gh-release@v1
82136
with:
83-
tag_name: ${{ steps.release-name.outputs.release }}
137+
tag_name: v${{ steps.release-name.outputs.release }}-test
84138
files: moreutils-*/dist/moreutils/*
85139
target_commitish: ${{ github.ref }}
86140
timeout-minutes: 2
141+
- name: Configure SSH
142+
env:
143+
MAINTAINER_KEY: ${{ secrets.MAINTAINER_KEY }}
144+
run: |
145+
umask 0077
146+
mkdir -p ~/.ssh
147+
echo "$MAINTAINER_KEY" >~/.ssh/id_rsa
148+
echo 'cygwin.com,8.43.85.97 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGqrxexIuyqmCVe33p1HuhUFzsXte5QZKb+BJlsRrvXOpUOJEW2S0kszyAiymeV7AXaYmHDKVRJpGVR+0ua0Xww=' >~/.ssh/known_hosts
149+
timeout-minutes: 1
87150
- name: Mirror to Cygwin Git repositories
88-
if: github.ref == 'refs/heads/main'
89-
run: git push cygwin@cygwin.com:/git/cygwin-packages/moreutils '${{ steps.release-name.outputs.release }}'
151+
run: git push cygwin@cygwin.com:/git/cygwin-packages/moreutils 'v${{ steps.release-name.outputs.release }}'
90152
timeout-minutes: 5
91-
- name: Cygport upload
92-
if: github.ref == 'refs/heads/main'
93-
run: SSH_KEY=~/.ssh/id_rsa cygport moreutils.cygport upload
94-
timeout-minutes: 5
95-
- name: Tar up build results
96-
if: always()
97-
run: tar -caf moreutils-${{ matrix.platform }}.txz moreutils-*-*.*/
98-
timeout-minutes: 10
99-
- name: Store build results
100-
if: always()
101-
uses: actions/upload-artifact@v2
102-
with:
103-
name: build-results-${{ matrix.platform }}
104-
path: moreutils-${{ matrix.platform }}.txz
105-
if-no-files-found: error
153+
- name: Release on the Cygwin mirror
154+
run: >
155+
lftp -c 'set cmd:fail-exit on;
156+
set cmd:interactive on;
157+
set net:max-retries 1;
158+
open sftp://cygwin:@cygwin.com;
159+
put /dev/null -o /x86/release/moreutils/!ready;
160+
put /dev/null -o /x86_64/release/moreutils/!ready;'
106161
timeout-minutes: 5

0 commit comments

Comments
 (0)