Update upload-artifact to v4 #77
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: CI | |
env: | |
VERSION: 1.2.${{ github.run_number }} | |
LIB_BINARIES_URL: https://github.com/mganss/v8/releases/download/8.6.395.24/lib.7z | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- uses: msys2/setup-msys2@v2 | |
- name: Download libv8 binaries | |
working-directory: ./v8 | |
run: | | |
(New-Object System.Net.WebClient).DownloadFile("${{ env.LIB_BINARIES_URL }}", "lib.7z") | |
7z x lib.7z | |
- name: Build | |
shell: cmd | |
run: | | |
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" | |
md out\build\x64-Release | |
CMake -G Ninja -DVERSION=${{ env.VERSION }} -DCMAKE_BUILD_TYPE=Release -B out\build\x64-Release -S . | |
CMake --build out\build\x64-Release -- -v | |
- name: Test | |
shell: msys2 {0} | |
working-directory: ./test | |
run: ./test.sh | |
- name: Archive external | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pdjs | |
path: | | |
binaries/x64-windows/js.dll | |
build-linux: | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Download libv8 binaries | |
working-directory: ./v8 | |
run: | | |
curl -L -s -o lib.7z ${{ env.LIB_BINARIES_URL }} | |
7zr x lib.7z | |
- name: Build x64-linux | |
run: | | |
sudo apt-get -qy install ninja-build | |
mkdir -p out/build/x64-linux-Release | |
cmake -G Ninja \ | |
-DVERSION=${{ env.VERSION }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-B out/build/x64-linux-Release -S . | |
cmake --build out/build/x64-linux-Release -- -v | |
cd binaries | |
cp x64-linux/* . | |
- name: Build arm64-linux | |
run: | | |
sudo apt-get -qy install g++-aarch64-linux-gnu | |
mkdir -p out/build/arm64-linux-Release | |
cmake -G Ninja \ | |
-DVERSION=${{ env.VERSION }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_TOOLCHAIN_FILE=arm64-linux.cmake \ | |
-B out/build/arm64-linux-Release -S . | |
cmake --build out/build/arm64-linux-Release -- -v | |
cd binaries | |
cp arm64-linux/js.pd_linux ./js.l_arm64 | |
- name: Build arm-linux | |
run: | | |
sudo apt-get -qy install g++-arm-linux-gnueabihf | |
mkdir -p out/build/arm-linux-Release | |
cmake -G Ninja \ | |
-DVERSION=${{ env.VERSION }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_TOOLCHAIN_FILE=arm-linux.cmake \ | |
-B out/build/arm-linux-Release -S . | |
cmake --build out/build/arm-linux-Release -- -v | |
cd binaries | |
cp arm-linux/js.pd_linux ./js.l_arm | |
- name: Test | |
working-directory: ./test | |
run: | | |
chmod +x ./pd/x64-linux/bin/pd | |
bash ./test.sh | |
- name: Archive external | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pdjs | |
path: | | |
binaries/js.* | |
binaries/js-help.* | |
- name: Build for coverage analysis | |
run: | | |
mkdir -p out/build/x64-linux-Debug | |
cmake -G Ninja \ | |
-DVERSION=${{ env.VERSION }} \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DCOVERAGE=ON \ | |
-B out/build/x64-linux-Debug -S . | |
cmake --build out/build/x64-linux-Debug -- -v | |
- name: Generate coverage data | |
working-directory: ./test | |
run: | | |
bash ./test.sh | |
cd ../out/build/x64-linux-Debug/ | |
gcov CMakeFiles/pdjs_project.dir/pdjs/js.cpp.gcno | |
cat js.cpp.gcov | |
- name: Upload coverage data to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./out/build/x64-linux-Debug/js.cpp.gcov | |
fail_ci_if_error: true | |
- name: SonarCloud | |
env: | |
SONAR_VERSION: 4.4.0.2170 | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
curl -L -s -o build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip | |
unzip build-wrapper-linux-x86.zip | |
curl -L -s -o sonar-scanner-cli-linux.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_VERSION }}-linux.zip | |
unzip sonar-scanner-cli-linux.zip | |
export PATH="${PWD}/sonar-scanner-${{ env.SONAR_VERSION }}-linux/bin:${PWD}/build-wrapper-linux-x86:${PATH}" | |
cmake -G Ninja \ | |
-DVERSION=${{ env.VERSION }} \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DCOVERAGE=OFF \ | |
-B out/build/x64-linux-Debug -S . | |
cmake --build out/build/x64-linux-Debug --target clean -- -v | |
build-wrapper-linux-x86-64 --out-dir bw-output cmake --build out/build/x64-linux-Debug -- -v | |
sonar-scanner \ | |
-Dsonar.organization=mganss-github \ | |
-Dsonar.projectKey=mganss_pdjs \ | |
-Dsonar.sources=./pdjs \ | |
-Dsonar.cfamily.build-wrapper-output=bw-output \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.projectVersion=${{ env.VERSION }} \ | |
-Dsonar.cfamily.gcov.reportsPath=out/build/x64-linux-Debug | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Download libv8 binaries | |
working-directory: ./v8 | |
run: | | |
curl -L -s -o lib.7z ${{ env.LIB_BINARIES_URL }} | |
7zr x lib.7z | |
- name: Build x64-macos | |
run: | | |
mkdir -p out/build/x64-macos-Release | |
cmake -DVERSION=${{ env.VERSION }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-B out/build/x64-macos-Release -S . | |
cmake --build out/build/x64-macos-Release -- VERBOSE=1 | |
cd binaries | |
- name: Test | |
working-directory: ./test | |
run: | | |
chmod +x ./pd/x64-macos/bin/pd | |
bash ./test.sh | |
- name: Archive external | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pdjs | |
path: | | |
binaries/x64-macos/js.pd_darwin | |
deken: | |
runs-on: ubuntu-latest | |
needs: [ build-windows, build-linux, build-macos ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install deken | |
run: | | |
mkdir deken | |
curl https://raw.githubusercontent.com/pure-data/deken/master/developer/deken > deken/deken | |
chmod +x deken/deken | |
./deken/deken | |
- name: Download external | |
uses: actions/download-artifact@v4 | |
with: | |
name: pdjs | |
path: deken/pdjs | |
- name: Install GPG key | |
env: | |
GPG_KEY: ${{ secrets.GPG_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
run: | | |
cat <(echo -e "${{ secrets.GPG_KEY }}") | gpg --batch --import | |
gpg --list-secret-keys --keyid-format LONG | |
gpgconf --kill gpg-agent || true | |
gpg-agent --daemon --allow-preset-passphrase --max-cache-ttl 3600 | |
export GPG_KEYGRIP=`gpg --list-secret-keys --with-keygrip | grep "Keygrip" | head -1 | egrep -o '[0-9A-F]{40}$'` | |
/usr/lib/gnupg2/gpg-preset-passphrase -cP ${{ secrets.GPG_PASSPHRASE }} ${GPG_KEYGRIP} | |
- name: Create package | |
working-directory: deken | |
run: | | |
echo "gpg_agent=true" > ~/.deken/config | |
echo -e "js\tExecute JavaScript" > objects.txt | |
./deken package -v ${{ env.VERSION }} --objects objects.txt pdjs | |
- name: Archive deken package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deken | |
path: deken/pdjs*.dek* | |
create-tag: | |
runs-on: ubuntu-latest | |
needs: deken | |
steps: | |
- name: Create tag v${{ env.VERSION }} | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/v${{ env.VERSION }}", | |
sha: context.sha | |
}) |