diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..f62d1057 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,20 @@ +name: Github Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions (on Gitea) 🚀 +on: [push] + +jobs: + Explore-Gitea-Actions: + runs-on: metal-docker + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: | + ls -la + docker build --progress plain --iidfile iid.txt . + stringprefix() { [ ${#1} -le $2 ] && echo $1 && return 0 || stringprefix "${1%?}" $2 ; } + SHORTSHA="$(stringprefix "$GITHUB_SHA" 8)" + for TAG in "$SHORTSHA" "$GITHUB_REF_NAME";do + docker tag "`cat iid.txt`" "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG" + docker push "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG" + done + diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index f08d7a87..00000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,80 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "master" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master" ] - schedule: - - cron: '20 2 * * 5' - -env: - GO: 1.21.4 - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'go' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index bb2c2d5b..00000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Publish Docker image - -on: - workflow_dispatch: - push: - branches: - - 'master' - tags: - - 'v*' - -env: - REGISTRY: "" - IMAGE_NAME: ipfs/ipfs-cluster - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - # registry: ${{ env.REGISTRY }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Get tags - id: tags - run: | - echo "value<> $GITHUB_OUTPUT - ./docker/get-docker-tags.sh "$(date -u +%F)" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - shell: bash - - - name: Build Docker image and publish to Docker Hub - uses: docker/build-push-action@v4 - with: - platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 - context: . - push: true - file: ./Dockerfile - tags: "${{ steps.tags.outputs.value }}" - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: Move cache to limit growth - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 297540be..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Close and mark stale issue - -on: - schedule: - - cron: '0 0 * * *' - -jobs: - stale: - - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - - steps: - - uses: actions/stale@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.' - close-issue-message: 'This issue was closed because it is missing author input.' - stale-issue-label: 'kind/stale' - any-of-labels: 'need/author-input' - exempt-issue-labels: 'need/triage,need/community-input,need/maintainer-input,need/maintainers-input,need/analysis' - days-before-issue-stale: 6 - days-before-issue-close: 7 - enable-statistics: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 36b64bf7..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,170 +0,0 @@ -name: Tests - -on: - push: - branches: [ master ] - pull_request: - branches: [ master, dependency-upgrades ] - -env: - GO: 1.21.4 - -jobs: - tests-all: - name: "All modules + Coverage" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - - name: "Tests" - run: go test -v -timeout 15m -coverprofile=coverage.txt -covermode=atomic ./... - - - name: "Coverage" - uses: codecov/codecov-action@v2 - - tests-raft: - name: "Using Raft" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - - name: "Tests" - run: go test -v -timeout 15m -failfast -consensus raft . - - tests-leveldb: - name: "Using LevelDB" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - - name: "Tests" - run: go test -v -timeout 15m -failfast -datastore leveldb . - - tests-badger3: - name: "Using Badger3" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - - name: "Tests" - run: go test -v -timeout 15m -failfast -datastore badger3 . - - tests-badger: - name: "Using Badger" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - - name: "Tests" - run: go test -v -timeout 15m -failfast -datastore badger . - - - tests-check: - name: "Build, syntax and spelling checks" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@latest - - - name: Install misspell - run: go install github.com/client9/misspell/cmd/misspell@latest - - - name: Check - run: make check - - - name: Build binaries - run: make build - - docker: - name: "Docker build" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Docker builds - run: make docker - - docker-compose: - name: "Docker Compose" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Docker compose - run: make docker-compose - - sharness: - name: Sharness - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - - name: Apt-get update - run: sudo apt-get update - - - name: Install jq and curl - run: sudo apt-get install -y jq curl - - - name: Make install - run: make install - - - name: Pull kubo - run: docker pull ipfs/kubo - - - name: Sharness - run: make test_sharness