Skip to content

Commit 6c498e1

Browse files
authored
Merge pull request #1072 from NBISweden/release/20250319
Release/20250319
2 parents a2ecd15 + d7e8327 commit 6c498e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1296
-1054
lines changed

.github/dependabot.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ updates:
33
- package-ecosystem: "gomod"
44
directory: "backend/"
55
schedule:
6-
interval: "weekly"
6+
interval: "monthly"
77

88
- package-ecosystem: "npm"
99
directory: "frontend/"
1010
schedule:
11-
interval: "weekly"
11+
interval: "monthly"
1212

1313
- package-ecosystem: "docker"
1414
directory: "frontend/"
1515
schedule:
16-
interval: "weekly"
16+
interval: "monthly"
1717

1818
- package-ecosystem: "docker"
1919
directory: "backend/"
2020
schedule:
21-
interval: "weekly"
21+
interval: "monthly"
2222

2323
- package-ecosystem: "docker"
2424
directory: "production/"
2525
schedule:
26-
interval: "weekly"
26+
interval: "monthly"
2727

2828
- package-ecosystem: "docker"
2929
directory: "node/"
3030
schedule:
31-
interval: "weekly"
31+
interval: "monthly"

.github/workflows/apidocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
go-version: [1.19]
13+
go-version: [1.24]
1414
steps:
1515

1616
- name: Set up Go ${{ matrix.go-version }}

.github/workflows/create-test-package.yml

-44
This file was deleted.

.github/workflows/create_packages.yml

+122-37
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,135 @@
1+
---
2+
13
name: Create packages
2-
on:
3-
pull_request:
4+
5+
"on":
6+
push:
47
branches:
8+
- develop
59
- main
6-
types:
7-
- closed
8-
10+
- testing-github-actions
911

