1
0
mirror of https://github.com/renbaoshuo/s2oj-gcc.git synced 2024-09-18 19:35:21 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
e092407ee9
fix: ci 2023-11-17 06:38:49 +08:00
f13b8e8730
chore: upload dist to artifacts 2023-11-17 06:38:02 +08:00
53cd2cff86
refactor: use github actions to build gcc 2023-11-17 06:30:10 +08:00
5 changed files with 51 additions and 37 deletions

View File

@ -1,24 +0,0 @@
---
kind: pipeline
type: docker
name: Build
trigger:
event:
- push
- custom
steps:
- name: Build & Upload
image: ubuntu:22.04
commands:
- sed -i 's@//.*archive.ubuntu.com@//mirror-cdn.xtom.com@g' /etc/apt/sources.list &&
sed -i 's@//security.ubuntu.com@//mirror-cdn.xtom.com@g' /etc/apt/sources.list
- apt update &&
apt install -y curl flex bzip2 git make gcc g++ libgmp-dev libmpfr-dev libmpc-dev gcc-multilib
- bash build.sh
environment:
GITEA_ENDPOINT: https://git.m.ac
GITEA_USER: baoshuo
GITEA_TOKEN:
from_secret: GITEA_TOKEN

41
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Build & Publish
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt-get update &&
sudo apt-get install -y curl flex bzip2 git make gcc g++ libgmp-dev libmpfr-dev libmpc-dev gcc-multilib
- name: Build
run: bash build.sh
- name: Upload to artifact
uses: actions/upload-artifact@v3
with:
name: s2oj-gcc.zip
path: deb/
- name: Pack
run: dpkg-deb --build deb s2oj-gcc-$(cat GCC_VERSION)~1baoshuo1.deb
- name: Upload
run: |
curl --user "${GITEA_USER}:${GITEA_TOKEN}" \
--upload-file "s2oj-gcc-$(cat GCC_VERSION)~1baoshuo1.deb" \
${GITEA_ENDPOINT}/api/packages/${GITEA_USER}/debian/pool/all/main/upload
env:
GITEA_ENDPOINT: https://git.m.ac
GITEA_USER: baoshuo
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
- name: Get Package Filename
id: GetPackageFilename
run: echo ::set-output name=filename::s2oj-gcc-$(cat GCC_VERSION)~1baoshuo1.deb
- name: Upload to artifact
uses: actions/upload-artifact@v3
with:
name: s2oj-gcc.deb
path: ${{ steps.GetPackageFilename.outputs.filename }}

1
GCC_VERSION Normal file
View File

@ -0,0 +1 @@
13.2.0

View File

@ -1,9 +1,8 @@
#!/bin/bash
CURRENT_DIR=$(pwd)
GCC_VERSION="13.2.0"
# GCC_GIT="git://gcc.gnu.org/git/gcc.git"
GCC_GIT="https://git.m.ac/mirrors/gcc.git"
GCC_VERSION=$(cat GCC_VERSION)
GCC_GIT="git://gcc.gnu.org/git/gcc.git"
GCC_SRC="${CURRENT_DIR}/../gcc"
build_cd() {
@ -11,6 +10,11 @@ build_cd() {
echo "****** Now at: $(pwd)"
}
if [ -z "$GCC_VERSION" ]; then
echo "GCC_VERSION not set!"
exit 1
fi
# Clone GCC
echo "===> Cloning GCC..."
git clone -b "releases/gcc-$GCC_VERSION" --depth 1 "${GCC_GIT}" "${GCC_SRC}"
@ -30,7 +34,6 @@ build_cd ${CURRENT_DIR}
# Configure GCC
echo "===> Configuring GCC..."
build_cd ${CURRENT_DIR}/build
echo " Now at: $(pwd)"
${GCC_SRC}/configure -v \
--enable-languages=c,c++ \
--prefix=/usr \
@ -43,8 +46,8 @@ ${GCC_SRC}/configure -v \
echo "===> Building GCC..."
make -j$(nproc)
# Make .deb package
echo "===> Making .deb package \"s2oj-gcc-$GCC_VERSION~1baoshuo1.deb\" ..."
# Prepare for packaging
echo "===> Preparing for packaging..."
make -j$(nproc) DESTDIR=${CURRENT_DIR}/deb install
build_cd ${CURRENT_DIR}/deb
mkdir -p DEBIAN
@ -58,10 +61,3 @@ Maintainer: Baoshuo <i@baoshuo.ren>
Description: GCC $GCC_VERSION for S2OJ
EOF
build_cd ${CURRENT_DIR}
dpkg-deb --build deb s2oj-gcc-$GCC_VERSION~1baoshuo1.deb
# Upload package to Gitea
echo "===> Uploading package to Gitea..."
curl --user "${GITEA_USER}:${GITEA_TOKEN}" \
--upload-file s2oj-gcc-$GCC_VERSION~1baoshuo1.deb \
${GITEA_ENDPOINT}/api/packages/${GITEA_USER}/debian/pool/all/main/upload

View File