8000 Build binaries using Github actions. by remgodow · Pull Request #181 · imsnif/bandwhich · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Build binaries using Github actions. #181

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 45 commits into from
Sep 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6333b33
Remove connections vector from OpenSockets, use common OpenSockets im…
Aug 16, 2020
f09ad10
Replace termion backend with crossterm, which works on Windows as well.
Aug 16, 2020
c9e748f
Merge branch 'crossterm' into windows
Aug 17, 2020
56d47ea
More fixes for windows build.
Aug 17, 2020
8c07e77
Remove tui default-features (termion), update unit tests for crossterm.
Aug 17, 2020
d6bdcae
Merge remote-tracking branch 'origin/crossterm' into windows
Aug 17, 2020
9f0f0d9
Windows compilation fixes.
Sep 1, 2020
20f7c9c
Remove unused get_open_sockets implementations for linux and mac. Fix…
Sep 2, 2020
1772bdb
Add build.rs for windows to download and extract Packet.lib from npca…
Sep 2, 2020
f7d9a65
Merge remote-tracking branch 'upstream/main' into windows
Sep 2, 2020
743150f
Resolve Cargo.lock after merging main.
Sep 2, 2020
ae5d79d
Merge branch 'main' into windows
imsnif Sep 3, 2020
336fde4
fix(tests): adjust snapshots new location of the dns resolution
imsnif Sep 3, 2020
3fda7ef
style(clippy): clippy
imsnif Sep 3, 2020
db1966a
style(clippy): remove dead code
imsnif Sep 3, 2020
b4908d3
Test github actions.
Sep 5, 2020
644afec
Fix action syntax.
Sep 5, 2020
0f12de9
Fix "Show build.rs stderr" step.
Sep 5, 2020
a7a20fe
Add artifact upload step.
Sep 5, 2020
9acb8a3
style(clippy): use write_all in build.rs
Sep 5, 2020
186c982
Merge branch 'windows' into actions
Sep 5, 2020
b3afa3d
Fix path in upload binary step
Sep 5, 2020
77704d2
style(clippy): remove unused import added by Intellij
Sep 5, 2020
0d854c6
Merge branch 'windows' into actions
Sep 5, 2020
921bbc6
Separate upload artifacts actions for Windows.
Sep 5, 2020
6b0253a
Troubleshooting windows artifacts upload.
Sep 5, 2020
fb33bc8
Fix typo
Sep 5, 2020
5f969c4
Bump upload-artifact to v2.
Sep 5, 2020
4d3c1dd
fix(review): change branch name to main, remove nightly
Sep 8, 2020
c44c704
feat(infra): test builds on nightly rust
Sep 8, 2020
f3ccab6
fix(infra): remove debug logs from ci action
Sep 8, 2020
670304a
feat(infra): release github action
Sep 8, 2020
1df5f08
Merge remote-tracking branch 'upstream/main' into actions
Sep 11, 2020
7203331
fix: merge issues
Sep 11, 2020
69fe4d1
fix(release): add linux generic
imsnif Sep 13, 2020
82ce838
feat(infra): build musl on release
Sep 13, 2020
e963010
feat(infra): fix release verioning
Sep 13, 2020
3e79868
feat(infra): another try for fixing versioning
Sep 13, 2020
7b9dd5d
fix(infra): use version from version step instead of release id
Sep 13, 2020
adf65b8
fix(infra): fix add macos target variable, use --target for cargo build
Sep 13, 2020
7eac88b
fix(infra): add musl-tools required by musl target
Sep 13, 2020
c4b8cae
fix(infra): fix action
Sep 13, 2020
4ecf85d
fix(infra): fix action
Sep 13, 2020
003294d
fix(build): trigger build-release action when release has been create…
Sep 14, 2020
5436af4
fix(debug): remove actions branch
imsnif Sep 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
83 changes: 83 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: ci
on:
pull_request:
push:
branches:
- main
jobs:
test:
name: test
env:
# Emit backtraces on panics.
RUST_BACKTRACE: 1
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- stable
- macos
- win-msvc
include:
- build: stable
os: ubuntu-18.04
rust: stable
- build: macos
os: macos-latest
rust: stable
- build: win-msvc
os: windows-2019
rust: stable
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: rustfmt, clippy

- name: Check formatting
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Build
run: cargo build --verbose

