From d86e59dddc40f3232d1b1ec00e00df4705de3e0d Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 15:32:52 -0700 Subject: [PATCH 01/20] Add specprod validation --- .github/workflows/w3c-specprod.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/w3c-specprod.yml diff --git a/.github/workflows/w3c-specprod.yml b/.github/workflows/w3c-specprod.yml new file mode 100644 index 0000000000..c4091acbfc --- /dev/null +++ b/.github/workflows/w3c-specprod.yml @@ -0,0 +1,22 @@ +# .github/workflows/auto-publish.yml +name: specprod-validate +on: + pull_request: {} + push: + branches: [main] +jobs: + main: + name: Build JS API + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: w3c/spec-prod@v2 + with: + SOURCE: document/js-api/index.bs + #W3C_ECHIDNA_TOKEN: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} + # Replace following with appropriate value. See options.md for details. + #W3C_WG_DECISION_URL: https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md + # Usually, you want the following set too... + W3C_BUILD_OVERRIDE: | + shortName: wasm-js-api + specStatus: ED From fd0eb531e70bf90208ebbec5ea5b609678bf8459 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 15:34:05 -0700 Subject: [PATCH 02/20] run it on specprod --- .github/workflows/w3c-specprod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/w3c-specprod.yml b/.github/workflows/w3c-specprod.yml index c4091acbfc..e5d61556fd 100644 --- a/.github/workflows/w3c-specprod.yml +++ b/.github/workflows/w3c-specprod.yml @@ -3,7 +3,7 @@ name: specprod-validate on: pull_request: {} push: - branches: [main] + branches: [main, specprod] jobs: main: name: Build JS API From 55084942bdea9d00a1433b4e8a2f34c2ff23db9e Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 15:35:36 -0700 Subject: [PATCH 03/20] use bikeshed explicitly --- .github/workflows/w3c-specprod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/w3c-specprod.yml b/.github/workflows/w3c-specprod.yml index e5d61556fd..c6e44ce8be 100644 --- a/.github/workflows/w3c-specprod.yml +++ b/.github/workflows/w3c-specprod.yml @@ -13,6 +13,7 @@ jobs: - uses: w3c/spec-prod@v2 with: SOURCE: document/js-api/index.bs + TOOLCHAIN: bikeshed #W3C_ECHIDNA_TOKEN: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} # Replace following with appropriate value. See options.md for details. #W3C_WG_DECISION_URL: https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md From d2ed008e08bf7a302bd5c9e6f369692d925aeb95 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 15:40:35 -0700 Subject: [PATCH 04/20] remove unknown key --- .github/workflows/w3c-specprod.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/w3c-specprod.yml b/.github/workflows/w3c-specprod.yml index c6e44ce8be..f409923115 100644 --- a/.github/workflows/w3c-specprod.yml +++ b/.github/workflows/w3c-specprod.yml @@ -20,4 +20,3 @@ jobs: # Usually, you want the following set too... W3C_BUILD_OVERRIDE: | shortName: wasm-js-api - specStatus: ED From ae7a7993d56ad82e4e7f173ba5791cd5c145cc10 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 15:51:18 -0700 Subject: [PATCH 05/20] validate pubrules --- .github/workflows/w3c-specprod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/w3c-specprod.yml b/.github/workflows/w3c-specprod.yml index f409923115..f92d465b37 100644 --- a/.github/workflows/w3c-specprod.yml +++ b/.github/workflows/w3c-specprod.yml @@ -14,6 +14,7 @@ jobs: with: SOURCE: document/js-api/index.bs TOOLCHAIN: bikeshed + VALIDATE_PUBRULES: true #W3C_ECHIDNA_TOKEN: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} # Replace following with appropriate value. See options.md for details. #W3C_WG_DECISION_URL: https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md From 63c8cbc31441826902f0189b6fd28cf0b7a6a996 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 15:56:30 -0700 Subject: [PATCH 06/20] fake key --- .github/workflows/w3c-specprod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/w3c-specprod.yml b/.github/workflows/w3c-specprod.yml index f92d465b37..cdafb8b1ee 100644 --- a/.github/workflows/w3c-specprod.yml +++ b/.github/workflows/w3c-specprod.yml @@ -15,6 +15,7 @@ jobs: SOURCE: document/js-api/index.bs TOOLCHAIN: bikeshed VALIDATE_PUBRULES: true + W3C_API_KEY: abc #W3C_ECHIDNA_TOKEN: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} # Replace following with appropriate value. See options.md for details. #W3C_WG_DECISION_URL: https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md From 8cd09f4d6a6aa5516c65499298e0989111969ca2 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 16:58:01 -0700 Subject: [PATCH 07/20] validate --- .github/w3c-validate.yml | 56 +++++++++++++++++++++++++++ document/js-api/Makefile | 9 ++++- document/util/check-echidna-status.py | 48 +++++++++++++++++++++++ 3 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 .github/w3c-validate.yml create mode 100755 document/util/check-echidna-status.py diff --git a/.github/w3c-validate.yml b/.github/w3c-validate.yml new file mode 100644 index 0000000000..bd585b75c4 --- /dev/null +++ b/.github/w3c-validate.yml @@ -0,0 +1,56 @@ +name: Validate spec + +on: + pull_request: {} + push: + branches: [ main, specprod ] + paths: [ .github/**, document/** ] + + # Allows you to run this workflow manually from the Actions tab, gh CLI tool, + # or REST API. THe w3c-status options correspond to the valid options for + # Bikeshed's --md-status flag, and refer to the W3C rec-track document + # stages described in https://www.w3.org/policies/process/#maturity-stages + # (Editor's Draft, Working Draft, Candidiate Recommendation Draft, and + # Candidate Recommendation Snapshot). + workflow_dispatch: + inputs: + w3c-status: + required: true + type: choice + description: W3C Document Status + options: + - ED + - WD + - CRD + - CR + +jobs: + w3c-validate: + if: github.repository == 'dschuff/spec' + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: "recursive" + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Setup Bikeshed + run: pip install bikeshed && bikeshed update + - name: Setup TexLive + run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended + - name: Setup Sphinx + run: pip install six && pip install sphinx==5.1.0 + - name: Publish all specs to their https://www.w3.org/TR/ URLs + run: cd js-api && make -e WD-echidna-CI + env: + W3C_STATUS: ${{ github.event_name == 'push' && 'WD' || inputs.w3c-status }} + W3C_USERNAME: ${{ secrets.W3C_USER }} + W3C_PASSWORD: ${{ secrets.W3C_PWD }} + ECHIDNA_DRYRUN: true + #W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }} + #W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} + #W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }} + YARN_ENABLE_IMMUTABLE_INSTALLS: false diff --git a/document/js-api/Makefile b/document/js-api/Makefile index 7893918d46..fd3122f14c 100644 --- a/document/js-api/Makefile +++ b/document/js-api/Makefile @@ -6,6 +6,7 @@ NAME = WebAssembly DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md TAR = tar DEADLINE = $(shell date -d "+30 days" +%Y-%m-%d 2>/dev/null || date -v +30d +%Y-%m-%d) +ECHIDNA_DRYRUN = false .PHONY: all all: @@ -50,7 +51,10 @@ WD-echidna: WD-tar curl 'https://labs.w3.org/echidna/api/request' \ --user '$(W3C_USERNAME):$(W3C_PASSWORD)' \ -F "tar=@$(BUILDDIR)/WD.tar" \ - -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + -F "decision=$(DECISION_URL)" \ + -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt + sleep 10 + python3 ../util/check-echidna-status.py _build .PHONY: WD-echidna-CI WD-echidna-CI: WD-tar @@ -62,6 +66,7 @@ WD-echidna-CI: WD-tar curl 'https://labs.w3.org/echidna/api/request' \ -F "tar=@$(BUILDDIR)/WD.tar" \ -F "token=$(W3C_ECHIDNA_TOKEN_JSAPI)" \ - -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + -F "decision=$(DECISION_URL)" \ + -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" diff --git a/document/util/check-echidna-status.py b/document/util/check-echidna-status.py new file mode 100755 index 0000000000..426dbae844 --- /dev/null +++ b/document/util/check-echidna-status.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 + +from datetime import datetime, timedelta +import os +import requests +import sys +import json + +ECHIDNA_ID_FILE = 'WD-echidna-id.txt' + + +def get_echidna_id(directory): + id_file = os.path.join(directory, ECHIDNA_ID_FILE) + file_timestamp = os.path.getmtime(id_file) + if datetime.fromtimestamp(file_timestamp) < datetime.now() - timedelta(hours=1): + print(f'Warning: timestamp is {file_timestamp}') + with open(id_file, 'r') as f: + return f.read().strip() + + +def get_echidna_result(echidna_id): + url = f'http://labs.w3.org/echidna/api/status?id={echidna_id}' + response = requests.get(url, allow_redirects=True) + if response.status_code != 200: + print(f'Got status code {response.status_code}, text:') + print(response.text) + raise Exception('Failed to fetch') + + data = response.json() + result = data["results"]["status"] + print(f'Echidna issue {echidna_id} is {result}.') + print(json.dumps(data['results'], indent=2)) + return result == "success" + + +def main(argv): + if len(argv) == 1: + directory = os.getcwd() + else: + directory = argv[1] + echidna_id = get_echidna_id(directory) + print(f'Got echidna result id {echidna_id}.') + if not get_echidna_result(echidna_id): + sys.exit(1) + + +if __name__ == '__main__': + main(sys.argv) From 6ba3d176adb2c5ee9ff21c6a51a636c9d2912538 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 17:01:33 -0700 Subject: [PATCH 08/20] no paths --- .github/w3c-validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/w3c-validate.yml b/.github/w3c-validate.yml index bd585b75c4..4c4f844761 100644 --- a/.github/w3c-validate.yml +++ b/.github/w3c-validate.yml @@ -4,7 +4,7 @@ on: pull_request: {} push: branches: [ main, specprod ] - paths: [ .github/**, document/** ] + # paths: [ .github/**, document/** ] # Allows you to run this workflow manually from the Actions tab, gh CLI tool, # or REST API. THe w3c-status options correspond to the valid options for From 1480a24398da3497035fac5555950736997c16eb Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 2 Oct 2024 17:30:56 -0700 Subject: [PATCH 09/20] also validate core and web api --- document/core/Makefile | 6 +++++- document/web-api/Makefile | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/document/core/Makefile b/document/core/Makefile index df245c881c..f88ff5b4e9 100644 --- a/document/core/Makefile +++ b/document/core/Makefile @@ -13,6 +13,7 @@ NAME = WebAssembly DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md TAR = tar DEADLINE = $(shell date -d "+30 days" +%Y-%m-%d 2>/dev/null || date -v +30d +%Y-%m-%d) +ECHIDNA_DRYRUN = false # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 @@ -210,7 +211,10 @@ WD-echidna-CI: WD-tar curl 'https://labs.w3.org/echidna/api/request' \ -F "tar=@$(BUILDDIR)/WD.tar" \ -F "token=$(W3C_ECHIDNA_TOKEN_CORE)" \ - -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + -F "decision=$(DECISION_URL)" \ + -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt + sleep 10 + python3 ../util/check-echidna-status.py _build @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" diff --git a/document/web-api/Makefile b/document/web-api/Makefile index 2ea8f11ac5..f45bf28531 100644 --- a/document/web-api/Makefile +++ b/document/web-api/Makefile @@ -6,6 +6,7 @@ NAME = WebAssembly DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md TAR = tar DEADLINE = $(shell date -d "+30 days" +%Y-%m-%d 2>/dev/null || date -v +30d +%Y-%m-%d) +ECHIDNA_DRYRUN = false .PHONY: all all: @@ -50,7 +51,10 @@ WD-echidna: WD-tar curl 'https://labs.w3.org/echidna/api/request' \ --user '$(W3C_USERNAME):$(W3C_PASSWORD)' \ -F "tar=@$(BUILDDIR)/WD.tar" \ - -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + -F "decision=$(DECISION_URL)" \ + -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt + sleep 10 + python3 ../util/check-echidna-status.py _build .PHONY: WD-echidna-CI WD-echidna-CI: WD-tar From 1170f793366fb301702f05ed0e225dab4eb3dd43 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 13:11:22 -0700 Subject: [PATCH 10/20] Check Echidna publishing results for failure or success --- .github/workflows/w3c-publish.yml | 5 +++- document/core/Makefile | 11 +++---- document/js-api/Makefile | 4 +-- document/util/check-echidna-status.py | 43 ++++++++++++++++----------- document/web-api/Makefile | 4 +-- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index a47b1211c0..dd79945397 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -1,9 +1,11 @@ -name: Publish to W3C TR space +name: Validate/Publish to W3C TR space on: push: branches: [ main ] paths: [ .github/**, document/** ] + pull_request: + paths: [ .github/**, document/** ] # Allows you to run this workflow manually from the Actions tab, gh CLI tool, # or REST API. THe w3c-status options correspond to the valid options for @@ -49,4 +51,5 @@ jobs: W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }} W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }} + ECHIDNA_DRYRUN: ${{ github.event_name == 'pull_request'}} YARN_ENABLE_IMMUTABLE_INSTALLS: false diff --git a/document/core/Makefile b/document/core/Makefile index f88ff5b4e9..e8e66c6a7d 100644 --- a/document/core/Makefile +++ b/document/core/Makefile @@ -197,7 +197,10 @@ WD-echidna: WD-tar curl 'https://labs.w3.org/echidna/api/request' \ --user '$(W3C_USERNAME):$(W3C_PASSWORD)' \ -F "tar=@$(BUILDDIR)/WD.tar" \ - -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + -F "decision=$(DECISION_URL)" \ + -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt + python3 ../util/check-echidna-status.py $(BUILDDIR) + @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" @@ -211,10 +214,8 @@ WD-echidna-CI: WD-tar curl 'https://labs.w3.org/echidna/api/request' \ -F "tar=@$(BUILDDIR)/WD.tar" \ -F "token=$(W3C_ECHIDNA_TOKEN_CORE)" \ - -F "decision=$(DECISION_URL)" \ - -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt - sleep 10 - python3 ../util/check-echidna-status.py _build + -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + python3 ../util/check-echidna-status.py $(BUILDDIR) @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" diff --git a/document/js-api/Makefile b/document/js-api/Makefile index fd3122f14c..a844922320 100644 --- a/document/js-api/Makefile +++ b/document/js-api/Makefile @@ -53,8 +53,7 @@ WD-echidna: WD-tar -F "tar=@$(BUILDDIR)/WD.tar" \ -F "decision=$(DECISION_URL)" \ -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt - sleep 10 - python3 ../util/check-echidna-status.py _build + python3 ../util/check-echidna-status.py $(BUILDDIR) .PHONY: WD-echidna-CI WD-echidna-CI: WD-tar @@ -68,5 +67,6 @@ WD-echidna-CI: WD-tar -F "token=$(W3C_ECHIDNA_TOKEN_JSAPI)" \ -F "decision=$(DECISION_URL)" \ -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt + python3 ../util/check-echidna-status.py $(BUILDDIR) @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" diff --git a/document/util/check-echidna-status.py b/document/util/check-echidna-status.py index 426dbae844..ea1a257c66 100755 --- a/document/util/check-echidna-status.py +++ b/document/util/check-echidna-status.py @@ -1,45 +1,54 @@ #!/usr/bin/env python3 from datetime import datetime, timedelta +import json import os import requests import sys -import json +import time ECHIDNA_ID_FILE = 'WD-echidna-id.txt' +ECHIDNA_STATUS_URL = 'http://labs.w3.org/echidna/api/status?id=' def get_echidna_id(directory): id_file = os.path.join(directory, ECHIDNA_ID_FILE) - file_timestamp = os.path.getmtime(id_file) - if datetime.fromtimestamp(file_timestamp) < datetime.now() - timedelta(hours=1): - print(f'Warning: timestamp is {file_timestamp}') + file_time = os.path.getmtime(id_file) + if datetime.fromtimestamp(file_time) < datetime.now() - timedelta(hours=1): + print(f'Warning: Echidna ID is not recent: timestamp is {file_time}') with open(id_file, 'r') as f: return f.read().strip() -def get_echidna_result(echidna_id): - url = f'http://labs.w3.org/echidna/api/status?id={echidna_id}' +def get_current_response(echidna_id): + url = ECHIDNA_STATUS_URL + echidna_id + print(f'Fetching {url}') response = requests.get(url, allow_redirects=True) if response.status_code != 200: print(f'Got status code {response.status_code}, text:') print(response.text) - raise Exception('Failed to fetch') - - data = response.json() - result = data["results"]["status"] + raise Exception('Failed to fetch echidna result') + + return response.json() + + +def get_echidna_result(echidna_id): + response = get_current_response(echidna_id) + while response['results']['status'] == 'started': + time.sleep(5) + print('Echidna run in progress, retrying...') + response = get_current_response(echidna_id) + + result = response['results']['status'] print(f'Echidna issue {echidna_id} is {result}.') - print(json.dumps(data['results'], indent=2)) - return result == "success" + print(json.dumps(response, indent=2)) + return result == 'success' def main(argv): - if len(argv) == 1: - directory = os.getcwd() - else: - directory = argv[1] + directory = os.getcwd() if len(argv) < 2 else argv[1] echidna_id = get_echidna_id(directory) - print(f'Got echidna result id {echidna_id}.') + print(f'Got echidna id {echidna_id}.') if not get_echidna_result(echidna_id): sys.exit(1) diff --git a/document/web-api/Makefile b/document/web-api/Makefile index f45bf28531..b4b76ebfb0 100644 --- a/document/web-api/Makefile +++ b/document/web-api/Makefile @@ -53,8 +53,7 @@ WD-echidna: WD-tar -F "tar=@$(BUILDDIR)/WD.tar" \ -F "decision=$(DECISION_URL)" \ -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt - sleep 10 - python3 ../util/check-echidna-status.py _build + python3 ../util/check-echidna-status.py $(BUILDDIR) .PHONY: WD-echidna-CI WD-echidna-CI: WD-tar @@ -67,5 +66,6 @@ WD-echidna-CI: WD-tar -F "tar=@$(BUILDDIR)/WD.tar" \ -F "token=$(W3C_ECHIDNA_TOKEN_WEBAPI)" \ -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + python3 ../util/check-echidna-status.py $(BUILDDIR) @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" From 39d946e802d469738bb4498306c36edc00d490e1 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 13:12:21 -0700 Subject: [PATCH 11/20] remove duplicate workflows --- .github/w3c-validate.yml | 56 ------------------------------ .github/workflows/w3c-specprod.yml | 24 ------------- 2 files changed, 80 deletions(-) delete mode 100644 .github/w3c-validate.yml delete mode 100644 .github/workflows/w3c-specprod.yml diff --git a/.github/w3c-validate.yml b/.github/w3c-validate.yml deleted file mode 100644 index 4c4f844761..0000000000 --- a/.github/w3c-validate.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Validate spec - -on: - pull_request: {} - push: - branches: [ main, specprod ] - # paths: [ .github/**, document/** ] - - # Allows you to run this workflow manually from the Actions tab, gh CLI tool, - # or REST API. THe w3c-status options correspond to the valid options for - # Bikeshed's --md-status flag, and refer to the W3C rec-track document - # stages described in https://www.w3.org/policies/process/#maturity-stages - # (Editor's Draft, Working Draft, Candidiate Recommendation Draft, and - # Candidate Recommendation Snapshot). - workflow_dispatch: - inputs: - w3c-status: - required: true - type: choice - description: W3C Document Status - options: - - ED - - WD - - CRD - - CR - -jobs: - w3c-validate: - if: github.repository == 'dschuff/spec' - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - submodules: "recursive" - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Setup Bikeshed - run: pip install bikeshed && bikeshed update - - name: Setup TexLive - run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended - - name: Setup Sphinx - run: pip install six && pip install sphinx==5.1.0 - - name: Publish all specs to their https://www.w3.org/TR/ URLs - run: cd js-api && make -e WD-echidna-CI - env: - W3C_STATUS: ${{ github.event_name == 'push' && 'WD' || inputs.w3c-status }} - W3C_USERNAME: ${{ secrets.W3C_USER }} - W3C_PASSWORD: ${{ secrets.W3C_PWD }} - ECHIDNA_DRYRUN: true - #W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }} - #W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} - #W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }} - YARN_ENABLE_IMMUTABLE_INSTALLS: false diff --git a/.github/workflows/w3c-specprod.yml b/.github/workflows/w3c-specprod.yml deleted file mode 100644 index cdafb8b1ee..0000000000 --- a/.github/workflows/w3c-specprod.yml +++ /dev/null @@ -1,24 +0,0 @@ -# .github/workflows/auto-publish.yml -name: specprod-validate -on: - pull_request: {} - push: - branches: [main, specprod] -jobs: - main: - name: Build JS API - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 - - uses: w3c/spec-prod@v2 - with: - SOURCE: document/js-api/index.bs - TOOLCHAIN: bikeshed - VALIDATE_PUBRULES: true - W3C_API_KEY: abc - #W3C_ECHIDNA_TOKEN: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} - # Replace following with appropriate value. See options.md for details. - #W3C_WG_DECISION_URL: https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md - # Usually, you want the following set too... - W3C_BUILD_OVERRIDE: | - shortName: wasm-js-api From c9c84e00ac0328c3b8483701d22952e54f58a4d9 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 13:25:41 -0700 Subject: [PATCH 12/20] Default to WD for non-dispatch event types --- .github/workflows/w3c-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index dd79945397..441f52bc53 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -47,7 +47,7 @@ jobs: - name: Publish all specs to their https://www.w3.org/TR/ URLs run: cd document && make -e WD-echidna-CI env: - W3C_STATUS: ${{ github.event_name == 'push' && 'WD' || inputs.w3c-status }} + W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }} W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }} From 61bf1358d7085f014448755683dee38feac70dff Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 14:33:46 -0700 Subject: [PATCH 13/20] dry run by default, use W3C_USERNAME alternately --- .github/workflows/w3c-publish.yml | 10 +++++++++- document/core/Makefile | 2 +- document/js-api/Makefile | 2 +- document/web-api/Makefile | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index 441f52bc53..4258d55e72 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -27,7 +27,6 @@ on: jobs: publish-to-w3c-TR: - if: github.repository == 'WebAssembly/spec' runs-on: ubuntu-latest steps: - name: Checkout repo @@ -45,6 +44,7 @@ jobs: - name: Setup Sphinx run: pip install six && pip install sphinx==5.1.0 - name: Publish all specs to their https://www.w3.org/TR/ URLs + if: github.repository == 'WebAssembly/spec' run: cd document && make -e WD-echidna-CI env: W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} @@ -53,3 +53,11 @@ jobs: W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }} ECHIDNA_DRYRUN: ${{ github.event_name == 'pull_request'}} YARN_ENABLE_IMMUTABLE_INSTALLS: false + - name: Validate all specs with Echidna + if: github.repository != 'WebAssembly/spec' + run: cd document && make -e WD-echidna + env: + W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} + W3C_USERNAME: ${{ secrets.W3C_USERNAME }} + W3C_PASSWORD: ${{ secrets.W3C_PASSWORD }} + YARN_ENABLE_IMMUTABLE_INSTALLS: false diff --git a/document/core/Makefile b/document/core/Makefile index e8e66c6a7d..6943e3e299 100644 --- a/document/core/Makefile +++ b/document/core/Makefile @@ -13,7 +13,7 @@ NAME = WebAssembly DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md TAR = tar DEADLINE = $(shell date -d "+30 days" +%Y-%m-%d 2>/dev/null || date -v +30d +%Y-%m-%d) -ECHIDNA_DRYRUN = false +ECHIDNA_DRYRUN = true # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 diff --git a/document/js-api/Makefile b/document/js-api/Makefile index a844922320..e34b7a6b24 100644 --- a/document/js-api/Makefile +++ b/document/js-api/Makefile @@ -6,7 +6,7 @@ NAME = WebAssembly DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md TAR = tar DEADLINE = $(shell date -d "+30 days" +%Y-%m-%d 2>/dev/null || date -v +30d +%Y-%m-%d) -ECHIDNA_DRYRUN = false +ECHIDNA_DRYRUN = true .PHONY: all all: diff --git a/document/web-api/Makefile b/document/web-api/Makefile index b4b76ebfb0..bd25da603b 100644 --- a/document/web-api/Makefile +++ b/document/web-api/Makefile @@ -6,7 +6,7 @@ NAME = WebAssembly DECISION_URL = https://github.com/WebAssembly/meetings/blob/main/main/2024/WG-06-12.md TAR = tar DEADLINE = $(shell date -d "+30 days" +%Y-%m-%d 2>/dev/null || date -v +30d +%Y-%m-%d) -ECHIDNA_DRYRUN = false +ECHIDNA_DRYRUN = true .PHONY: all all: From 35bfe91af3f35a22f251d29e597477134dad7e44 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 14:56:47 -0700 Subject: [PATCH 14/20] try conditioning on secrects --- .github/workflows/w3c-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index 4258d55e72..1244b3b047 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -44,7 +44,7 @@ jobs: - name: Setup Sphinx run: pip install six && pip install sphinx==5.1.0 - name: Publish all specs to their https://www.w3.org/TR/ URLs - if: github.repository == 'WebAssembly/spec' + if: secrets.W3C_ECHIDNA_TOKEN_CORE run: cd document && make -e WD-echidna-CI env: W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} @@ -54,7 +54,7 @@ jobs: ECHIDNA_DRYRUN: ${{ github.event_name == 'pull_request'}} YARN_ENABLE_IMMUTABLE_INSTALLS: false - name: Validate all specs with Echidna - if: github.repository != 'WebAssembly/spec' + if: secrets.W3C_USERNAME run: cd document && make -e WD-echidna env: W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} From 52a26e96f8f562efde28f29003954b931299b195 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 15:06:09 -0700 Subject: [PATCH 15/20] condition on env --- .github/workflows/w3c-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index 1244b3b047..4275c4a1bd 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -44,7 +44,7 @@ jobs: - name: Setup Sphinx run: pip install six && pip install sphinx==5.1.0 - name: Publish all specs to their https://www.w3.org/TR/ URLs - if: secrets.W3C_ECHIDNA_TOKEN_CORE + if: github.repository == 'WebAssembly/spec' run: cd document && make -e WD-echidna-CI env: W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} @@ -54,7 +54,7 @@ jobs: ECHIDNA_DRYRUN: ${{ github.event_name == 'pull_request'}} YARN_ENABLE_IMMUTABLE_INSTALLS: false - name: Validate all specs with Echidna - if: secrets.W3C_USERNAME + if: env.W3C_USERNAME run: cd document && make -e WD-echidna env: W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} From 04f33eeaf0b3016e592b883a265a4a1c0ce46a29 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 15:19:16 -0700 Subject: [PATCH 16/20] condition token version on token existence also --- .github/workflows/w3c-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index 4275c4a1bd..4c29a29154 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -44,14 +44,14 @@ jobs: - name: Setup Sphinx run: pip install six && pip install sphinx==5.1.0 - name: Publish all specs to their https://www.w3.org/TR/ URLs - if: github.repository == 'WebAssembly/spec' + if: env.W3C_ECHIDNA_TOKEN_CORE run: cd document && make -e WD-echidna-CI env: W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }} W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }} - ECHIDNA_DRYRUN: ${{ github.event_name == 'pull_request'}} + ECHIDNA_DRYRUN: ${{ github.event_name == 'pull_request' && github.repository == 'WebAssembly/spec'}} YARN_ENABLE_IMMUTABLE_INSTALLS: false - name: Validate all specs with Echidna if: env.W3C_USERNAME From a6724e2023c756d10afc8b230d386592b85b1a24 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 15:29:43 -0700 Subject: [PATCH 17/20] deduplicate env --- .github/workflows/w3c-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index 4c29a29154..561a8e6640 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -25,6 +25,10 @@ on: - CRD - CR +env: + YARN_ENABLE_IMMUTABLE_INSTALLS: false + W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} + jobs: publish-to-w3c-TR: runs-on: ubuntu-latest @@ -47,17 +51,13 @@ jobs: if: env.W3C_ECHIDNA_TOKEN_CORE run: cd document && make -e WD-echidna-CI env: - W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }} W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }} ECHIDNA_DRYRUN: ${{ github.event_name == 'pull_request' && github.repository == 'WebAssembly/spec'}} - YARN_ENABLE_IMMUTABLE_INSTALLS: false - name: Validate all specs with Echidna if: env.W3C_USERNAME run: cd document && make -e WD-echidna env: - W3C_STATUS: ${{ github.event_name == 'workflow_dispatch' && inputs.w3c-status || 'WD' }} W3C_USERNAME: ${{ secrets.W3C_USERNAME }} W3C_PASSWORD: ${{ secrets.W3C_PASSWORD }} - YARN_ENABLE_IMMUTABLE_INSTALLS: false From b8cc194920cbf136b28d8f3e78683832ad640612 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 3 Oct 2024 15:40:52 -0700 Subject: [PATCH 18/20] Also wait before the first result fetch (sometimes it 404s if you fetch too soon) --- document/util/check-echidna-status.py | 1 + 1 file changed, 1 insertion(+) diff --git a/document/util/check-echidna-status.py b/document/util/check-echidna-status.py index ea1a257c66..9bc3f6026c 100755 --- a/document/util/check-echidna-status.py +++ b/document/util/check-echidna-status.py @@ -49,6 +49,7 @@ def main(argv): directory = os.getcwd() if len(argv) < 2 else argv[1] echidna_id = get_echidna_id(directory) print(f'Got echidna id {echidna_id}.') + time.sleep(5) if not get_echidna_result(echidna_id): sys.exit(1) From b657ba10b4290fc464cb39eb6ed2cce8c937da55 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 4 Oct 2024 09:05:09 -0700 Subject: [PATCH 19/20] Fix dryrun logic, add it to the missing CI targets --- .github/workflows/w3c-publish.yml | 2 +- document/core/Makefile | 3 ++- document/web-api/Makefile | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index 561a8e6640..eb190eddc3 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -54,7 +54,7 @@ jobs: W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }} W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }} - ECHIDNA_DRYRUN: ${{ github.event_name == 'pull_request' && github.repository == 'WebAssembly/spec'}} + ECHIDNA_DRYRUN: ${{ !(github.event_name == 'push' && github.repository == 'WebAssembly/spec' && github.ref == 'refs/heads/main') }} - name: Validate all specs with Echidna if: env.W3C_USERNAME run: cd document && make -e WD-echidna diff --git a/document/core/Makefile b/document/core/Makefile index 6943e3e299..49942c71c5 100644 --- a/document/core/Makefile +++ b/document/core/Makefile @@ -214,7 +214,8 @@ WD-echidna-CI: WD-tar curl 'https://labs.w3.org/echidna/api/request' \ -F "tar=@$(BUILDDIR)/WD.tar" \ -F "token=$(W3C_ECHIDNA_TOKEN_CORE)" \ - -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + -F "decision=$(DECISION_URL)" \ + -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt python3 ../util/check-echidna-status.py $(BUILDDIR) @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" diff --git a/document/web-api/Makefile b/document/web-api/Makefile index bd25da603b..ea018adc56 100644 --- a/document/web-api/Makefile +++ b/document/web-api/Makefile @@ -65,7 +65,8 @@ WD-echidna-CI: WD-tar curl 'https://labs.w3.org/echidna/api/request' \ -F "tar=@$(BUILDDIR)/WD.tar" \ -F "token=$(W3C_ECHIDNA_TOKEN_WEBAPI)" \ - -F "decision=$(DECISION_URL)" | tee $(BUILDDIR)/WD-echidna-id.txt + -F "decision=$(DECISION_URL)" \ + -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt python3 ../util/check-echidna-status.py $(BUILDDIR) @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" From 2d20f8806a256a83c4d405ef0de7f042c4aae340 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 4 Oct 2024 09:14:51 -0700 Subject: [PATCH 20/20] print post-upload message in the appropriate places --- document/core/Makefile | 1 - document/js-api/Makefile | 2 ++ document/web-api/Makefile | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/document/core/Makefile b/document/core/Makefile index 49942c71c5..20b6ac4ca8 100644 --- a/document/core/Makefile +++ b/document/core/Makefile @@ -200,7 +200,6 @@ WD-echidna: WD-tar -F "decision=$(DECISION_URL)" \ -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt python3 ../util/check-echidna-status.py $(BUILDDIR) - @echo @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" diff --git a/document/js-api/Makefile b/document/js-api/Makefile index e34b7a6b24..bacd1938c7 100644 --- a/document/js-api/Makefile +++ b/document/js-api/Makefile @@ -54,6 +54,8 @@ WD-echidna: WD-tar -F "decision=$(DECISION_URL)" \ -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt python3 ../util/check-echidna-status.py $(BUILDDIR) + @echo + @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" .PHONY: WD-echidna-CI WD-echidna-CI: WD-tar diff --git a/document/web-api/Makefile b/document/web-api/Makefile index ea018adc56..598658bfa7 100644 --- a/document/web-api/Makefile +++ b/document/web-api/Makefile @@ -54,6 +54,8 @@ WD-echidna: WD-tar -F "decision=$(DECISION_URL)" \ -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt python3 ../util/check-echidna-status.py $(BUILDDIR) + @echo + @echo "Published $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" .PHONY: WD-echidna-CI WD-echidna-CI: WD-tar