Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/release-scrapers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release Scrapers

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'tool/**'
- 'src/**'
- 'dune-project'
- '*.opam'
- '.github/workflows/release-scrapers.yml'

jobs:
release:
name: Build and Release Scraper Binary
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Use OCaml 5.2.0
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "5.2.0"
dune-cache: true
opam-repositories: |
pin: git+https://github.com/ocaml/opam-repository#584630e7a7e27e3cf56158696a3fe94623a0cf4f
opam-disable-sandboxing: true

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libev-dev libonig-dev libcurl4-openssl-dev

- name: Install opam dependencies
run: opam install --deps-only --with-test .

- name: Build scraper
run: opam exec -- dune build tool/data-scrape/bin/scrape.exe

- name: Delete previous release
run: gh release delete scraper-latest --cleanup-tag --yes || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create release
run: |
gh release create scraper-latest \
_build/default/tool/data-scrape/bin/scrape.exe \
--title "Scraper (latest)" \
--notes "Built from ${{ github.sha }}" \
--latest=false
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 9 additions & 26 deletions .github/workflows/scrape.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,26 @@ jobs:
scrape:
name: Run Scrapers
if: github.event_name != 'schedule' || github.repository == 'ocaml/ocaml.org'

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
ocaml-compiler:
- "5.2.0"
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: ${{ matrix.os != 'macos-latest' }}
opam-repositories: |
pin: git+https://github.com/ocaml/opam-repository#584630e7a7e27e3cf56158696a3fe94623a0cf4f
opam-disable-sandboxing: true

- name: Install system dependencies
run: sudo apt update && sudo apt-get install libev-dev libonig-dev libcurl4-openssl-dev

- name: Install opam dependencies
run: opam install --deps-only --with-test .
- name: Install runtime dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libev4 libonig5

- name: Build scraper
- name: Download scraper binary
run: |
opam exec -- dune build tool/data-scrape/bin/scrape.exe
gh release download scraper-latest --pattern scrape.exe
chmod +x scrape.exe
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run scrapers
run: |
make scrape_ocaml_planet \
SCRAPE=./scrape.exe \
COMMIT_FILE=_scrape_commit.md \
REPORT_FILE=_scrape_report.md

Expand Down
37 changes: 9 additions & 28 deletions .github/workflows/scrape_platform_releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,24 @@ jobs:
scrape:
name: Run Scrapers
if: github.event_name != 'schedule' || github.repository == 'ocaml/ocaml.org'

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
ocaml-compiler:
- "5.2.0"
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: ${{ matrix.os != 'macos-latest' }}
opam-repositories: |
pin: git+https://github.com/ocaml/opam-repository#584630e7a7e27e3cf56158696a3fe94623a0cf4f
opam-disable-sandboxing: true

- name: Install system dependencies
run: sudo apt update && sudo apt-get install libev-dev libonig-dev libcurl4-openssl-dev

- name: Install opam dependencies
run: opam install --deps-only --with-test .
- name: Install runtime dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libev4 libonig5

- name: Build scraper
- name: Download scraper binary
run: |
opam exec -- dune build tool/data-scrape/bin/scrape.exe
gh release download scraper-latest --pattern scrape.exe
chmod +x scrape.exe
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run scrapers
run: |
make scrape_platform_releases
run: make scrape_platform_releases SCRAPE=./scrape.exe

- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ watch: ## Watch for the filesystem and rebuild on every change
utop: ## Run a REPL and link with the project's libraries
opam exec -- dune utop --root . . -- -implicit-bindings

SCRAPE ?= opam exec -- dune exec --root . tool/data-scrape/bin/scrape.exe --

.PHONY: scrape_ocaml_planet
scrape_ocaml_planet:
opam exec -- dune exec --root . tool/data-scrape/bin/scrape.exe -- \
planet $(if $(COMMIT_FILE),--commit-file $(COMMIT_FILE)) \
$(if $(REPORT_FILE),--report-file $(REPORT_FILE))
opam exec -- dune exec --root . tool/data-scrape/bin/scrape.exe -- \
video $(if $(COMMIT_FILE),--commit-file $(COMMIT_FILE)) \
$(if $(REPORT_FILE),--report-file $(REPORT_FILE))
$(SCRAPE) planet $(if $(COMMIT_FILE),--commit-file $(COMMIT_FILE)) \
$(if $(REPORT_FILE),--report-file $(REPORT_FILE))
$(SCRAPE) video $(if $(COMMIT_FILE),--commit-file $(COMMIT_FILE)) \
$(if $(REPORT_FILE),--report-file $(REPORT_FILE))

.PHONY: scrape_platform_releases
scrape_platform_releases:
opam exec -- dune exec --root . tool/data-scrape/bin/scrape.exe platform_releases
$(SCRAPE) platform_releases

.PHONY: docker
docker: ## Generate docker container
Expand Down