use advanced ci.yaml
Some checks failed
Java CI / build (push) Failing after 35s

This commit is contained in:
fly6516 2024-12-20 14:34:45 +08:00
parent dc37e7e56e
commit f6e40462c2
2 changed files with 168 additions and 66 deletions

View File

@ -11,74 +11,74 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# container: container:
# image: dockerp.com/openjdk:17-jdk-slim # 使用带有 JDK 17 的 Docker 镜像 image: fly6516.synology.me:8080/multilang:slim # 使用带有 JDK 17 的 Docker 镜像
steps: steps:
- name: Check Version #Docker # - name: Check Version #Docker
run: | # run: |
cat /proc/version # cat /proc/version
#
# - name: Install curl # # - name: Install curl
# run: | # # run: |
# apt-get update # # apt-get update
# apt-get install -y curl # # apt-get install -y curl
#
- name: Change Download URL to NJU Mirror # - name: Change Download URL to NJU Mirror
run: | # run: |
# 替换为 NJU 的 APT 源 # # 替换为 NJU 的 APT 源
sed -i 's/archive.ubuntu.com/mirrors.nju.edu.cn/g' /etc/apt/sources.list # sed -i 's/archive.ubuntu.com/mirrors.nju.edu.cn/g' /etc/apt/sources.list
# echo "deb https://mirror.nju.edu.cn/ubuntu/ noble main restricted universe multiverse" > /etc/apt/sources.list.d/ubuntu.sources # # echo "deb https://mirror.nju.edu.cn/ubuntu/ noble main restricted universe multiverse" > /etc/apt/sources.list.d/ubuntu.sources
# echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-updates main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources # # echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-updates main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources
# echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-backports main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources # # echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-backports main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources
# echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-security main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources # # echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-security main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources
#
# - name: Add missing GPG keys for NJU mirror # # - name: Add missing GPG keys for NJU mirror
# run: | # # run: |
# # 添加公钥 3B4FE6ACC0B21F32 # # # 添加公钥 3B4FE6ACC0B21F32
# curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3B4FE6ACC0B21F32 | tee /etc/apt/trusted.gpg.d/nju-archive-key.asc # # curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3B4FE6ACC0B21F32 | tee /etc/apt/trusted.gpg.d/nju-archive-key.asc
# # #
# # 添加公钥 871920D1991BC93C # # # 添加公钥 871920D1991BC93C
# curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C | tee /etc/apt/trusted.gpg.d/nju-archive-key.asc # # curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C | tee /etc/apt/trusted.gpg.d/nju-archive-key.asc
# # #
# - name: Install gnupg # # - name: Install gnupg
# run: | # # run: |
# apt-get update --allow-unauthenticated --ignore-missing # # apt-get update --allow-unauthenticated --ignore-missing
# apt-get install --allow-unauthenticated -y gnupg # # apt-get install --allow-unauthenticated -y gnupg
#
# - name: Add missing GPG keys for NJU mirror # # - name: Add missing GPG keys for NJU mirror
# run: | # # run: |
# # 导入公钥 3B4FE6ACC0B21F32 # # # 导入公钥 3B4FE6ACC0B21F32
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 # # apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
# # #
# # 导入公钥 871920D1991BC93C # # # 导入公钥 871920D1991BC93C
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C # # apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C
#
# - name: Disable APT signature verification # # - name: Disable APT signature verification
# run: | # # run: |
# echo "Acquire::https::mirror.nju.edu.cn::Verify-Peer false;" | tee /etc/apt/apt.conf.d/99disable-verify # # echo "Acquire::https::mirror.nju.edu.cn::Verify-Peer false;" | tee /etc/apt/apt.conf.d/99disable-verify
# echo "Acquire::https::mirror.nju.edu.cn::Verify-Host false;" | tee -a /etc/apt/apt.conf.d/99disable-verify # # echo "Acquire::https::mirror.nju.edu.cn::Verify-Host false;" | tee -a /etc/apt/apt.conf.d/99disable-verify
#
- name: Apt Update # - name: Apt Update
run: | # run: |
apt update # apt update
#
- name: Install Node.js # - name: Install Node.js
run: | # run: |
# 更新 apt 包管理器并安装必要的工具 # # 更新 apt 包管理器并安装必要的工具
apt-get install -y curl gnupg2 lsb-release ca-certificates --allow-unauthenticated # apt-get install -y curl gnupg2 lsb-release ca-certificates --allow-unauthenticated
#
# 安装 Node.js 20.x # # 安装 Node.js 20.x
#curl -fsSL https://deb.nodesource.com/setup_20.x | bash - # #curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
#apt-get install -y nodejs # #apt-get install -y nodejs
apt-get install -y nodejs npm # apt-get install -y nodejs npm
#
# 验证安装是否成功 # # 验证安装是否成功
node -v # node -v
npm -v # npm -v
- name: Install JDK 21 # - name: Install JDK 21
run: | # run: |
apt-get install -y openjdk-21-jdk # apt-get install -y openjdk-21-jdk
- name: Checkout code - name: Checkout code
uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2 uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2

