Skip to content

Commit 7aecd36

Browse files
committed
Merge branch 'main' into feature/fix-whitespace-before-offset
2 parents 7978115 + 1f9f5f0 commit 7aecd36

10 files changed

Lines changed: 83 additions & 58 deletions

File tree

.github/workflows/release.yml

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# Copyright 2022-2023, axodotdev
1+
# Copyright 2022-2024, axodotdev
22
# SPDX-License-Identifier: MIT or Apache-2.0
33
#
44
# CI that:
55
#
66
# * checks for a Git Tag that looks like a release
77
# * builds artifacts with cargo-dist (archives, installers, hashes)
88
# * uploads those artifacts to temporary workflow zip
9-
# * on success, uploads the artifacts to a Github Release
9+
# * on success, uploads the artifacts to a GitHub Release
1010
#
11-
# Note that the Github Release will be created with a generated
11+
# Note that the GitHub Release will be created with a generated
1212
# title/body based on your changelogs.
1313

1414
name: Release
15-
1615
permissions:
17-
contents: write
16+
"contents": "write"
1817

1918
# This task will run whenever you push a git tag that looks like a version
2019
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
@@ -31,22 +30,22 @@ permissions:
3130
# packages versioned/released in lockstep).
3231
#
3332
# If you push multiple tags at once, separate instances of this workflow will
34-
# spin up, creating an independent announcement for each one. However Github
33+
# spin up, creating an independent announcement for each one. However, GitHub
3534
# will hard limit this to 3 tags per commit, as it will assume more tags is a
3635
# mistake.
3736
#
3837
# If there's a prerelease-style suffix to the version, then the release(s)
3938
# will be marked as a prerelease.
4039
on:
40+
pull_request:
4141
push:
4242
tags:
4343
- '**[0-9]+.[0-9]+.[0-9]+*'
44-
pull_request:
4544

