1
0
mirror of https://github.com/renbaoshuo/s2oj-gcc.git synced 2024-07-27 03:43:19 +00:00

refactor: use github actions to build gcc

This commit is contained in:
Baoshuo Ren 2023-11-17 06:30:10 +08:00
parent 883a251310
commit 53cd2cff86
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
5 changed files with 34 additions and 33 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

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

@ -0,0 +1,26 @@
name: Build & Publish
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
apt update &&
apt 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
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 }}

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}"
@ -59,9 +63,3 @@ 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