Merge pull request #1246 from ballerina-platform/addtemp #4021
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: Make test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
test: | |
env: | |
JBAL_VERSION: '2201.7.1' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache brew for LLVM (macOS) | |
id: cache-llvm | |
if: runner.os == 'macOS' | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/Library/Caches/Homebrew/ | |
key: brew-llvm | |
- name: Install LLVM (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
brew install llvm@16 | |
echo "/usr/local/opt/llvm@16/bin" >> $GITHUB_PATH | |
echo "LLVM_SUFFIX=" >> $GITHUB_ENV | |
- name: Install LLVM (linux) | |
if: runner.os == 'Linux' | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - | |
sudo add-apt-repository deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main | |
sudo apt-get update | |
sudo apt-get install -y clang-16 llvm-16 | |
- name: Cache jBallerina | |
id: cache-jbal | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/ballerina-${{ env.JBAL_VERSION }}-*.* | |
key: jbal-${{ env.JBAL_VERSION }}-${{ runner.os }} | |
- name: Download jBallerina deb | |
if: steps.cache-jbal.outputs.cache-hit != 'true' && runner.os == 'Linux' | |
run: | | |
curl -L "https://github.com/ballerina-platform/ballerina-distribution/releases/download/v$JBAL_VERSION/ballerina-$JBAL_VERSION-swan-lake-linux-x64.deb" > $HOME/ballerina-$JBAL_VERSION-swan-lake-linux-x64.deb | |
- name: Install jBallerina deb | |
if: runner.os == 'Linux' | |
run: | | |
sudo dpkg -i $HOME/ballerina-$JBAL_VERSION-swan-lake-linux-x64.deb | |
echo "/usr/lib/ballerina/bin" >> $GITHUB_PATH | |
echo "/usr/lib/ballerina/dependencies/jdk-11.0.18+10-jre/bin/java" >> $GITHUB_PATH | |
- name: Download jBallerina pkg | |
if: steps.cache-jbal.outputs.cache-hit != 'true' && runner.os == 'macOs' | |
run: | | |
curl -L "https://github.com/ballerina-platform/ballerina-distribution/releases/download/v$JBAL_VERSION/ballerina-$JBAL_VERSION-swan-lake-macos-x64.pkg" > $HOME/ballerina-$JBAL_VERSION-swan-lake-macos-x64.pkg | |
- name: Install jBallerina pkg | |
if: runner.os == 'macOs' | |
run: | | |
installer -pkg $HOME/ballerina-$JBAL_VERSION-swan-lake-macos-x64.pkg -target CurrentUserHomeDirectory | |
chmod +x "$HOME/Library/Ballerina/bin/bal" | |
echo "$HOME/Library/Ballerina/bin" >> $GITHUB_PATH | |
echo "JAVA=$HOME/Library/Ballerina/dependencies/jdk-11.0.18+10-jre/bin/java" >> $GITHUB_ENV | |
- name: Test | |
run: | | |
echo "useing clang=`which clang` llvm-as=`which llvm-as` bal=`which bal`" | |
make -j2 test | |
- name: Archive test ouput | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test output | |
path: | | |
test/out | |
test-jni: | |
env: | |
JBAL_VERSION: '2201.7.1' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache jBallerina | |
id: cache-jbal | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/ballerina-${{ env.JBAL_VERSION }}-*.* | |
key: jbal-${{ env.JBAL_VERSION }}-${{ runner.os }} | |
- name: Download jBallerina deb | |
if: steps.cache-jbal.outputs.cache-hit != 'true' && runner.os == 'Linux' | |
run: | | |
curl -L "https://github.com/ballerina-platform/ballerina-distribution/releases/download/v$JBAL_VERSION/ballerina-$JBAL_VERSION-swan-lake-linux-x64.deb" > $HOME/ballerina-$JBAL_VERSION-swan-lake-linux-x64.deb | |
- name: Install jBallerina deb | |
if: runner.os == 'Linux' | |
run: | | |
sudo dpkg -i $HOME/ballerina-$JBAL_VERSION-swan-lake-linux-x64.deb | |
echo "/usr/lib/ballerina/bin" >> $GITHUB_PATH | |
echo "/usr/lib/ballerina/dependencies/jdk-11.0.18+10-jre/bin/java" >> $GITHUB_PATH | |
- name: Cache maven dependencies | |
id: cache-maven | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2/repository | |
key: maven-cache | |
- name: Test JNI | |
run: | | |
cd llvm_jni | |
make test -j 6 |