automated tests #7711
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: automated tests | |
on: | |
push: null | |
pull_request: null | |
schedule: | |
- cron: 0 0 * * * | |
jobs: | |
build: | |
outputs: | |
bin_ids: ${{ env.bin_ids }} | |
bins: ${{ env.bins }} | |
clients: ${{ env.clients }} | |
slow: ${{ env.slow }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 1 | |
submodules: true | |
- name: get package version | |
run: echo "version="`jq -r .version package.json` >> $GITHUB_ENV | |
- name: cancel spurious build on tagged version | |
uses: andymckay/cancel-action@master | |
if: github.event.head_commit.message == env.version && !startsWith(github.ref, | |
'refs/tags/') | |
- name: install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: pip | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install packaging xvfbwrapper | |
pip install -r requirements.txt | |
- name: install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: install node packages | |
run: npm install && npm ls | |
- name: set slow/legacy/beta flags | |
run: ./util/action-flags | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
- name: get previous test durations | |
run: curl -L | |
https://github.com/retorquere/zotero-better-bibtex/releases/download/builds/durations${{ | |
env.slow }}.json --create-dirs -o test/balance/durations.json | |
- name: balance tests | |
id: balance | |
run: ./util/balance.py --durations test/balance/durations.json --bins test/balance/bins.json | |
--minutes 10 ${{ env.slow }} ${{ env.beta }} ${{ env.legacy }} | |
- name: build ${{ env.beta }} ${{ env.legacy }} | |
run: npm run build | |
env: | |
VERSION_WITH_ISSUE: false | |
- name: publish debug bridge | |
run: ./util/publish-debug-bridge.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: store build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: | | |
xpi/ | |
gen/ | |
test/balance/ | |
retention-days: 1 | |
site: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, | |
'refs/tags/')) }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 1 | |
submodules: true | |
- name: install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: pip | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install packaging xvfbwrapper | |
pip install -r requirements.txt | |
- name: install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: install node packages | |
run: npm install && npm ls | |
- name: build site and install hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: latest | |
extended: true | |
- name: prepare docs for deploy | |
run: npm run docs:deploy | |
- name: deploy site | |
uses: peaceiris/actions-gh-pages@v4 | |
if: ${{ success() }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site/public | |
test: | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
bin: ${{ fromJSON(needs.build.outputs.bin_ids) }} | |
client: ${{ fromJSON(needs.build.outputs.clients) }} | |
worker: [--worker, --no-worker] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 1 | |
submodules: true | |
- name: fetch build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
- name: install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: pip | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install packaging xvfbwrapper | |
pip install -r requirements.txt | |
- name: Set system-wide proxy using PAC URL | |
run: | | |
echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" | sudo tee -a /etc/environment | |
echo "auto_proxy=http://proxy-doc.ird.fr/proxy.pac" >> $GITHUB_ENV | |
- name: Verify proxy settings | |
run: env | grep -i proxy | |
- name: install ${{ matrix.client }} | |
run: | | |
curl -sL https://raw.githubusercontent.com/retorquere/zotero-deb/master/install.sh | sudo bash | |
sudo apt-get update | |
sudo apt-get install ${{ matrix.client }} | |
sudo apt-get install mesa-utils xvfb | |
sudo apt-get install wmctrl xdotool | |
curl -LO https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-linux-amd64.tar.gz | |
tar xvzf pandoc-3.1.11.1-linux-amd64.tar.gz | |
sudo mv pandoc-3.1.11.1/bin/pandoc /usr/bin | |
pandoc -v | |
# preserve log hierarchy | |
mkdir stats | |
mkdir .stats | |
mktemp .stats/stats.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
- name: Run tests | |
# continue-on-error: ${{ matrix.client == 'jurism' }} | |
run: ./test/behave --client ${{ matrix.client }} ${{ matrix.worker }} --format | |
ci --bin ${{ matrix.bin }} --bins ${{ needs.build.outputs.bins }} --durations | |
test/stats/durations--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker | |
}}.json ${{ needs.build.outputs.slow }} | |
env: | |
PYTHONUNBUFFERED: true | |
- name: save log on failure | |
if: ${{ failure() || cancelled() }} | |
run: | | |
touch ~/.BBTTEST.log | |
cp ~/.BBTTEST.log ~/BBTTEST--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker }}.txt | |
cp -r ~/.BBTTEST ~/BBTTEST | |
- name: upload log on failure | |
if: ${{ failure() || cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debug-log--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker | |
}} | |
path: | | |
~/BBTTEST*.txt | |
exported/ | |
retention-days: 5 | |
- name: store test artifacts | |
if: matrix.client == 'zotero' && matrix.worker == '--worker' && github.event_name | |
== 'push' && github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-artifacts--${{ matrix.client }}--${{ matrix.bin }}${{ matrix.worker | |
}} | |
path: ./*/stats/durations* | |
retention-days: 2 | |
# - name: Setup tmate session | |
# if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 | |
# with: | |
# limit-access-to-actor: true | |
release: | |
if: github.event_name != 'schedule' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 1 | |
submodules: true | |
- name: fetch build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
- name: install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: pip | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install packaging xvfbwrapper | |
pip install -r requirements.txt | |
- name: install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: install node packages | |
run: npm install && npm ls | |
- run: npm run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/github-script@v7 | |
continue-on-error: true | |
with: | |
script: | | |
if (process.env.XPI_RELEASED) { | |
github.rest.issues.addLabels({ | |
issue_number: parseInt(process.env.XPI_RELEASED), | |
owner: 'retorquere', | |
repo: 'zotero-better-bibtex', | |
labels: ['awaiting-user-feedback'], | |
}) | |
} | |
durations: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
needs: | |
- build | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 1 | |
submodules: true | |
- name: install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: pip | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install packaging xvfbwrapper | |
pip install -r requirements.txt | |
- name: fetch test artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: test-artifacts--* | |
merge-multiple: true | |
- name: collect test data | |
run: jq -s add test/stats/durations--*.json > test/stats/durations${{ needs.build.outputs.slow | |
}}.json | |
- name: Store build stats | |
run: | | |
gh release upload builds test/stats/durations${{ needs.build.outputs.slow }}.json --clobber --repo ${{ github.repository }} | |
env: | |
GH_TOKEN: ${{ github.token }} |