Skip to content

Commit

Permalink
Update actions and test Passenger app (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-r-k-matsumoto authored Feb 4, 2024
1 parent 19e7025 commit d9bbefc
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 74 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ services:
depends_on:
- passenger-app
passenger-app:
image: ghcr.io/rakutentech/passenger-go-exporter/passenger-app:6.0.14
image: ghcr.io/rakutentech/passenger-go-exporter/passenger-app:6.0.20
platform: linux/x86_64
ports:
- 3000:3000
environment:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
strategy:
matrix:
passenger-version:
- 6.0.12
- 6.0.13
- 6.0.14
- 6.0.18
- 6.0.19
- 6.0.20
steps:
- uses: actions/checkout@v3
- uses: engineerd/setup-kind@v0.5.0
- uses: actions/checkout@v4
- uses: helm/kind-action@v1.5.0
with:
version: v0.11.1
cluster_name: kind
- name: Kind Load Image
run: |
docker build -t passenger-go-exporter:test .
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/passenger-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Passenger-App
on:
push:
branches:
- "passenger-app"
- "passenger-app"
tags-ignore:
- "**"
- "**"

jobs:
build:
Expand All @@ -14,30 +14,30 @@ jobs:
strategy:
matrix:
passenger-version:
- 6.0.11
- 6.0.12
- 6.0.13
- 6.0.18
- 6.0.19
- 6.0.20
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set env
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.USERNAME }}
password: ${{ secrets.CR_PAT }}

- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ./test/passenger-app
push: true
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@ on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: actions/cache@v3
cache: false
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
Expand All @@ -28,7 +34,7 @@ jobs:
run: go test -json ./... > test.json
- name: annotate tests
if: always()
uses: guyarb/golang-test-annotations@v0.6.0
uses: guyarb/golang-test-annotations@v0.7.0
with:
test-results: test.json
lint:
Expand All @@ -38,11 +44,9 @@ jobs:
go-version: [1.20]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
stable: 'true'
go-version: '1.20'
cache: false
- uses: golangci/golangci-lint-action@v3
with:
skip-go-installation: true
18 changes: 9 additions & 9 deletions .github/workflows/releease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ jobs:
COSIGN_EXPERIMENTAL: "1"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install cosign
uses: sigstore/cosign-installer@v2
uses: sigstore/cosign-installer@v3

- name: Set env
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.USERNAME }}
password: ${{ secrets.CR_PAT }}

- name: Build and push
id: build-and-push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down Expand Up @@ -77,18 +77,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.20"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.CR_PAT }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ passenger-go-exporter

# Dependency directories (remove the comment below to include it)
# vendor/

dist/
File renamed without changes.
33 changes: 33 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 1

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
archives:
- id: release-format
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
format: zip

checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^ci:"
32 changes: 0 additions & 32 deletions .goreleaser.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Implemented in golang, keeps memory consumption below 100MB, and runs on CPU 0.0
## Supported version

- golang: 1.20
- Passenger: 6.0.11, or later.
- Passenger: 6.0.18, or later.

All other versions have not been tested.

Expand Down
1 change: 1 addition & 0 deletions test/kubernetes/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ REPO_HOME=$(git rev-parse --show-toplevel)
kubectl delete namespace test --ignore-not-found=true --wait=true
kubectl create namespace test


# deploy
kubectl apply -k ${REPO_HOME}/test/kubernetes/test
kubectl set image -n test deployment/example example=ghcr.io/rakutentech/passenger-go-exporter/passenger-app:$PASSENGER_VERSION
Expand Down
9 changes: 3 additions & 6 deletions test/passenger-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
FROM ruby:2.7
FROM ruby:3.3

ARG ARG_RAILS_VERSION=7.0.2.4
ARG ARG_PASSENGER_VERSION=6.0.13
ARG ARG_RAILS_VERSION=7.0.8
ARG ARG_PASSENGER_VERSION=6.0.20
ENV RAILS_VERSION $ARG_RAILS_VERSION
ENV PASSENGER_VERSION $ARG_PASSENGER_VERSION
#
RUN apt-get update \
&& apt-get install -y nodejs

WORKDIR /app
# Create rails new application.
Expand Down

0 comments on commit d9bbefc

Please sign in to comment.