Automated Code Change #174
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
name: generator-tool | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: debian:10.13 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
key: debian-10.13-clang16 | |
path: | | |
${{github.workspace}}/build/_deps | |
- name: Install build tools | |
run: | | |
apt-get update | |
env DEBIAN_FRONTEND=noninteractive \ | |
apt-get install -qy --no-install-recommends \ | |
build-essential \ | |
ca-certificates \ | |
cmake \ | |
file \ | |
git \ | |
gnupg \ | |
libc6-dev \ | |
lsb-release \ | |
make \ | |
ninja-build \ | |
software-properties-common \ | |
wget | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
./llvm.sh 16 all | |
- name: Configure CMake | |
run: | | |
mkdir -p "$GITHUB_WORKSPACE/build" | |
cmake \ | |
-S "$GITHUB_WORKSPACE" \ | |
-B "$GITHUB_WORKSPACE/build" \ | |
-G Ninja \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DSAPI_ENABLE_CLANG_TOOL=ON \ | |
-DSAPI_ENABLE_CLANG_TOOL_STATIC=ON | |
- name: Build | |
run: | | |
cmake \ | |
--build "$GITHUB_WORKSPACE/build" \ | |
--config Release \ | |
--target sapi_generator_tool | |
( \ | |
cd "$GITHUB_WORKSPACE/build"; \ | |
mv sandboxed_api/tools/clang_generator/sapi_generator_tool \ | |
sapi_generator_tool-linux-x86_64; \ | |
) | |
- name: Upload Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: sapi_generator_tool-linux | |
path: ${{github.workspace}}/build/sapi_generator_tool-linux-x86_64 | |
prerelease: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
ARTIFACT_NAME: sapi_generator_tool-linux | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare environment | |
run: mkdir -p "$GITHUB_WORKSPACE/build" | |
- name: Download Build Artifact | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
let artifactName = process.env.ARTIFACT_NAME; | |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: context.payload.workflow_run.id, | |
}); | |
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == artifactName | |
})[0]; | |
let download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
let fs = require('fs'); | |
fs.writeFileSync( | |
`${process.env.GITHUB_WORKSPACE}/build/${artifactName}.zip`, | |
Buffer.from(download.data) | |
); | |
- name: "Repackage as *-<arch>.tar.gz" | |
run: | | |
( \ | |
cd "$GITHUB_WORKSPACE/build"; \ | |
unzip "${ARTIFACT_NAME}.zip"; \ | |
tar czf sapi_generator_tool-linux-x86_64.tar.gz \ | |
sapi_generator_tool-linux-x86_64 | |
) | |
- name: Create Pre-release | |
uses: marvinpinto/[email protected] | |
with: | |
repo_token: "${{secrets.GITHUB_TOKEN}}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
files: | | |
${{github.workspace}}/build/sapi_generator_tool-linux-x86_64.tar.gz | |