1012
jobs:
11-
main:
12-
if: github.event.pull_request.merged == true
13+
tag:
14+
name: generate tag
15+
outputs:
16+
part: ${{ steps.generate_tag.outputs.part }}
17+
tag: ${{ steps.generate_tag.outputs.tag }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: '1'
23+
- name: Generate new tag
24+
id: generate_tag
25+
uses: anothrNick/github-tag-action@1.61.0
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
WITH_V: true
29+
DEFAULT_BUMP: |
30+
${{
31+
github.ref_name == 'develop' && 'patch' || 'minor'
32+
}}
33+
DRY_RUN: true
34+
35+
push_to_registry:
36+
strategy:
37+
matrix:
38+
include:
39+
- web_url: "https://urdr.nbis.se"
40+
redmine_url: "https://projects.nbis.se"
41+
env: "prod"
42+
- web_url: "https://urdr-test.nbis.se"
43+
redmine_url: "https://urdr-test-redmine.nbis.se"
44+
env: "test"
45+
needs: tag
46+
if: needs.tag.outputs.part != ''
47+
name: Push Docker image to Github Container registry
1348
runs-on: ubuntu-latest
1449
permissions:
1550
contents: read
1651
packages: write
1752

1853
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v2
54+
- name: Check out the repo
55+
uses: actions/checkout@v4
2156

22-
- name: Build and push images
23-
working-directory: production
24-
env:
25-
DOCKER_BUILDKIT: 1
26-
COMPOSE_DOCKER_CLI_BUILD: 1
27-
GH_ACTOR: ${{ github.actor }}
28-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29-
GH_HEAD_REF: ${{ github.head_ref }}
57+
- name: Set environment variables
3058
run: |
31-
echo "${GH_TOKEN}" | docker login ghcr.io -u "${GH_ACTOR}" --password-stdin
32-
branch="${GH_HEAD_REF}"
33-
34-
for image in urdr urdr-web; do
35-
docker pull "ghcr.io/nbisweden/$image:latest" || true
36-
docker pull "ghcr.io/nbisweden/$image:$branch" || true
37-
done
38-
39-
cat > urdr.env <<END
40-
PUBLIC_API_URL="https://urdr.nbis.se"
41-
PUBLIC_REDMINE_URL="https://projects.nbis.se"
42-
END
43-
44-
TAG="$branch" docker-compose --env-file urdr.env build --build-arg BUILDKIT_INLINE_CACHE=1
45-
46-
for image in urdr urdr-web; do
47-
docker push "ghcr.io/nbisweden/$image:$branch"
48-
docker tag "ghcr.io/nbisweden/$image:$branch" "ghcr.io/nbisweden/$image:latest"
49-
docker push "ghcr.io/nbisweden/$image:latest"
50-
done
59+
GIT_BRANCH=${GITHUB_REF#refs/heads/}
60+
GIT_HASH=$(printf '%s\n' "$GITHUB_SHA" | cut -c -7)
61+
printf 'GIT_BRANCH=%s\n' "$GIT_BRANCH" >>"$GITHUB_ENV"
62+
printf 'GIT_HASH=%s\n' "$GIT_HASH" >>"$GITHUB_ENV"
63+
64+
- name: Log in to the Github Container registry
65+
uses: docker/login-action@v3
66+
with:
67+
registry: ghcr.io
68+
username: ${{ github.actor }}
69+
password: ${{ secrets.GITHUB_TOKEN }}
70+
71+
- name: Extract metadata (tags, labels) for Docker
72+
id: meta
73+
uses: docker/metadata-action@v5
74+
with:
75+
images: |
76+
ghcr.io/nbisweden/urdr
77+
ghcr.io/nbisweden/urdr-web
78+
79+
- name: Build and push urdr
80+
uses: docker/build-push-action@v5
81+
with:
82+
context: ./backend
83+
file: ./production/Dockerfile
84+
push: true
85+
tags: |
86+
ghcr.io/nbisweden/urdr:${{
87+
matrix.env == 'prod' && needs.tag.outputs.tag ||
88+
format('{0}-test', needs.tag.outputs.tag)
89+
}}
90+
ghcr.io/nbisweden/urdr:latest
91+
labels: |
92+
org.opencontainers.image.source=${{
93+
github.event.repository.clone_url
94+
}}
95+
org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
96+
org.opencontainers.image.revision=${{ github.sha }}
97+
98+
- name: Build and push urdr-web
99+
uses: docker/build-push-action@v5
100+
with:
101+
context: ./frontend
102+
file: ./production/Dockerfile.nginx
103+
build-args: |
104+
PUBLIC_API_URL=${{ matrix.web_url }}
105+
PUBLIC_REDMINE_URL=${{ matrix.redmine_url }}
106+
GIT_BRANCH=${{ env.GIT_BRANCH }}
107+
GIT_HASH=${{ env.GIT_HASH }}
108+
push: true
109+
tags: |
110+
ghcr.io/nbisweden/urdr-web:${{
111+
matrix.env == 'prod' && needs.tag.outputs.tag ||
112+
format('{0}-test', needs.tag.outputs.tag)
113+
}}
114+
ghcr.io/nbisweden/urdr-web:latest
115+
labels: |
116+
org.opencontainers.image.source=${{
117+
github.event.repository.clone_url
118+
}}
119+
org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
120+
org.opencontainers.image.revision=${{ github.sha }}
121+
122+
publish_tag:
123+
name: publish tag
124+
needs: [push_to_registry, tag]
125+
runs-on: ubuntu-latest
126+
steps:
127+
- uses: actions/checkout@v4
128+
with:
129+
fetch-depth: '1'
130+
- name: Push tag
131+
id: push_tag
132+
uses: anothrNick/github-tag-action@1.61.0
133+
env:
134+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
CUSTOM_TAG: ${{ needs.tag.outputs.tag }}

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
go-version: [1.19]
13+
go-version: [1.24]
1414
steps:
1515

1616
- name: Set up Go ${{ matrix.go-version }}

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ docker-compose build
7676
docker-compose up
7777
```
7878

79+
## Database migrations
80+
81+
The Urdr service has a local database. The schema of this database is
82+
defined in `backend/sql/schema.sql`. If the schema is updated, the
83+
database must be migrated to the new schema (unless the database instead
84+
is recreated from scratch). This is done by running the `migrate.sh`
85+
script in the `backend/sql` directory.
86+
87+
```command
88+
backend/sql/migrate.sh backend/database.db
89+
```
90+
7991
## Tests
8092

8193
There are tests for each part of the backend API, which can be tested by the following command:

backend/Dockerfile

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
FROM golang:1.20-alpine
1+
FROM golang:1.24-alpine
22

33
ENV XDG_CACHE_HOME='/tmp/.cache'
4+
ENV CC='/usr/lib/ccache/bin/clang'
45

56
WORKDIR /app
67

78
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
89

910
RUN apk --no-cache add \
10-
'curl=~8' \
11-
'gcc=~12' \
12-
'musl-dev=~1.2'; \
13-
curl --silent --fail --location \
14-
'https://raw.githubusercontent.com/cosmtrek/air/v1.44.0/install.sh' | \
15-
sh -e -s v1.40.4 && cp -v ./bin/air /bin/air
11+
curl=~8 \
12+
clang=~19 \
13+
clang-ccache=~19 \
14+
musl-dev=~1.2 \
15+
ccache=~4.10
16+
17+
RUN go install github.com/air-verse/air@v1.61.7
1618

1719
CMD ["air"]

0 commit comments

Comments
 (0)