# This is useful for debugging problems when the expected build artifacts
# (like shell completions and man pages) aren't generated.
- name: Show build.rs stderr
if: matrix.os == 'windows-2019'
shell: bash
run: |
set +x
stderr="$(find "./target/debug" -name stderr -print0 | xargs -0 ls -t | head -n1)"
if [ -s "$stderr" ]; then
echo "===== $stderr ===== "
cat "$stderr"
echo "====="
fi
set -x

- name: Run tests
run: cargo test --verbose

- name: Upload unix binary
if: matrix.os != 'windows-2019'
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.os }}-${{ matrix.rust }}
path: target/debug/bandwhich

- name: Upload windows binary
if: matrix.os == 'windows-2019'
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-${{ matrix.rust }}
path: |
target/debug/bandwhich.exe
target/debug/bandwhich.pdb
62 changes: 62 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: nightly
on:
pull_request:
push:
branches:
- main
- actions
jobs:
test:
name: test
env:
# Emit backtraces on panics.
RUST_BACKTRACE: 1
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- ubuntu
- macos
- win-msvc
include:
- build: ubuntu
os: ubuntu-18.04
rust: nightly
- build: macos
os: macos-latest
rust: nightly
- build: win-msvc
os: windows-2019
rust: nightly
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true

- name: Build
run: cargo build --verbose

# This is useful for debugging problems when the expected build artifacts
# (like shell completions and man pages) aren't generated.
- name: Show build.rs stderr
if: matrix.os == 'windows-2019'
shell: bash
run: |
set +x
stderr="$(find "./target/debug" -name stderr -print0 | xargs -0 ls -t | head -n1)"
if [ -s "$stderr" ]; then
echo "===== $stderr ===== "
cat "$stderr"
echo "====="
fi
set -x

- name: Run tests
run: cargo test --verbose

109 changes: 109 additions & 0 deletions .github/workflows/release.yaml
Original 8000 file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# The way this works is the following:
#
# - create-release job runs purely to initialize the GitHub release itself
# and to output upload_url for the following job.
#
# - build-release job runs only once create-release is finished. It gets
# the release upload URL from create-release job outputs, then builds
# the release executables for each supported platform and attaches them
# as release assets to the previously created release.
#
# The key here is that we create the release only once.
#
# Reference:
# - https://eugene-babichenko.github.io/blog/2020/05/09/github-actions-cross-platform-auto-releases/

name: release
on:
release:
types:
- created

jobs:
build-release:
name: build-release
runs-on: ${{ matrix.os }}
env:
# Emit backtraces on panics.
RUST_BACKTRACE: 1
strategy:
matrix:
build:
- linux glib x64
- linux musl x64
- macos x64
- win-msvc x64
include:
- build: linux glib x64
os: ubuntu-18.04
rust: stable
target: x86_64-unknown-linux-gnu
- build: linux musl x64
os: ubuntu-18.04
rust: stable
target: x86_64-unknown-linux-musl
- build: macos x64
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: win-msvc x64
os: windows-2019
rust: stable
target: x86_64-pc-windows-msvc

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}

- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get install -y --no-install-recommends musl-tools

- name: Build release binary
run: cargo build --verbose --release --target ${{ matrix.target }}

- name: Strip release binary (unix)
if: matrix.os != 'windows-2019'
run: strip "target/${{ matrix.target }}/release/bandwhich"

- name: Tar release (unix)
if: matrix.os != 'windows-2019'
working-directory: ./target/${{ matrix.target }}/release
run: tar cvfz bandwhich-v${{ github.event.release.tag_name }}-${{matrix.target}}.tar.gz "bandwhich"

- name: Zip Windows release
if: matrix.os == 'windows-2019'
working-directory: ./target/${{ matrix.target }}/release
run: tar.exe -a -c -f bandwhich-v${{ github.event.release.tag_name }}-${{matrix.target}}.zip "bandwhich.exe"

- name: Upload release archive (linux)
if: matrix.os != 'windows-2019'
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./target/${{ matrix.target }}/release/bandwhich-v${{ github.event.release.tag_name }}-${{matrix.target}}.tar.gz
asset_name: bandwhich-v${{ github.event.release.tag_name }}-${{matrix.target}}.tar.gz
asset_content_type: application/octet-stream

- name: Upload Windows release archive
if: matrix.os == 'windows-2019'
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./target/${{ matrix.target }}/release/bandwhich-v${{ github.event.release.tag_name }}-${{matrix.target}}.zip
asset_name: bandwhich-v${{ github.event.release.tag_name }}-${{matrix.target}}.zip
asset_content_type: application/octet-stream
0