-
Notifications
You must be signed in to change notification settings - Fork 73
Windows 32/64 Github Action Builds #166
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
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
89477b6
Add windows bazel build github action
yinzara aac6cdf
Refactor window-build to support all cpus
yinzara 678e441
Disable linux and mac OS builds as they continue to function in exist…
yinzara 0b72292
Updates from code review removing setup-protoc dep
yinzara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
name: 'Setup the protoc environment' | ||
description: 'Setup the protoc environment with the right PROTOC and PROTOC_INC environment variables' | ||
runs: | ||
using: 'node16' | ||
main: 'index.js' |
This file contains hidden or 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,22 @@ | ||
const tc = require('@actions/tool-cache'); | ||
const core = require('@actions/core'); | ||
const os = require('os'); | ||
const path = require('path'); | ||
|
||
const versions = tc.findAllVersions('protoc'); | ||
if (versions.length === 0) | ||
throw new Error('Unable to find protoc tool version'); | ||
|
||
const version = versions[0]; | ||
const toolPath = tc.find('protoc', version).replaceAll(path.win32.sep, path.posix.sep); | ||
const protocExec = os.platform() === 'win32' ? 'protoc.exe' : 'protoc'; | ||
|
||
// need to use posix paths | ||
const protocPath = path.posix.join(toolPath, 'bin', protocExec); | ||
const protocIncPath = path.posix.join(toolPath, 'include'); | ||
|
||
console.log("protoc path:", protocPath); | ||
console.log("protoc include path:", protocIncPath); | ||
|
||
core.exportVariable('PROTOC', protocPath); | ||
core.exportVariable('PROTOC_INC', protocIncPath); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,19 @@ | ||
{ | ||
"name": "setup-protoc-env", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"private": true, | ||
"license": "BSD-3-Clause", | ||
"dependencies": { | ||
"@actions/core": "^1.10.0", | ||
"@actions/tool-cache": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^16.18.14" | ||
} | ||
} |
This file contains hidden or 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,66 @@ | ||
name: Windows Build | ||
|
||
on: | ||
push: | ||
tags: [ "*" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: npm | ||
cache-dependency-path: | | ||
package-lock.json | ||
.github/actions/setup-protoc-env/package-lock.json | ||
|
||
- name: Setup Bazelisk | ||
uses: bazelbuild/setup-bazelisk@v2 | ||
|
||
- name: Mount bazel cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: "~/.cache/bazel" | ||
key: bazel | ||
|
||
- name: Install protoc | ||
uses: arduino/setup-protoc@v1 | ||
|
||
- run: npm ci --omit=dev | ||
working-directory: .github/actions/setup-protoc-env | ||
|
||
- name: Setup protoc environment | ||
uses: ./.github/actions/setup-protoc-env | ||
|
||
- run: npm ci | ||
|
||
- run: npm run build | ||
shell: bash | ||
|
||
- name: Package (x64) | ||
run: bazel build --cpu=x64_windows dist_zip | ||
shell: bash | ||
|
||
- name: Copy (x64) | ||
run: | | ||
mkdir out | ||
cp bazel-bin/protobuf-javascript-*.zip out/ | ||
|
||
- name: Package (x86) | ||
run: bazel build --cpu=x64_x86_windows dist_zip | ||
shell: bash | ||
|
||
- name: Copy (x86) | ||
run: | | ||
cp bazel-bin/protobuf-javascript-*.zip out/ | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: "out/*.zip" |
This file contains hidden or 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,5 +1,5 @@ | ||
.idea | ||
/node_modules/ | ||
node_modules | ||
commonjs_out | ||
google/protobuf | ||
bazel-* | ||
|
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can use this for security reasons. Can you do something like this instead?
https://github.com/protocolbuffers/protobuf-javascript/blob/main/.github/workflows/codeql.yml#L61-L68
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. That will probably make it so I can completely skip the custom action but I'll see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now completely removed the arduino/setup-protoc dep and standardized the download of the protoc executable/includes between build.yml and codeql.yml
Should you want to update the version, you can now just copy and paste the top environment variable between the two files easily.
This also simplified the actual codeql.yml config as well into separate steps.