Skip to content

Commit

Permalink
feat(ci): Releace an RPM along side the Tar when an RPMise env var is…
Browse files Browse the repository at this point in the history
… specified
  • Loading branch information
gmmorris committed Apr 7, 2019
1 parent f66603c commit f7c0b61
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
30 changes: 21 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,26 @@ env:
matrix:
include:
# Linux
- env: TARGET=i686-unknown-linux-gnu
- env: TARGET=i686-unknown-linux-musl
- env: TARGET=x86_64-unknown-linux-gnu
- env: TARGET=x86_64-unknown-linux-musl RPMISE=x86_64
- os: linux
rust: stable
env: TARGET=i686-unknown-linux-gnu
- os: linux
rust: stable
env: TARGET=i686-unknown-linux-musl
- os: linux
rust: stable
env: TARGET=x86_64-unknown-linux-gnu
- os: linux
rust: stable
env: TARGET=x86_64-unknown-linux-musl RPMISE=x86_64

# OSX
- env: TARGET=i686-apple-darwin
os: osx
- env: TARGET=x86_64-apple-darwin
os: osx
- os: osx
rust: stable
env: TARGET=i686-apple-darwin
- os: osx
rust: stable
env: TARGET=x86_64-apple-darwin

# Beta channel to make sure there are no regressions
- os: linux
Expand All @@ -36,6 +46,8 @@ before_install:
- echo "TRAVIS_OS_NAME=$TRAVIS_OS_NAME"
- echo "TRAVIS_RUST_VERSION=$TRAVIS_RUST_VERSION"
- echo "TRAVIS_TAG=$TRAVIS_TAG"
- echo "RELEASE AS:::::"
- echo "${CRATE_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz"

addons:
apt:
Expand All @@ -58,7 +70,7 @@ deploy:
api_key:
secure: ve4sGZMVasUuME9tvaG0V3fjbJAg+of7ZqsGlLknTQ8svqR4b9NFPZcJoeCZypwiFTOZOvukKW7L+icW/2nm0fpeXoAGq7nEQwsns19Z6VSw+VuRIWsX34vJYz0tOc5uTm+ZfFOBwkiXlXoxaDLh7VYPccmJCb5zaumNESaLOe+ZQ7FbetyZe6+yHsZoapsteveY3hu3wp0jL59vToQvFX1JXlvrzD7uvp7RbfqbqjwY9zqYYIgpzDz5XcaG1yV5ffF+5MXvi9pjnlPwrzn7TRdoslOcxvndmJXwZOgoXRNVu+FZsqVmJpcAjPB/8193gD2bj2Rv4DaMvlM1YdZ7UBv6OnoV3uu2ckBB32k3IzOOi+q47MU4ekN06Oxo2afSs9r9wDW8EFrX8PhFhqjx5DrwAfhBMNk7OyncQ/sV6T7UpoHdv+eeknH/ls8/SgDcrshfAlDZIdAqsYFD06M2zx4EOd9h9mgsgWDmN0ogG8w5PCANusxpDXsz4Ge7awP4SFpwddvzwfChwOqYYVe80RHAP9PGZtt4cB0tL+jWneYFNTXJh2hbBvrXV434Td65315FfWZrdI+bPkD/ike3budUsLgr1AeDMn2T4NWXOf+AIIeFUEjk99wW398qPJzwQJlqtwltkt6k+oIc2oc0MG0+JIjSdD390RFCzOQ3N88=
file_glob: true
file: ${CRATE_NAME}-${TRAVIS_TAG}-${TARGET}.*(tar.gz|rpm)
file: ${CRATE_NAME}-${TRAVIS_TAG}-${TARGET}*{.tar.gz,.rpm}
on:
condition: $TRAVIS_RUST_VERSION = stable
branch: master
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ regex = "1.1.0"

[package.metadata.rpm.cargo]
buildflags = ["--release"]
target = "$TARGET"

[package.metadata.rpm.targets]
jg = { path = "/usr/bin/jg" }
23 changes: 12 additions & 11 deletions ci/before_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,25 @@ main() {

cross rustc --bin jg --target $TARGET --release -- -C lto

if [ -z "$RPMISE" ]
then
echo "Skipping RPM"
else
echo "RPMising"
cargo install cargo-rpm
sed -i "s/\$TARGET/$TARGET/g" $src/Cargo.toml
cat $src/Cargo.toml
cargo rpm build -v
mv target/$TARGET/release/rpmbuild/RPMS/$RPMISE/*.rpm $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.rpm
fi

cp target/$TARGET/release/jg $stage/

cd $stage
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
cd $src

rm -rf $stage

if [ -z "$RPMISE" ]
then
echo "No RPMising configured"
else
echo "RPMising..."
cargo install cargo-rpm
cargo rpm build -v
echo "Moving RPM from target/$TARGET/release/rpmbuild/RPMS/$RPMISE/$CRATE_NAME-$TRAVIS_TAG-1.$RPMISE.rpm to $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.rpm"
cp target/$TARGET/release/rpmbuild/RPMS/$RPMISE/$CRATE_NAME-$TRAVIS_TAG-1.$RPMISE.rpm $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.rpm
fi
}

main

0 comments on commit f7c0b61

Please sign in to comment.