Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5efad5e

Browse files
committed
Include date and commit SHA information in HQ nightlies
1 parent c059ecb commit 5efad5e

2 files changed

Lines changed: 34 additions & 9 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,22 @@ on:
55
schedule:
66
- cron: '0 0 * * *'
77
jobs:
8+
set-env:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
version: ${{ env.HQ_VERSION }}
12+
steps:
13+
- name: Checkout sources
14+
uses: actions/checkout@v2
15+
- name: Set HQ nightly version
16+
run: |
17+
echo "HQ_VERSION=nightly-$(date +'%Y-%m-%d')-${{ github.sha }}" >> $GITHUB_ENV
18+
- name: Print HQ nightly version
19+
run: |
20+
echo "HQ version: ${{ env.HQ_VERSION }}"
821
build-binaries-x64:
922
runs-on: ubuntu-latest
23+
needs: [ set-env ]
1024
# Use a container with GLIBC 2.17
1125
container: quay.io/pypa/manylinux2014_x86_64
1226
steps:
@@ -27,6 +41,8 @@ jobs:
2741

2842
- name: Compile
2943
uses: actions-rs/cargo@v1
44+
env:
45+
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
3046
with:
3147
command: build
3248
args: --release
@@ -37,7 +53,7 @@ jobs:
3753
- name: Prepare archive
3854
id: archive
3955
run: |
40-
export ARCHIVE_NAME=hq-nightly-linux-x64.tar.gz
56+
export ARCHIVE_NAME=hq-${{ needs.set-env.outputs.version }}-linux-x64.tar.gz
4157
tar -czvf $ARCHIVE_NAME -C target/release hq
4258
echo "::set-output name=archive-name::$ARCHIVE_NAME"
4359
@@ -48,6 +64,7 @@ jobs:
4864
path: ${{ steps.archive.outputs.archive-name }}
4965
build-binaries-powerpc:
5066
runs-on: ubuntu-latest
67+
needs: [ set-env ]
5168
steps:
5269
- name: Checkout sources
5370
uses: actions/checkout@v2
@@ -57,19 +74,24 @@ jobs:
5774
profile: minimal
5875
toolchain: stable
5976
override: true
77+
6078
- uses: Swatinem/rust-cache@v1
6179
with:
6280
key: powerpc64le-unknown-linux-gnu
81+
6382
- name: Compile
6483
uses: actions-rs/cargo@v1
84+
env:
85+
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
6586
with:
6687
command: build
6788
args: --target powerpc64le-unknown-linux-gnu --no-default-features --release
6889
use-cross: true
90+
6991
- name: Prepare archive
7092
id: archive
7193
run: |
72-
export ARCHIVE_NAME=hq-nightly-linux-powerpc64.tar.gz
94+
export ARCHIVE_NAME=hq-${{ needs.set-env.outputs.version }}-linux-powerpc64.tar.gz
7395
tar -czvf $ARCHIVE_NAME -C target/powerpc64le-unknown-linux-gnu/release hq
7496
echo "::set-output name=archive-name::$ARCHIVE_NAME"
7597
@@ -80,7 +102,7 @@ jobs:
80102
path: ${{ steps.archive.outputs.archive-name }}
81103
create-tag:
82104
runs-on: ubuntu-latest
83-
needs: [ build-binaries-x64, build-binaries-powerpc ]
105+
needs: [ set-env, build-binaries-x64, build-binaries-powerpc ]
84106
steps:
85107
- name: Checkout sources
86108
uses: actions/checkout@v2
@@ -89,12 +111,10 @@ jobs:
89111
with:
90112
tag: nightly
91113
force_push_tag: true
92-
message: "Nightly build"
114+
message: Nightly build ${{ needs.set-env.outputs.version }}
93115
create-release:
94116
runs-on: ubuntu-latest
95-
needs: [ create-tag ]
96-
outputs:
97-
upload_url: ${{ steps.create-release.outputs.upload_url }}
117+
needs: [ set-env, create-tag ]
98118
steps:
99119
- name: Checkout sources
100120
uses: actions/checkout@v2
@@ -105,15 +125,20 @@ jobs:
105125
- name: Download artifacts
106126
uses: actions/download-artifact@v2
107127

128+
- name: Prepare release name
129+
run: |
130+
echo "RELEASE_NAME=Nightly build $(date +'%Y-%m-%d')" >> $GITHUB_ENV
131+
108132
- name: Create release
109133
uses: ncipollo/release-action@v1
110134
id: create-release
111135
with:
112136
bodyFile: generated-changelog.md
113137
token: ${{ secrets.GITHUB_TOKEN }}
114138
allowUpdates: true
115-
name: Nightly build
139+
name: ${{ env.RELEASE_NAME }}
116140
prerelease: true
117141
tag: nightly
118142
commit: ${{ github.sha }}
119143
artifacts: archive-*/**
144+
removeArtifacts: true

crates/hyperqueue/src/bin/hq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct CommonOpts {
5959

6060
// Root CLI options
6161
#[derive(Parser)]
62-
#[clap(author, about, version)]
62+
#[clap(author, about, version(option_env!("HQ_BUILD_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"))))]
6363
struct Opts {
6464
#[clap(flatten)]
6565
common: CommonOpts,

0 commit comments

Comments
 (0)