Skip to content

Commit e8eceda

Browse files
authored
Use GitHub Actions for CI and release (#4)
Pull requests and master now get checks run regularly. Tags beginning with 'release/*' are automatically publishbed as draft releases.
1 parent 7e779ba commit e8eceda

File tree

8 files changed

+123
-22
lines changed

8 files changed

+123
-22
lines changed

.github/workflows/check.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Check
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-18.04
12+
container:
13+
image: docker://rust:1.37-buster
14+
steps:
15+
- uses: actions/checkout@v1
16+
- run: make check-fmt check

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'release/*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
14+
- name: Get tag
15+
run: |
16+
echo "${{ github.ref }}" | sed -E 's,^refs/tags/,,' >release.tag
17+
cat release.tag
18+
echo "${{ github.ref }}" | sed -E 's,^refs/tags/release/,,' >release.name
19+
cat release.name
20+
21+
- name: Build
22+
uses: docker://rust:1.37-buster
23+
env:
24+
CARGO_RELEASE: 1
25+
with:
26+
entrypoint: make
27+
args: release
28+
29+
- name: Upload
30+
uses: docker://github/ghx:master
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
entrypoint: sh
35+
# bastard blackbox ghx reads GITHUB_REF and then barfs on it, no matter
36+
# its command-line args. so just hide that env from it..
37+
args: -c "unset GITHUB_REF ; cd release && ghx release create --verbose --tag=$(cat ../release.tag) --name=$(cat ../release.name) --ref ${{ github.sha }} --draft *"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/release
12
/target
2-
**/*.rs.bk
3+
**/*.rs.bk

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "linkerd-await"
3-
version = "0.1.1"
4-
authors = ["Oliver Gould <ver@buoyant.io>"]
3+
version = "0.1.2"
4+
authors = ["Linkerd Developers <[email protected].io>"]
55
edition = "2018"
66
publish = false
77

Dockerfile

Lines changed: 0 additions & 15 deletions
This file was deleted.

Makefile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
TARGET ?= x86_64-unknown-linux-musl
2+
TARGET_DIR = target/$(TARGET)/debug
3+
ifdef CARGO_RELEASE
4+
RELEASE = --release
5+
TARGET_DIR = target/$(TARGET)/release
6+
endif
7+
TARGET_BIN = $(TARGET_DIR)/linkerd-await
8+
9+
RUSTUP ?= rustup
10+
CARGO ?= cargo
11+
CARGO_BUILD = $(CARGO) build --frozen --target=$(TARGET) $(RELEASE)
12+
CARGO_CHECK = $(CARGO) check --all --frozen --target=$(TARGET) $(RELEASE)
13+
CARGO_TEST = $(CARGO) test --all --frozen --target=$(TARGET) $(RELEASE)
14+
CARGO_FMT = $(CARGO) fmt --all
15+
16+
SHASUM = shasum -a 256
17+
18+
.PHONY: all
19+
all: check-fmt check
20+
21+
.PHONY: configure-target
22+
configure-target:
23+
$(RUSTUP) target add $(TARGET)
24+
25+
.PHONY: configure-fmt
26+
configure-fmt:
27+
$(RUSTUP) component add rustfmt
28+
29+
.PHONY: fetch
30+
fetch: Cargo.lock
31+
$(CARGO) fetch --locked
32+
33+
$(TARGET_BIN): fetch configure-target
34+
$(CARGO_BUILD)
35+
36+
.PHONY: clean
37+
clean:
38+
$(CARGO) clean --target-dir $(TARGET_DIR)
39+
40+
.PHONY: check-fmt
41+
check-fmt: configure-fmt
42+
$(CARGO_FMT) -- --check
43+
44+
.PHONY: check
45+
check: configure-target fetch
46+
$(CARGO_CHECK)
47+
48+
49+
.PHONY: fmt
50+
fmt: configure-fmt
51+
$(CARGO_FMT)
52+
53+
.PHONY: build
54+
build: $(TARGET_BIN)
55+
56+
release: $(TARGET_BIN)
57+
@rm -rf release && mkdir release
58+
cp $(TARGET_BIN) release/linkerd-await
59+
strip release/linkerd-await
60+
$(SHASUM) release/linkerd-await >release/linkerd-await.shasum

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A command-wrapper that polls Linkerd for readiness until it becomes ready and on
55
## Usage
66

77
```
8-
linkerd-await 0.1.1
8+
linkerd-await 0.1.2
99
Oliver Gould <[email protected]>
1010
Wait for linkerd to become ready before running a program.
1111
@@ -32,9 +32,11 @@ The `linkerd-await` container image contains only a static binary, so it's
3232
possible to use this utility in `scratch` images:
3333

3434
```dockerfile
35+
ARG LINKERD_AWAIT_VERSION=v0.1.2
36+
3537
FROM scratch
36-
# ...
37-
COPY --from=olix0r/linkerd-await:v0.1.1 /linkerd-await /
38+
RUN curl -vsLO https://github.com/olix0r/linkerd-await/releases/download/${LINKERD_AWAIT_VERSION}/linkerd-await
39+
# ... install myapp ..
3840
ENTRYPOINT ["/linkerd-await", "--"]
3941
CMD ["/myapp", "-flags"]
4042
```

0 commit comments

Comments
 (0)