build:tweak #227
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" ] | |
env: | |
DATETIME: $(TZ='Asia/Tokyo' date '+%Y-%m-%d-%H-%M-%S') | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
IMAGE_AUTOMATION_TEST: automation-test | |
IMAGE_PHP: php-latest | |
IMAGE_REDIS: redis-latest | |
IMAGE_UBUNTU: ubuntu-latest | |
DOCKERFILE_PHP: ./php/latest.Dockerfile | |
DOCKERFILE_REDIS: ./database/redis/latest.Dockerfile | |
DOCKERFILE_UBUNTU: ./ubuntu/latest.Dockerfile | |
jobs: | |
# job inspect-code | |
inspect-code: | |
name: '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 | |
# job manual, workflow manual | |
manual: | |
name: 'Manual' | |
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 | |
# job automation, workflow automation | |
automation: | |
name: 'Automation' | |
runs-on: ubuntu-latest | |
environment: CI | |
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;pwd;whoami; | |
- name: Set up date and time variable | |
run: | | |
echo "DATE_TIME=$(TZ='Asia/Tokyo' date '+%Y-%m-%d-%H-%M-%S')" >> $GITHUB_ENV | |
- name: Output date and time | |
run: | | |
echo "GLOBAL ENV DATETIME: ${{ env.DATETIME }}" | |
echo "LOCAL ENV DATE_TIME: ${{ env.DATE_TIME }}" | |
echo "type=raw,enable=true,value=${{ env.IMAGE_AUTOMATION_TEST }}-${{ env.DATETIME }}" | |
- name: Log in to Docker Hub # https://github.com/docker/login-action | |
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Log in to the Container registry # https://github.com/docker/login-action | |
# uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action | |
id: meta | |
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 # using hash | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,enable=true,value=${{ env.IMAGE_AUTOMATION_TEST }}-${{ env.DATETIME }} | |
type=ref,enable=true,priority=600,prefix=${{ env.IMAGE_AUTOMATION_TEST }}-,event=branch | |
type=ref,enable=true,priority=600,prefix=${{ env.IMAGE_AUTOMATION_TEST }}-,event=pr | |
type=schedule,enable=true,pattern={{date 'YYYYMMDD-hhmmss' tz='Asia/Tokyo'}} | |
type=semver,enable=true,pattern={{raw}} # TODO release only | |
type=sha,enable=true | |
# OS | |
# Ubuntu - manual build and test | |
# job build ubuntu latest manual | |
build-ubuntu-latest-manual: | |
name: '[Manual] Build Ubuntu latest' | |
needs: manual | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Output date and time | |
run: | | |
ls -all;pwd;whoami; | |
echo "Date and Time: ${{ env.DATETIME }}" | |
- name: Test build | |
run: | | |
#docker login --username ${{ github.actor }} --password ${{ secrets.GITHUB_PAT }} ghcr.io | |
docker login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
docker build . --file ${{ env.DOCKERFILE_UBUNTU }} --tag "lecaoquochung/docker-images:ubuntu-latest-${{ env.DATETIME }}" | |
docker images | |
# docker tag "lecaoquochung/docker-images:ubuntu-latest-${{ env.DATETIME }}" "ghcr.io/lecaoquochung/docker-images:ubuntu-latest-${{ env.DATETIME }}" | |
# docker push "lecaoquochung/docker-images:ubuntu-latest-${{ env.DATETIME }}" | |
- 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 login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
docker build . --file ./ubuntu/latest.Dockerfile --tag "ghcr.io/lecaoquochung/docker-images:ubuntu-latest-${{ env.DATETIME }}" | |
docker images | |
# docker push ubuntu-latest:${{ env.DATETIME }} | |
# docker push ghcr.io/lecaoquochung/ubuntu-latest:${{ env.DATETIME }} | |
# Ubuntu - automation build and push | |
build-ubuntu-latest: | |
name: '[Auto] Build Ubuntu latest' | |
needs: automation | |
runs-on: ubuntu-latest | |
environment: CI | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub # https://github.com/docker/login-action | |
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Log in to the Container registry # https://github.com/docker/login-action | |
# uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action | |
id: meta | |
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 # using hash | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,enable=true,value=${{ env.IMAGE_UBUNTU }}-${{ env.DATETIME }} | |
type=ref,enable=true,priority=600,prefix=${{ env.IMAGE_UBUNTU }}-,event=branch | |
type=ref,enable=true,priority=600,prefix=${{ env.IMAGE_UBUNTU }}-,event=pr | |
# type=schedule,pattern={{date 'YYYYMMDD-hhmmss' tz='Asia/Tokyo'}} | |
# type=semver,pattern={{raw}} # TODO release only | |
# type=sha # TODO release only | |
- name: Build and push Docker images # https://github.com/docker/build-push-action | |
id: push | |
# uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ${{ env.DOCKERFILE_UBUNTU }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true | |
# MacOS | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md | |
build-macos-latest-manual: | |
name: '[Manual] Build MacOS latest' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build Windows latest' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build Ubuntu QA' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build Ubuntu Noble' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build QA Scala' | |
needs: manual | |
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 | |
# job build php latest manual | |
build-php-latest-manual: | |
name: '[Manual] Build PHP latest' | |
needs: manual | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: php-fpm | |
run: docker build . --file ${{ env.DOCKERFILE_PHP }} --tag "php:$(date +%s)" | |
# job build php latest automation | |
build-php-latest: | |
name: '[Auto] Build PHP latest' | |
needs: automation | |
runs-on: ubuntu-latest | |
environment: CI | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,enable=true,value=${{ env.IMAGE_PHP }}-${{ env.DATETIME }} | |
type=ref,enable=true,priority=600,prefix=${{ env.IMAGE_PHP }}-,event=branch | |
type=ref,enable=true,priority=600,prefix=${{ env.IMAGE_PHP }}-,event=pr | |
- name: Build and push Docker images | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ${{ env.DOCKERFILE_PHP }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true | |
build-php-beta-manual: | |
name: '[Manual] Build PHP beta' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build Scala latest' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build Scala bionic' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build Scala maintenance' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build Jenkins latest' | |
needs: manual | |
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-manual: | |
name: '[Manual] Build Puppeteer latest' | |
needs: manual | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: puppeteer-latest | |
run: docker build . --file ./puppeteer/latest.Dockerfile --tag "puppeteer-latest:$(date +%s)" | |
# REDIS | |
# Build latest REDIS version | |
# job build redis latest manual | |
build-redis-latest-manual: | |
name: '[Manual] Build Redis latest' | |
needs: manual | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: redis-latest | |
run: docker build . --file ${{ env.DOCKERFILE_REDIS }} --tag "redis-latest:$(date +%s)" | |
# job build redis latest automation | |
build-redis-latest: | |
name: '[Auto] Build Redis latest' | |
needs: automation | |
runs-on: ubuntu-latest | |
environment: CI | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,enable=true,value=${{ env.IMAGE_REDIS }}-${{ env.DATETIME }} | |
type=ref,enable=true,priority=600,prefix=${{ env.IMAGE_REDIS }}-,event=branch | |
type=ref,enable=true,priority=600,prefix=${{ env.IMAGE_REDIS }}-,event=pr | |
- name: Build and push Docker images | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ${{ env.DOCKERFILE_REDIS }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true | |
# 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: | |
name: '[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: | |
name: '[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: | |
name: '[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: | |
name: '[Test] Redash Setup MacOS' | |
needs: build-macos-latest-manual | |
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: | |
name: '[Test] Redash Docker' | |
needs: build-windows-latest-manual | |
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 | |
# job test scala coding | |
test-scala-coding: | |
name: '[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 |