4645
jobs:
4746
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
4847
plan:
49-
runs-on: ubuntu-latest
48+
runs-on: "ubuntu-20.04"
5049
outputs:
5150
val: ${{ steps.plan.outputs.manifest }}
5251
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -62,7 +61,12 @@ jobs:
6261
# we specify bash to get pipefail; it guards against the `curl` command
6362
# failing. otherwise `sh` won't catch that `curl` returned non-0
6463
shell: bash
65-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.11.1/cargo-dist-installer.sh | sh"
64+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.18.0/cargo-dist-installer.sh | sh"
65+
- name: Cache cargo-dist
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: cargo-dist-cache
69+
path: ~/.cargo/bin/cargo-dist
6670
# sure would be cool if github gave us proper conditionals...
6771
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
6872
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -105,10 +109,12 @@ jobs:
105109
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106110
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
107111
steps:
112+
- name: enable windows longpaths
113+
run: |
114+
git config --global core.longpaths true
108115
- uses: actions/checkout@v4
109116
with:
110117
submodules: recursive
111-
- uses: swatinem/rust-cache@v2
112118
- name: Install cargo-dist
113119
run: ${{ matrix.install_dist }}
114120
# Get the dist-manifest
@@ -135,7 +141,7 @@ jobs:
135141
run: |
136142
# Parse out what we just built and upload it to scratch storage
137143
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
138-
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
144+
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
139145
echo "EOF" >> "$GITHUB_OUTPUT"
140146
141147
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -160,9 +166,12 @@ jobs:
160166
- uses: actions/checkout@v4
161167
with:
162168
submodules: recursive
163-
- name: Install cargo-dist
164-
shell: bash
165-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.11.1/cargo-dist-installer.sh | sh"
169+
- name: Install cached cargo-dist
170+
uses: actions/download-artifact@v4
171+
with:
172+
name: cargo-dist-cache
173+
path: ~/.cargo/bin/
174+
- run: chmod +x ~/.cargo/bin/cargo-dist
166175
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
167176
- name: Fetch local artifacts
168177
uses: actions/download-artifact@v4
@@ -178,7 +187,7 @@ jobs:
178187
179188
# Parse out what we just built and upload it to scratch storage
180189
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
181-
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
190+
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
182191
echo "EOF" >> "$GITHUB_OUTPUT"
183192
184193
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -206,16 +215,19 @@ jobs:
206215
- uses: actions/checkout@v4
207216
with:
208217
submodules: recursive
209-
- name: Install cargo-dist
210-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.11.1/cargo-dist-installer.sh | sh"
218+
- name: Install cached cargo-dist
219+
uses: actions/download-artifact@v4
220+
with:
221+
name: cargo-dist-cache
222+
path: ~/.cargo/bin/
223+
- run: chmod +x ~/.cargo/bin/cargo-dist
211224
# Fetch artifacts from scratch-storage
212225
- name: Fetch artifacts
213226
uses: actions/download-artifact@v4
214227
with:
215228
pattern: artifacts-*
216229
path: target/distrib/
217230
merge-multiple: true
218-
# This is a harmless no-op for Github Releases, hosting for that happens in "announce"
219231
- id: host
220232
shell: bash
221233
run: |
@@ -229,8 +241,29 @@ jobs:
229241
# Overwrite the previous copy
230242
name: artifacts-dist-manifest
231243
path: dist-manifest.json
244+
# Create a GitHub Release while uploading all files to it
245+
- name: "Download GitHub Artifacts"
246+
uses: actions/download-artifact@v4
247+
with:
248+
pattern: artifacts-*
249+
path: artifacts
250+
merge-multiple: true
251+
- name: Cleanup
252+
run: |
253+
# Remove the granular manifests
254+
rm -f artifacts/*-dist-manifest.json
255+
- name: Create GitHub Release
256+
env:
257+
PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
258+
ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
259+
ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
260+
RELEASE_COMMIT: "${{ github.sha }}"
261+
run: |
262+
# Write and read notes from a file to avoid quoting breaking things
263+
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
264+
265+
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
232266
233-
# Create a Github Release while uploading all files to it
234267
announce:
235268
needs:
236269
- plan
@@ -246,21 +279,3 @@ jobs:
246279
- uses: actions/checkout@v4
247280
with:
248281
submodules: recursive
249-
- name: "Download Github Artifacts"
250-
uses: actions/download-artifact@v4
251-
with:
252-
pattern: artifacts-*
253-
path: artifacts
254-
merge-multiple: true
255-
- name: Cleanup
256-
run: |
257-
# Remove the granular manifests
258-
rm -f artifacts/*-dist-manifest.json
259-
- name: Create Github Release
260-
uses: ncipollo/release-action@v1
261-
with:
262-
tag: ${{ needs.plan.outputs.tag }}
263-
name: ${{ fromJson(needs.host.outputs.val).announcement_title }}
264-
body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
265-
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
266-
artifacts: "artifacts/*"

.github/workflows/release_capi.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
on:
22
release:
33
types: [published]
4+
workflow_run:
5+
workflows:
6+
- Release
7+
types:
8+
- completed
49
pull_request:
510
types: [labeled]
611
name: Append C-API artifact to latest release
712
jobs:
813
deploy_linux_binaries:
9-
if: ${{ github.event.label.name == 'test-release-process' || github.event_name == 'release' }}
14+
if: ${{ github.event.action == 'completed' || github.event.label.name == 'test-release-process' || (github.event_name == 'release' && github.event.action == 'published') }}
1015
runs-on: ubuntu-20.04
1116
env:
1217
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -35,7 +40,7 @@ jobs:
3540
omitNameDuringUpdate: true
3641
omitPrereleaseDuringUpdate: true
3742
deploy_windows_binaries:
38-
if: ${{ github.event.label.name == 'test-release-process' || github.event_name == 'release' }}
43+
if: ${{ github.event.action == 'completed' || github.event.label.name == 'test-release-process' || (github.event_name == 'release' && github.event.action == 'published') }}
3944
runs-on: windows-2019
4045
steps:
4146
- id: latest-release
@@ -62,8 +67,8 @@ jobs:
6267
omitNameDuringUpdate: true
6368
omitPrereleaseDuringUpdate: true
6469
deploy_macos_binaries:
65-
if: ${{ github.event.label.name == 'test-release-process' || github.event_name == 'release' }}
66-
runs-on: macos-11
70+
if: ${{ github.event.action == 'completed' || github.event.label.name == 'test-release-process' || (github.event_name == 'release' && github.event.action == 'published') }}
71+
runs-on: macos-12
6772
steps:
6873
- id: latest-release
6974
uses: pozetroninc/github-action-get-latest-release@v0.7.0

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
RUST_LOG: debug
3737
test_mac:
3838
name: Execute automated tests on OSX
39-
runs-on: macos-11
39+
runs-on: macos-12
4040
steps:
4141
- uses: actions/checkout@v2
4242
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## [Unreleased]
77

8+
### Fixed
9+
10+
- Load existing components from the backup folder instead of the actual location
11+
if a backup folder exists.
12+
813
## [3.3.1] - 2024-06-04
914

1015
### Fixed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ resolver = "2"
1212
# Config for 'cargo dist'
1313
[workspace.metadata.dist]
1414
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
15-
cargo-dist-version = "0.11.1"
15+
cargo-dist-version = "0.18.0"
1616
# CI backends to support
17-
ci = ["github"]
17+
ci = "github"
1818
# The installers to generate for each app
1919
installers = []
2020
# Target platforms to build apps for (Rust target-triple syntax)

core/src/graph/mod.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,13 @@ fn component_path<CT: ComponentType>(
9999
match location {
100100
Some(ref loc) => {
101101
let mut p = PathBuf::from(loc);
102-
// don't use the backup-folder per default
103-
p.push("current");
102+
// Check if we need to load the component from the backup folder
103+
let backup = loc.join("backup");
104+
if backup.exists() {
105+
p.push("backup");
106+
} else {
107+
p.push("current");
108+
}
104109
p.push(component_to_relative_path(c));
105110
Some(p)
106111
}
@@ -166,11 +171,12 @@ impl<CT: ComponentType> Graph<CT> {
166171
let location = PathBuf::from(location);
167172

168173
self.set_location(location.as_path())?;
174+
169175
let backup = location.join("backup");
170176

171-
let mut backup_was_loaded = false;
177+
let mut load_from_backup = false;
172178
let dir2load = if backup.exists() && backup.is_dir() {
173-
backup_was_loaded = true;
179+
load_from_backup = true;
174180
backup.clone()
175181
} else {
176182
location.join("current")
@@ -207,7 +213,7 @@ impl<CT: ComponentType> Graph<CT> {
207213
self.find_components_from_disk(&dir2load)?;
208214

209215
// If backup is active or a write log exists, always a pre-load to get the complete corpus.
210-
if preload | logfile_exists | backup_was_loaded {
216+
if preload | logfile_exists | load_from_backup {
211217
self.ensure_loaded_all()?;
212218
}
213219

@@ -220,7 +226,7 @@ impl<CT: ComponentType> Graph<CT> {
220226
self.current_change_id = 0;
221227
}
222228

223-
if backup_was_loaded {
229+
if load_from_backup {
224230
// save the current corpus under the actual location
225231
self.save_to(&location.join("current"))?;
226232
// rename backup folder (renaming is atomic and deleting could leave an incomplete backup folder on disk)

graphannis/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ crate-type = ["lib"]
1515
[build-dependencies]
1616
csv = "1.1"
1717
file_diff = "1"
18-
lalrpop = {version = "0.20", default_features = false, features = ["lexer", "unicode"]}
18+
lalrpop = {version = "0.20", default-features = false, features = ["lexer", "unicode"]}
1919
regex = "1"
2020

2121
[dependencies]

graphannis/src/annis/db/aql/conjunction.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ pub struct NodeSearchSpecEntry {
6464
pub var: String,
6565
pub spec: NodeSearchSpec,
6666
pub optional: bool,
67-
pub location: Option<LineColumnRange>,
6867
}
6968

7069
#[derive(Debug)]
@@ -298,7 +297,6 @@ impl Conjunction {
298297
var: variable.clone(),
299298
spec: node,
300299
optional,
301-
location: location.clone(),
302300
});
303301

304302
if included_in_output && !optional {

graphannis/src/annis/db/aql/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ fn map_conjunction(
196196
if negated {
197197
if !node_left.optional && !node_right.optional {
198198
op_spec = Arc::new(NegatedOpSpec {
199-
spec_left: node_left.spec.clone(),
200-
spec_right: node_right.spec.clone(),
201199
negated_op: op_spec,
202200
});
203201
q.add_operator_from_query(op_spec, &var_left, &var_right, op_pos, !quirks_mode)?

graphannis/src/annis/db/aql/operators/negated_op.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{fmt::Display, sync::Arc};
22

33
use crate::{
44
annis::{
5-
db::exec::{nodesearch::NodeSearchSpec, CostEstimate},
5+
db::exec::CostEstimate,
66
operator::{BinaryOperator, BinaryOperatorBase, BinaryOperatorSpec, EstimationType},
77
},
88
errors::Result,
@@ -12,8 +12,6 @@ use graphannis_core::annostorage::Match;
1212

1313
#[derive(Debug)]
1414
pub struct NegatedOpSpec {
15-
pub spec_left: NodeSearchSpec,
16-
pub spec_right: NodeSearchSpec,
1715
pub negated_op: Arc<dyn BinaryOperatorSpec>,
1816
}
1917

0 commit comments

Comments
 (0)