diff --git a/.github/workflows/issueclose.yml b/.github/workflows/issueclose.yml new file mode 100644 index 00000000..4ac6830f --- /dev/null +++ b/.github/workflows/issueclose.yml @@ -0,0 +1,33 @@ +name: Clean unused branch + + +on: + issues: + types: [closed] + + +jobs: + clean-resource: + runs-on: ubuntu-latest + # I don't know why github action cointains returns false always when using labels.*.name + if: | + contains(github.event.issue.labels[0].name, 'branch:release-branch.') + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + - name: Skip Cache Parser Tool + run: | + go env -w GOPRIVATE=github.com/MeteorsLiu/llpkgstore + - name: Set up Parser Tool + run: | + go install -v github.com/MeteorsLiu/llpkgstore/cmd/maintain@gha-test + - name: Run cleaner process + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + maintain issueclose \ No newline at end of file diff --git a/.github/workflows/labelcreate.yml b/.github/workflows/labelcreate.yml new file mode 100644 index 00000000..9d316d69 --- /dev/null +++ b/.github/workflows/labelcreate.yml @@ -0,0 +1,56 @@ +name: Legacy version maintenance + + +# label trigger +on: + label: + types: [created] + + + +jobs: + maintenance: + runs-on: ubuntu-latest + if: | + contains(github.event.label.name, 'branch:release-branch.') + steps: + - name: Checkout to website + uses: actions/checkout@v4 + with: + ref: website + path: .website + - name: Checkout + uses: actions/checkout@v4 + with: + ref: main + path: .main + # actions/checkout cannot fetch tags even though using fetch-tags + # see issue: https://github.com/actions/checkout/issues/1471 + - name: Fetch all tags + working-directory: .main + run: | + git fetch --all --tags --prune + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + - name: Skip Cache Parser Tool + run: | + go env -w GOPRIVATE=github.com/MeteorsLiu/llpkgstore + - name: Set up Parser Tool + run: | + go install -v github.com/MeteorsLiu/llpkgstore/cmd/maintain@gha-test + - name: Copy llpkgstore.json to root + continue-on-error: true + run: | + # ignore error + ls .website .website/public + cp .website/public/llpkgstore.json .main + rm -rf .website + - name: Run maintenance process + working-directory: .main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + maintain labelcreate -l "${{ github.event.label.name }}" \ No newline at end of file diff --git a/.github/workflows/postprocessing.yml b/.github/workflows/postprocessing.yml new file mode 100644 index 00000000..2869ebe3 --- /dev/null +++ b/.github/workflows/postprocessing.yml @@ -0,0 +1,168 @@ +name: Post-processing + + +# don't limit to main branch +# consider maintenance branch +on: + push: + branches: + - 'release-branch.**' + - main + + +jobs: + post-processing: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: main + path: .main + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + - name: Skip Cache Parser Tool + run: | + go env -w GOPRIVATE=github.com/MeteorsLiu/llpkgstore + - name: Set up Parser Tool + run: | + go install -v github.com/MeteorsLiu/llpkgstore/cmd/llpkgstore@gha-test + - name: Checkout to website + uses: actions/checkout@v4 + with: + ref: website + path: .website + + - name: Copy llpkgstore.json to root + continue-on-error: true + run: | + # ignore error + ls .website .website/public + cp .website/public/llpkgstore.json .main + rm -rf .website + + - name: Run post-processing process + working-directory: .main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + llpkgstore postprocessing + + - name: Checkout website branch + uses: actions/checkout@v4 + with: + ref: website + path: .website + + - name: Move llpkgstore.json to website + run: | + mv .main/llpkgstore.json .website/public + + - name: Commit and push changes + working-directory: .website + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add public/llpkgstore.json + git commit -m "Update llpkgstore.json" + git push + release-binary-files: + strategy: + matrix: + os: + # amd64 darwin + - macos-13 + # arm64 darwin + - macos-latest + # amd64 linux + - ubuntu-24.04 + # ard64 linux + - ubuntu-24.04-arm + llvm: [18] + runs-on: ${{matrix.os}} + needs: [post-processing] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check out LLGo + uses: actions/checkout@v4 + with: + repository: 'goplus/llgo' + path: .llgo + - name: Check out LLCppg + uses: actions/checkout@v4 + with: + repository: 'goplus/llcppg' + path: .llcppg + ref: 'v0.1.0' + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + - name: Skip Cache Parser Tool + run: | + go env -w GOPRIVATE=github.com/MeteorsLiu/llpkgstore + - name: Set up Parser Tool + run: | + go install -v github.com/MeteorsLiu/llpkgstore/cmd/llpkgstore@gha-test + - name: Install dependencies + if: startsWith(matrix.os, 'macos') + run: | + brew update + brew install llvm@${{matrix.llvm}} cmake conan cjson + echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH + + - name: Install dependencies + if: startsWith(matrix.os, 'ubuntu') + run: | + echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{matrix.llvm}} main" | sudo tee /etc/apt/sources.list.d/llvm.list + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo apt-get update + sudo apt-get install -y llvm-${{matrix.llvm}}-dev clang-${{matrix.llvm}} cmake python3 python3-pip libunwind-dev libclang-${{matrix.llvm}}-dev lld-${{matrix.llvm}} pkg-config + echo "/usr/lib/llvm-${{matrix.llvm}}/bin" >> $GITHUB_PATH + python3 -m pip install conan + - name: Set up Conan + run: | + conan profile detect + - name: Run release process + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + llpkgstore release + rebuild-github-pages: + runs-on: ubuntu-latest + needs: [release-binary-files] + permissions: + pages: write + id-token: write + strategy: + matrix: + node-version: [23.8.0] + steps: + - name: Checkout to website + uses: actions/checkout@v4 + with: + ref: website + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: corepack enable + - name: Install Dependencies + uses: borales/actions-yarn@v4 + with: + cmd: install + - name: Build + uses: borales/actions-yarn@v4 + with: + cmd: build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'dist' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/verification.yml b/.github/workflows/verification.yml new file mode 100644 index 00000000..0ec28e7e --- /dev/null +++ b/.github/workflows/verification.yml @@ -0,0 +1,99 @@ +name: Verify Go Module + + +# don't limit to main branch +# consider maintenance branch +on: + pull_request: + branches: + - 'release-branch.**' + - main + + +jobs: + llcppg-verification: + name: Verify Go Module + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + - name: Check out LLGo + uses: actions/checkout@v4 + with: + repository: 'goplus/llgo' + path: .llgo + - name: Check out LLCppg + uses: actions/checkout@v4 + with: + repository: 'goplus/llcppg' + path: .llcppg + ref: 'v0.1.0' + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + - name: Skip Cache Parser Tool + run: | + go env -w GOPRIVATE=github.com/MeteorsLiu/llpkgstore + - name: Set up Parser Tool + run: | + go install -v github.com/MeteorsLiu/llpkgstore/cmd/llpkgstore@gha-test + go install -v github.com/MeteorsLiu/llpkgstore/cmd/demotest@gha-test + - name: Set up Conan + run: | + sudo apt-get install -y python3 python3-pip + python3 -m pip install conan + conan profile detect + - name: Setup LLGo + working-directory: .llgo + run: | + echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo apt-get update + sudo apt-get install -y python3 python3-pip llvm-18-dev libuv1-dev clang-18 libunwind-dev libclang-18-dev lld-18 cmake pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev + echo "/usr/lib/llvm-18/bin" >> $GITHUB_PATH + cd compiler + go install -v ./cmd/... + export LLGO_ROOT=$GITHUB_WORKSPACE/llgo + echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + - name: Setup LLCppg + working-directory: .llcppg + run: | + llgo install ./_xtool/llcppsymg + llgo install ./_xtool/llcppsigfetch + go install github.com/goplus/llcppg/cmd/llcppcfg@v0.1.0 + go install github.com/goplus/llcppg/cmd/gogensig@v0.1.0 + go install github.com/goplus/llcppg@v0.1.0 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + + - name: Checkout to website + uses: actions/checkout@v4 + with: + ref: website + path: .website + + - name: Copy llpkgstore.json to root + continue-on-error: true + run: | + # ignore error + ls .website .website/public + cp .website/public/llpkgstore.json . + rm -rf .website + + - name: Verfication + id: gen-go-module + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + llpkgstore verification + + - name: Run Demotest process + env: + LLPKG_PATH: ${{ env.LLPKG_PATH }} + run: | + demotest run