Update GitHub Actions Third-Party Action Versions (#431) #12
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: develop | |
on: | |
push: | |
branches: [develop] | |
jobs: | |
docker-build: | |
strategy: | |
matrix: | |
include: | |
- ubuntu-codename: focal | |
build_lanelet_aware: true | |
- ubuntu-codename: jammy | |
build_lanelet_aware: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker Build Streets Service Base | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
build-args: | | |
UBUNTU_CODENAME=${{ matrix.ubuntu-codename }} | |
tags: usdotfhwastoldev/streets_service_base:${{ matrix.ubuntu-codename }} | |
file: ./streets_service_base/Dockerfile | |
- name: Docker Build Streets Service Base Lanelet Aware | |
if: ${{ matrix.build_lanelet_aware }} | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: usdotfhwastoldev/streets_service_base_lanelet_aware:${{ matrix.ubuntu-codename }} | |
file: ./streets_service_base_lanelet_aware/Dockerfile | |
build: | |
needs: docker-build | |
defaults: | |
run: | |
shell: bash | |
runs-on: ubuntu-latest-8-cores | |
container: | |
image: usdotfhwastoldev/streets_service_base_lanelet_aware:focal | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
SONAR_SCANNER_VERSION: "5.0.1.3006" | |
TERM: xterm | |
options: "--user root" | |
steps: | |
- name: Checkout ${{ github.event.repository.name }} | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.event.repository.name }} | |
fetch-depth: 0 | |
- name: Move source code | |
run: mv $GITHUB_WORKSPACE/${{ github.event.repository.name }} /home/carma-streets | |
- name: Install dependencies | |
run: | | |
cd /home/carma-streets/build_scripts | |
./install_test_dependencies.sh | |
mkdir -p /home/carma-streets/ext | |
./install_rest_server_dependencies.sh | |
- name: Install net-snmp | |
run: | | |
cd /home/carma-streets/ext/ | |
apt-get install -y libperl-dev curl | |
curl -k -L -O http://sourceforge.net/projects/net-snmp/files/net-snmp/5.9.1/net-snmp-5.9.1.tar.gz | |
tar -xvzf /home/carma-streets/ext/net-snmp-5.9.1.tar.gz | |
cd net-snmp-5.9.1/ | |
./configure --with-default-snmp-version="1" --with-sys-contact="@@no.where" --with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp" | |
make -j | |
make install | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 # The setup-java action provides the functionality for GitHub Actions runners for Downloading and setting up a requested version of Java | |
with: | |
java-version: 17 | |
distribution: "temurin" | |
- name: Install Sonar | |
run: | | |
SONAR_DIR=/opt/sonarqube | |
mkdir $SONAR_DIR | |
curl -o $SONAR_DIR/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip | |
curl -o $SONAR_DIR/build-wrapper.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip | |
curl -sL https://deb.nodesource.com/setup_16.x | bash - | |
apt-get install -y nodejs unzip | |
# Set the JAVA_HOME to a compatible version of Java, e.g., Java 17 | |
export JAVA_HOME=$GITHUB_WORKSPACE/java-17 | |
cd $SONAR_DIR | |
for ZIP in *.zip; do | |
unzip "$ZIP" -d . | |
rm "$ZIP" | |
done | |
mv $(ls $SONAR_DIR | grep "sonar-scanner-") $SONAR_DIR/sonar-scanner/ | |
mv $(ls $SONAR_DIR | grep "build-wrapper-") $SONAR_DIR/build-wrapper/ | |
echo $SONAR_DIR/sonar-scanner/bin >> $GITHUB_PATH | |
echo $SONAR_DIR/build-wrapper >> $GITHUB_PATH | |
env: | |
JAVA_HOME: $GITHUB_WORKSPACE/java-17 | |
- name: Check Java Version | |
run: | | |
java -version | |
echo $JAVA_HOME | |
- name: Build | |
run: | | |
cd /home/carma-streets/ | |
build-wrapper-linux-x86-64 --out-dir /home/carma-streets/bw-output ./build.sh | |
- name: Tests | |
run: | | |
cd /home/carma-streets/ | |
ldconfig | |
./coverage.sh | |
- name: Archive test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test Results | |
path: /home/carma-streets/test_results | |
- name: Run SonarScanner | |
uses: usdot-fhwa-stol/actions/sonar-scanner@main | |
with: | |
sonar-token: ${{ secrets.SONAR_TOKEN }} | |
working-dir: /home/carma-streets |