name: CI Workflow on: push permissions: packages: write jobs: doc-generator: if: ${{ startsWith(github.ref, 'refs/tags/v') }} needs: - test defaults: run: shell: bash container: image: luzifer/archlinux env: CGO_ENABLED: 0 GOPATH: /go permissions: contents: read pages: write id-token: write runs-on: ubuntu-latest steps: - name: Install required packages run: | pacman -Syy --noconfirm \ curl \ git \ git-lfs \ make \ tar - uses: actions/checkout@v4 with: lfs: true show-progress: false - name: Marking workdir safe run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot - name: Generate documentation run: make render_docs DOCS_BASE_URL=https://luzifer.github.io/twitch-bot/ - name: Upload GitHub Pages artifact uses: actions/upload-pages-artifact@v1 with: path: .rendered-docs - name: Deploy artifact uses: actions/deploy-pages@v1 docker-publish: if: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' }} needs: - test defaults: run: shell: bash runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: lfs: true show-progress: false - name: Log into registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker Build & Publish run: bash ci/docker-publish.sh integration-crdb: if: ${{ github.ref == 'refs/heads/master' }} needs: - test defaults: run: shell: bash container: image: luzifer/archlinux env: CGO_ENABLED: 0 GOPATH: /go runs-on: ubuntu-latest services: crdb: image: luzifer/crdb-gh-service steps: - name: Enable custom AUR package repo run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ cockroachdb-bin \ git \ go \ make - uses: actions/checkout@v4 with: show-progress: false - name: Marking workdir safe run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot - name: Set up CRDB service run: | cockroach sql --host crdb --insecure <>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ git \ go \ make \ mariadb-clients - uses: actions/checkout@v4 with: show-progress: false - name: Marking workdir safe run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot - name: Set up MariaDB service run: | mariadb -h mariadb -u root --password=root-pass <>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ git \ go \ make \ mariadb-clients - uses: actions/checkout@v4 with: show-progress: false - name: Marking workdir safe run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot - name: Set up MySQL service run: | mariadb -h mysql -u root --password=root-pass <>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ git \ go \ make - uses: actions/checkout@v4 with: show-progress: false - name: Marking workdir safe run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot - name: Run tests against PostgreSQL env: GO_TEST_DB_ENGINE: postgres GO_TEST_DB_DSN: host=postgres user=postgres password=twitch-bot-pass dbname=postgres port=5432 sslmode=disable timezone=UTC run: make short_test release: if: ${{ startsWith(github.ref, 'refs/tags/v') }} needs: - test defaults: run: shell: bash container: image: luzifer/archlinux env: CGO_ENABLED: 0 GOPATH: /go runs-on: ubuntu-latest steps: - name: Enable custom AUR package repo run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ awk \ curl \ diffutils \ git \ git-lfs \ go \ golangci-lint-bin \ make \ nodejs-lts-hydrogen \ npm \ tar \ trivy \ unzip \ which \ zip - uses: actions/checkout@v4 with: lfs: true show-progress: false - name: Marking workdir safe run: | git config --global --add safe.directory /__w/twitch-bot/twitch-bot - name: Build release run: make publish - name: Extract changelog run: awk "/^#/ && ++c==2{exit}; /^#/f" "History.md" | tail -n +2 >release_changelog.md - name: Update stable branch if: startsWith(github.ref, 'refs/tags/') run: | git branch -f stable ${GITHUB_SHA} git push -f origin stable - name: Release uses: ncipollo/release-action@v1 if: startsWith(github.ref, 'refs/tags/') with: artifacts: .build/* bodyFile: release_changelog.md draft: false generateReleaseNotes: false test: if: ${{ github.ref != 'refs/heads/stable' }} defaults: run: shell: bash container: image: luzifer/archlinux env: CGO_ENABLED: 0 GOPATH: /go runs-on: ubuntu-latest steps: - name: Enable custom AUR package repo run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ awk \ curl \ diffutils \ git \ git-lfs \ go \ golangci-lint-bin \ make \ nodejs-lts-hydrogen \ npm \ tar \ trivy \ unzip \ which \ zip - uses: actions/checkout@v4 with: lfs: true show-progress: false - name: Marking workdir safe run: | git config --global --add safe.directory /__w/twitch-bot/twitch-bot - name: Lint and test code run: make lint test frontend_lint - name: Build release (quick local for compile) run: make build_prod - name: Execute Trivy scan run: make trivy