102
ci.yaml Normal file
View File

@ -0,0 +1,102 @@
name: Java CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
# container:
# image: dockerp.com/openjdk:17-jdk-slim # 使用带有 JDK 17 的 Docker 镜像
steps:
- name: Check Version #Docker
run: |
cat /proc/version
# - name: Install curl
# run: |
# apt-get update
# apt-get install -y curl
- name: Change Download URL to NJU Mirror
run: |
# 替换为 NJU 的 APT 源
sed -i 's/archive.ubuntu.com/mirrors.nju.edu.cn/g' /etc/apt/sources.list
# echo "deb https://mirror.nju.edu.cn/ubuntu/ noble main restricted universe multiverse" > /etc/apt/sources.list.d/ubuntu.sources
# echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-updates main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources
# echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-backports main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources
# echo "deb https://mirror.nju.edu.cn/ubuntu/ noble-security main restricted universe multiverse" >> /etc/apt/sources.list.d/ubuntu.sources
# - name: Add missing GPG keys for NJU mirror
# run: |
# # 添加公钥 3B4FE6ACC0B21F32
# curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3B4FE6ACC0B21F32 | tee /etc/apt/trusted.gpg.d/nju-archive-key.asc
#
# # 添加公钥 871920D1991BC93C
# curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C | tee /etc/apt/trusted.gpg.d/nju-archive-key.asc
#
# - name: Install gnupg
# run: |
# apt-get update --allow-unauthenticated --ignore-missing
# apt-get install --allow-unauthenticated -y gnupg
# - name: Add missing GPG keys for NJU mirror
# run: |
# # 导入公钥 3B4FE6ACC0B21F32
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
#
# # 导入公钥 871920D1991BC93C
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C
# - name: Disable APT signature verification
# run: |
# echo "Acquire::https::mirror.nju.edu.cn::Verify-Peer false;" | tee /etc/apt/apt.conf.d/99disable-verify
# echo "Acquire::https::mirror.nju.edu.cn::Verify-Host false;" | tee -a /etc/apt/apt.conf.d/99disable-verify
- name: Apt Update
run: |
apt update
- name: Install Node.js
run: |
# 更新 apt 包管理器并安装必要的工具
apt-get install -y curl gnupg2 lsb-release ca-certificates --allow-unauthenticated
# 安装 Node.js 20.x
#curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
#apt-get install -y nodejs
apt-get install -y nodejs npm
# 验证安装是否成功
node -v
npm -v
- name: Install JDK 21
run: |
apt-get install -y openjdk-21-jdk
- name: Checkout code
uses: http://fly6516.synology.me:4000/Gitea_Action/checkout@v2
- name: Compile Java program
run: |
mkdir -p ./build/classes
javac HelloWorld.java -d ./build/classes
- name: List compiled files
run: ls -la ./build/classes
- name: Upload artifact
uses: http://fly6516.synology.me:4000/Gitea_Action/upload-artifact@v3
with:
name: java-classes
path: ./build/classes
- name: Run Java program
run: |
java -cp ./build/classes HelloWorld