-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Introduce CI/CD. Thanks @oxc for your contribution.
This commit is a combination of 6 commits. chore: typo fix, update docs, make output coherent fix: quote PAM_WSL_HELLO_WINPATH to allow spaces chore: increase version, 1.2.0 was already released build: make builds reproducable Check-in Cargo.lock to make sure builds always use the same dependency versions. perf: decrease pam module binary size Enable cargo Link Time Optimization, and strip debug symbols from the binary build: build with github actions Requires a little refactoring of Makefiles, so we can build linux and windows binaries on different machines.
- Loading branch information
1 parent
a7e9a1b
commit 097e7b8
Showing
8 changed files
with
391 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: Rust | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build-pam-module: | ||
name: 'Build PAM module' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
default: true | ||
override: true | ||
|
||
- name: Enable Rust cache | ||
uses: Swatinem/rust-cache@v1 | ||
|
||
- name: Install libpam | ||
run: sudo apt-get install libpam0g-dev | ||
|
||
- name: Build | ||
run: make clean build/pam_wsl_hello.so | ||
|
||
- uses: actions/upload-artifact@v2 | ||
name: Upload artifact | ||
with: | ||
name: 'PAM module' | ||
path: build/pam_wsl_hello.so | ||
if-no-files-found: error | ||
|
||
build-windows-binaries: | ||
name: 'Build Windows binaries' | ||
|
||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Add msbuild to PATH | ||
uses: microsoft/[email protected] | ||
|
||
- name: Build | ||
run: make clean all | ||
working-directory: win_components | ||
|
||
- uses: actions/upload-artifact@v2 | ||
name: Upload artifacts | ||
with: | ||
name: 'Windows Binaries' | ||
path: win_components/build/ | ||
if-no-files-found: error | ||
|
||
release: | ||
name: 'Release' | ||
|
||
if: ${{ github.event_name == 'push' }} | ||
|
||
runs-on: ubuntu-latest | ||
|
||
needs: [build-pam-module, build-windows-binaries] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: 'Windows Binaries' | ||
path: build | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: 'PAM module' | ||
path: build | ||
|
||
- name: Conventional Changelog Action | ||
id: changelog | ||
uses: TriPSs/conventional-changelog-action@v3 | ||
with: | ||
github-token: ${{ secrets.github_token }} | ||
version-file: Cargo.toml | ||
version-path: package.version | ||
skip-on-empty: false | ||
git-user-name: 'github-actions[bot]' | ||
git-user-email: '41898282+github-actions[bot]@users.noreply.github.com' | ||
|
||
- name: Create Release asset | ||
id: create_asset | ||
env: | ||
release_name: WSL-Hello-sudo-${{ steps.changelog.outputs.tag }} | ||
run: | | ||
make -d release RELEASE="$release_name" | ||
echo "::set-output name=release_asset::$release_name.tar.gz" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.github_token }} | ||
with: | ||
tag_name: ${{ steps.changelog.outputs.tag }} | ||
release_name: ${{ steps.changelog.outputs.tag }} | ||
body: ${{ steps.changelog.outputs.clean_changelog }} | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ steps.create_asset.outputs.release_asset }} | ||
asset_name: ${{ steps.create_asset.outputs.release_asset }} | ||
asset_content_type: application/gzip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
target/ | ||
**/*.rs.bk | ||
Cargo.lock | ||
|
||
build/ | ||
uninstall.sh |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "wsl_hello_pam" | ||
version = "1.1.0" | ||
version = "1.2.0" | ||
authors = ["Takaya Saeki <[email protected]>"] | ||
|
||
[lib] | ||
|
@@ -12,3 +12,6 @@ libc = "0.2.0" | |
openssl = "0.10.29" | ||
toml = "0.4" | ||
uuid = { version = "0.5", features = ["v4"] } | ||
|
||
[profile.release] | ||
lto = true |
Oops, something went wrong.