Build ubuntu qa #175
Workflow file for this run
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 | |
on: | |
push: | |
branches: [ "ci", "dev", "build*" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
inspect-code: | |
name: '[Required] Inspect code' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 2 | |
- name: Set up Node.js | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
with: | |
cache: npm | |
node-version-file: '.nvmrc' | |
- name: Install dependencies | |
run: npm ci | |
env: | |
TEST: true | |
- name: Check code | |
run: ls -all | |
# OS | |
# Ubuntu | |
build-ubuntu-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up date and time variable | |
run: echo "DATE_TIME=$(date +%Y-%m-%d_%H-%M-%S)" >> $GITHUB_ENV | |
- name: Output date and time | |
run: | | |
echo "Date and Time: ${{ env.DATE_TIME }}" | |
- name: Test build | |
run: | | |
docker login --username lecaoquochung --password ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
docker build . --tag ghcr.io/lecaqquochung/ubuntu-latest:latest | |
docker push ghcr.io/lecaoquochung/ubuntu-latest:latest | |
- name: ubuntu-lastest | |
run: | | |
# docker build . --file ./ubuntu/latest.Dockerfile --tag "ubuntu-latest:$(date +%Y-%m-%d_%H:%M:%S)" | |
docker login --username lecaoquochung --password ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
docker build . --file ./ubuntu/latest.Dockerfile --tag "ubuntu-latest:${{ env.DATE_TIME }}" | |
docker push ubuntu-latest:${{ env.DATE_TIME }} | |
# MacOS | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md | |
build-macos-latest: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build-in dependencies | |
working-directory: ./swift | |
run: | | |
env | |
ls -all | |
sw_vers -productName | |
sw_vers -productVersion | |
sw_vers -buildVersion | |
pip list | |
npm --version | |
swift --version | |
swift package init --name HelloWorld --type executable | |
ls -all | |
cat Package.swift | |
cat Sources/main.swift | |
# cat /Tests/HelloWorldTests.swift | |
- name: Build | |
working-directory: ./swift | |
run: swift build -v | |
- name: Run tests | |
working-directory: ./swift | |
run: | | |
ls -all | |
# swift test -v | |
# INFO: https://github.com/lecaoquochung/docker-images/pull/5/files#r1775196802 | |
# Windows | |
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md | |
build-windows-latest: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup Node.js | |
# https://github.com/lecaoquochung/docker-images/pull/5/files#r1775196810 | |
# - name: Setup Node.js | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: '14' # Or your preferred version | |
# Windows build-in dependencies | |
- name: Build-in dependencies | |
shell: pwsh | |
run: | | |
env | |
ls # no -all | |
systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version" | |
systeminfo | |
# Powsershell | |
$env:Path | |
Get-ChildItem | |
Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion, OsBuildNumber | |
Get-Acl | |
Get-Command | |
Get-Package | |
Get-Process | |
# QA | |
# Build Ubuntu for QA | |
build-ubuntu-qa: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ubuntu-qa | |
run: docker build . --file ./ubuntu/qa.Dockerfile --tag "ubuntu-qa:$(date +%s)" | |
build-ubuntu-noble: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ubuntu-noble | |
run: docker build . --file ./ubuntu/noble.Dockerfile --tag "ubuntu-noble:$(date +%s)" | |
build-qa-scala: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: qa-scala | |
run: docker build . --file ./qa/build/scala.Dockerfile --tag "qa-scals:$(date +%s)" | |
# PROGRAMMING LANGUAGE | |
# Build latest PHP version | |
build-php-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: php-fpm | |
run: docker build . --file ./php/latest.Dockerfile --tag "php:$(date +%s)" | |
build-php-beta: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: php-fpm | |
run: docker build . --file ./php/beta.Dockerfile --tag "php:$(date +%s)" | |
# Build latest SCALA version | |
build-scala-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: scala-latest | |
run: docker build . --file ./scala/build/latest.Dockerfile --tag "scala-latest:$(date +%s)" | |
build-scala-bionic: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: scala-bionic | |
run: docker build . --file ./scala/build/bionic.Dockerfile --tag "scala-bionic:$(date +%s)" | |
# Deprecated - v2024.4.1 | |
# build-scala-mantic: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: scala-mantic | |
# run: docker build . --file ./scala/build/mantic.Dockerfile --tag "scala-mantic:$(date +%s)" | |
# Build maintenance SCALA version | |
build-scala-maintenance: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: scala-maintenance | |
run: docker build . --file ./scala/build/maintenance.Dockerfile --tag "scala-maintenance:$(date +%s)" | |
# APPLICATIONS | |
# Build latest JENKINS version | |
build-jenkins-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: jenkins-latest | |
run: docker build . --file ./jenkins/latest.Dockerfile --tag "jenkins-latest:$(date +%s)" | |
# PUPPETEER | |
# Build latest PUPPETEER version | |
build-puppeteer-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: puppeteer-latest | |
run: docker build . --file ./puppeteer/latest.Dockerfile --tag "puppeteer-latest:$(date +%s)" | |
# TEST | |
# API TEST WITH POSTMAN | |
# MacOS: curl -sL https://dl-cli.pstmn.io/install/osx_64.sh | bash | |
# https://cloudy-shadow-800513.postman.co/workspace/lecaoquochung~885e6b40-0422-488c-8ab6-2f85ee3179ca/api/1512548b-2196-422a-8a3c-b8d374f227f9?action=share&creator=15804725&active-environment=15804725-addaf00d-1d92-4909-9256-0fa91ac840ac | |
test-postman: | |
needs: build-ubuntu-latest | |
runs-on: ubuntu-latest | |
environment: CI | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ENV | |
run: | | |
env | |
- name: Environment variables | |
run: | | |
echo "Github environment indirect : " "$CONTACT_VAR" | |
echo "Github environment direct : " ${{ vars.CONTACT }} | |
env: | |
CONTACT_VAR: ${{ vars.CONTACT }} | |
- name: Install Postman CLI | |
run: | | |
curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh | |
- name: Login to Postman CLI | |
run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }} | |
- name: Run API tests - Postman | |
run: | | |
postman collection run "15804725-1deca745-1604-4657-9f7e-353bdf2adac7" -e "15804725-addaf00d-1d92-4909-9256-0fa91ac840ac" --integration-id "168584-${{ github.run_id }}" | |
# API TEST WITH NEWMAN | |
# https://github.com/lecaoquochung/docker-images/issues/21 | |
# Test Commit | |
# Config update | |
test-newman: | |
needs: build-ubuntu-latest | |
runs-on: ubuntu-latest | |
environment: CI | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ENV | |
run: | | |
env | |
- name: Environment variables | |
run: | | |
echo "Github environment indirect : $CONTACT_VAR" | |
echo "Github environment direct : " ${{ vars.CONTACT }} | |
env: | |
CONTACT_VAR: ${{ vars.CONTACT }} | |
- name: Install Newman CLI | |
run: | | |
npm install -g newman | |
npm update -g newman | |
newman --version | |
- name: Run API tests - Newman - Collection Cloud (Shared JSON) | |
run: | | |
newman run https://api.postman.com/collections/15804725-2460c2a8-98d1-434d-9412-c7a0ab130f8e?access_key=${{ vars.POSTMAN_ACCESS_KEY_ME }} -e ./postman/SAMPLE.postman_environment.json | |
- name: Run API tests - Newman - Collection JSON (Export) | |
run: | | |
newman run ./postman/ME.postman_collection.json -e ./postman/SAMPLE.postman_environment.json | |
# REDASH SETUP | |
test-redash-setup: | |
needs: build-ubuntu-latest | |
runs-on: ubuntu-latest | |
environment: CI | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ENV | |
run: | | |
env | |
- name: Environment variables | |
run: | | |
echo "Github environment indirect : $CONTACT_VAR" | |
echo "Github environment direct : " ${{ vars.CONTACT }} | |
env: | |
CONTACT_VAR: ${{ vars.CONTACT }} | |
- name: Checkout Redash setup | |
uses: actions/checkout@master | |
with: | |
repository: getredash/setup | |
- name: Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install -y pwgen | |
pwgen 32 1 | |
- name: Run setup.sh script | |
run: | | |
ls -all | |
# cd setup | |
sudo ./setup.sh startup | |
sudo ./setup.sh | |
# REDASH SETUP MACOS | |
test-redash-setup-macos: | |
needs: build-macos-latest | |
runs-on: macos-latest | |
environment: CI | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ENV | |
run: | | |
env | |
- name: Environment variables | |
run: | | |
echo "Github environment indirect : $CONTACT_VAR" | |
echo "Github environment direct : " ${{ vars.CONTACT }} | |
env: | |
CONTACT_VAR: ${{ vars.CONTACT }} | |
- name: Checkout Redash setup | |
uses: actions/checkout@master | |
with: | |
repository: getredash/setup | |
- name: Dependencies (*For Testing purpose only) | |
run: | | |
# Homebrew is pre-installed on GitHub-hosted macOS runners | |
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install pwgen | |
pwgen 32 1 | |
- name: Run setup.sh script | |
run: | | |
ls -all | |
chmod +x ./setup.sh | |
./setup.sh startup || { echo "Redash startup failed"; exit 1; } | |
./setup.sh || { echo "Redash setup failed"; exit 1; } | |
# TEST REDASH DOCKER | |
test-redash-docker: | |
needs: build-windows-latest | |
runs-on: windows-latest | |
environment: CI | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ENV | |
run: | | |
env | |
- name: Environment variables | |
run: | | |
echo "Github environment indirect : $CONTACT_VAR" | |
echo "Github environment direct : " ${{ vars.CONTACT }} | |
env: | |
CONTACT_VAR: ${{ vars.CONTACT }} | |
- name: Run docker-compose up | |
working-directory: ./redash | |
run: | | |
cp env .env | |
docker --version | |
docker compose --version | |
docker compose up -d | |
docker compose ps | |
docker compose logs | |
docker compose down | |
# Install docker-compose | |
# https://docs.docker.com/compose/install/standalone/#on-windows-server | |
# [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
# Start-BitsTransfer -Source "https://github.com/docker/compose/releases/download/v2.29.6/docker-compose-windows-x86_64.exe" -Destination $Env:ProgramFiles\Docker\docker-compose.exe | |
# docker-compose --version | |
# Docker Compose alternative | |
# https://docs.docker.com/compose/gettingstarted/ | |
- name: Test Redash | |
working-directory: ./redash | |
run: | | |
# Init | |
docker compose run --rm redash-server create_db | |
# Should response | |
# [2024-09-29 02:43:15,704][PID:1][INFO][alembic.runtime.migration] Context impl PostgresqlImpl. | |
# [2024-09-29 02:43:15,704][PID:1][INFO][alembic.runtime.migration] Will assume transactional DDL. | |
# [2024-09-29 02:43:16,124][PID:1][INFO][alembic.runtime.migration] Running stamp_revision -> 89bc7873a3e0 | |
# NEED REPORT - Github Action Windows latest runner not supported | |
# no matching manifest for windows/amd64 10.0.20348 in the manifest list entries | |
# https://github.com/lecaoquochung/docker-images/actions/runs/11089568047/job/30810875892#step:6:25 | |
# Start | |
docker compose up -d | |
docker compose ps | |
docker compose logs | |
# should response | |
# docker-images-redash-worker | Starting RQ scheduler... | |
# docker-images-redash-server | [2024-09-29 02:43:27 +0000] [1] [INFO] Starting gunicorn 20.0.4 | |
# docker-images-redash-server | [2024-09-29 02:43:27 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1) | |
# Test | |
# Verify localhost:5500 response by curl | |
# npm install -g wait-on | |
# npx wait-on http://localhost:5500 -t 60000 -l | |
# curl http://localhost:5500 -vd | |
# TEST SCALA CODING | |
test-scala-coding: | |
runs-on: ubuntu-latest | |
environment: CI | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: 'sbt' | |
- name: Install sbt | |
run: | | |
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list | |
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list | |
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x99E82A75642AC823" | sudo apt-key add | |
sudo apt-get update | |
sudo apt-get install sbt | |
- name: Run tests | |
working-directory: ./scala/coding | |
run: | | |
sbt clean coverage test coverageReport | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN}} | |
with: | |
fail_ci_if_error: true |